fix: skip eval invocations without user content to prevent ValidationError#6134
Open
tcconnally wants to merge 3 commits into
Open
fix: skip eval invocations without user content to prevent ValidationError#6134tcconnally wants to merge 3 commits into
tcconnally wants to merge 3 commits into
Conversation
Collaborator
|
Hi @tcconnally , Thank you for your contribution! We appreciate you taking the time to submit this pull request. Can you please fix the failing mypy-diff tests before we can proceed with the review. |
…Error When a session contains invocations without user-authored events, convert_events_to_eval_invocations() created an Invocation with an empty Content(parts=[]). This caused a Pydantic ValidationError because Invocation.user_content is typed as genai_types.Content (non-optional) and an empty Content with no parts triggered validation failure. Fix: skip invocations entirely when no user event is found in the event list, since evaluations without user input are not meaningful. Closes google#3760
Author
|
Fixed the mypy issue — added |
41a49b0 to
9352f62
Compare
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
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.
Problem
When a session contains invocations without user-authored events (author != "user"),
convert_events_to_eval_invocations()creates an Invocation with an emptyContent(parts=[]). This causes a Pydantic ValidationError becauseInvocation.user_contentis typed asgenai_types.Contentand empty Content triggers validation failure.Error when calling
POST /apps/{app_name}/eval-sets/{eval_set_id}/add-session:Fix
Skip invocations entirely when no user event is found. Evaluations without user input are not meaningful, so filtering them out is both a correctness fix and an efficiency improvement.
Before
After
Closes #3760