-
Notifications
You must be signed in to change notification settings - Fork 16.7k
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
[Breaking] Update Evaluation Functionality #7388
Merged
Merged
+3,626
−2,546
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
The latest updates on your projects. Learn more about Vercel for Git ↗︎ 1 Ignored Deployment
|
a7bea23
to
4d50092
Compare
2c15e64
to
8c60e72
Compare
Opened a PR to add langsmith to |
b01a3b9
to
4a632f9
Compare
agola11
approved these changes
Jul 12, 2023
- Add an enum - Rm support for multi-criteria in single evaluator
Use `EvalConfig` n the `run_on_dataset` function, plus: - Add proactive validation for compatibility with the evaluators ( e.g., check can be converted to prompt or messages for LLM or check example input keys against the chain) - Improve error messaging for the dataset <-> model you're testing - Integration tests for the combinations of dataset formats and llm, chat models, and chains Deltas off [#7508](#7508) (split the criteria evalutaor into the reference free and labeled classes) which builds off [#7388](#7388) which migrates from langchainplus_sdk to langsmith package <details> <summary>Dataset/ model setup</summary><pre><code> # """Evaluation chain for a single QA evaluator.""" from uuid import uuid4 import pandas as pd from langchain.client.runner_utils import run_on_dataset from langsmith import Client client = Client() dataset_name = f"Testing - {str(uuid4())[-8:]}" df = pd.DataFrame( { "some_input": [ "What's the capital of California?", "What's the capital of Nevada?", "What's the capital of Oregon?", "What's the capital of Washington?", ], "some_output": ["Sacramento", "Carson City", "Salem", "Olympia"], } ) ds = client.upload_dataframe( df, dataset_name, input_keys=["some_input"], output_keys=["some_output"] ) from langchain.chat_models import ChatOpenAI from langchain.chains import LLMChain def chain_constructor() -> None: """Evaluate a chain on a dataset.""" llm = ChatOpenAI(model="gpt-3.5-turbo", temperature=0) chain = LLMChain.from_string(llm, "What's the capital of {input}?") return chain </code></pre></details> **Relevant snippet** ``` from langchain.evaluation.run_evaluators.config import ( RunEvalConfig, ) evaluation_config = RunEvalConfig( evaluator_configs=[ RunEvalConfig.Criteria(criteria="helpfulness"), RunEvalConfig.Criteria( criteria={"my-criterion": "Is the answer fewer than 10 words?"} ), "qa", # Or could do RunEvalConfig.ContextQA(), etc. "context_qa", "embedding_distance", ] ) run_on_dataset( dataset_name, llm_or_chain_factory=chain_constructor, run_evaluator_config=evaluation_config, ) ``
1 task
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
🤖:enhancement
A large net-new component, integration, or chain. Use sparingly. The largest features
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
langsmith
packagerun_on_dataset()
API to use an eval config