Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Langchain::Evals::CosineSimilarity to calculate simple similarity between actual and expected outputs #855

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

andreibondarev
Copy link
Collaborator

No description provided.

@andreibondarev
Copy link
Collaborator Author

andreibondarev commented Oct 24, 2024

@bborn Okay, I re-packaged it a bit to a small, simple PR. I'm thinking of adding instructions to the README, something like:

# Execute the Assistant.
assistant.add_message_and_run! content: "What is 2+2?"
actual_output = assistant.messages.last.content

# Compare it's output to the expected output
Langchain::Evals::CosineSimilarity.new(llm).score(actual_output: actual_output, expected_output: "4")

( ^^^ Need a better example of course)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add SemanticSimilarity metric into the Langchain::Evals::Ragas class namespace
2 participants