-
Notifications
You must be signed in to change notification settings - Fork 222
feat(evals): add run_batched_evaluation #1436
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
Merged
Merged
Conversation
This file contains hidden or 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
Contributor
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
4 files reviewed, no comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Important
Adds
run_batched_evaluationto Langfuse client for large-scale evaluation with error handling, retry logic, and resume capability, along with comprehensive tests.run_batched_evaluation()to Langfuse client inclient.pyfor large-scale evaluation of traces and observations.batch_evaluation.pymodule for batch evaluation logic.tests/test_batch_evaluation.pywith 40+ test cases.client.pyto adhere to style guide.This description was created by
for 931bdd2. You can customize this summary. It will automatically update as commits are pushed.
Disclaimer: Experimental PR review
Greptile Overview
Greptile Summary
This PR adds
run_batched_evaluationto enable large-scale evaluation of traces, observations, and sessions. The implementation includes mapper functions, evaluators, composite evaluators, comprehensive error handling, retry logic, and resume capability.Key Changes
batch_evaluation.pymodule with core implementationrun_batched_evaluation()method to Langfuse clientEvaluatorInputs,MapperFunction,CompositeEvaluatorFunction,EvaluatorStats,BatchEvaluationResumeToken,BatchEvaluationResult) to public APIIssues Found
Confidence Score: 4/5
Important Files Changed
File Analysis
run_batched_evaluationmethod with comprehensive docs; import should be moved to top per style guideSequence Diagram
sequenceDiagram participant User participant Langfuse as Langfuse Client participant Runner as BatchEvaluationRunner participant API as Langfuse API participant Mapper participant Evaluator User->>Langfuse: run_batched_evaluation(scope, mapper, evaluators, ...) Langfuse->>Runner: create BatchEvaluationRunner Langfuse->>Runner: run_async(...) loop For each batch (pagination) Runner->>API: fetch_batch_with_retry(scope, filter, page) API-->>Runner: items batch loop For each item in batch (concurrent) Runner->>Mapper: map(item) Mapper-->>Runner: EvaluatorInputs loop For each evaluator Runner->>Evaluator: evaluate(input, output, ...) Evaluator-->>Runner: Evaluation(s) Runner->>Langfuse: create_score(trace_id/obs_id/session_id) end opt If composite_evaluator Runner->>Evaluator: composite_evaluator(item, evaluations) Evaluator-->>Runner: composite Evaluation Runner->>Langfuse: create_score(...) end end end Runner->>Langfuse: flush() Runner-->>Langfuse: BatchEvaluationResult Langfuse-->>User: BatchEvaluationResultContext used:
dashboard- Move imports to the top of the module instead of placing them within functions or methods. (source)