langchainrb
langchainrb copied to clipboard
Langchain::Evals::CosineSimilarity to calculate simple similarity between actual and expected outputs
@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)
@andreibondarev is this only missing the README update?