-
Notifications
You must be signed in to change notification settings - Fork 437
feat(evaluators): add JSON Multi-Field Match evaluator for entity extraction validation #3331
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
feat(evaluators): add JSON Multi-Field Match evaluator for entity extraction validation #3331
Conversation
…oring and update configurations
…te_score instead of score and enhance field comparison descriptions
…d paths in evaluations
…nused styles and optimizing class names
…n workflow handlers
Fixes naming inconsistency between API service and SDK interface schema. The interface defines `aggregate_score` as the required output field, so the service must use the same name to pass schema validation. Also applies ruff auto-cleanup for unused imports. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <[email protected]>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Demo CleanShot.2025-12-30.at.21.07.17.mp4 |
| oss: Optional[bool] = False | ||
| requires_llm_api_keys: Optional[bool] = False | ||
| tags: List[str] | ||
| archived: Optional[bool] = False |
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.
this was forgotten
| "name": "JSON Field Match", | ||
| "key": "field_match_test", | ||
| "direct_use": False, | ||
| "archived": True, # Deprecated - use json_multi_field_match instead |
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.
old json evaluators will continue working + they will still be editable in the UI but no user can create new ones.
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.
@jp-agenta let's not remove the old evaluators by mistake, a lot of users rely on them, deprecating them completely is more pain than just keeping them indefinitely imo
| "settings_template": { | ||
| "fields": { | ||
| "label": "Fields to Compare", | ||
| "type": "fields_tags_editor", # Custom type - tag-based add/remove editor |
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.
this tells the UI how to show the playground
| return {"outputs": {"success": result}} | ||
|
|
||
|
|
||
| def get_nested_value(obj: Any, path: str) -> Any: |
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.
maybe in the future:
- This could become more general (allowing the use of json paths)
- This is likely to be a common function
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.
@ardaerzin the code as is mixes business logic and UI (the tag addition / removal component).
For now, I don't see us using this component somewhere else. I expect we would have something like this when we start using tags everywhere. It would make sense then to refactor it to disconnect both.
Let me know what you think. Is this too hacky or good enough for the use case
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.
good call
| * @param prefix - Current path prefix (used for recursion) | ||
| * @returns Array of dot-notation paths to all leaf values | ||
| */ | ||
| export const extractJsonPaths = (obj: unknown, prefix = ""): string[] => { |
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.
@ardaerzin this feels like something we have already / would have, no?
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.
we already have safeJson5Parse, but no path utils like the ones you created here. in testsets these were handled via columns. I'll think of adding this to the loadable api I'm planning currently
…path formats Updated the get_nested_value function to utilize resolve_any() for improved path resolution, allowing support for dot notation, JSON Path, and JSON Pointer formats. Cleaned up imports and ensured consistent error handling for path resolution failures.
…-match-evaluator # Conflicts: # api/oss/src/services/evaluators_service.py # sdk/agenta/sdk/workflows/handlers.py
… reactivity - Updated FieldsTagsEditor component to utilize Form.useWatch instead of form.getFieldValue for monitoring changes to correct_answer_key. - This change enhances reactivity and ensures the component responds appropriately to form updates.
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.
good call
| * @param prefix - Current path prefix (used for recursion) | ||
| * @returns Array of dot-notation paths to all leaf values | ||
| */ | ||
| export const extractJsonPaths = (obj: unknown, prefix = ""): string[] => { |
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.
we already have safeJson5Parse, but no path utils like the ones you created here. in testsets these were handled via columns. I'll think of adding this to the loadable api I'm planning currently
Summary
aggregate_scoreshowing the percentage of matching fieldsJSON Field Matchevaluator in favor of this more powerful versionFeatures
user.address.city)items.0.name)Changes
Backend (SDK)
json_multi_field_match_v0handler with nested value extractionBackend (API)
Frontend
FieldsTagsEditorcomponent (Tailwind CSS, follows AGENTS.md guidelines)extractJsonPathshelper for JSON field detectionfields_tags_editorform field typeTest plan
user.address.city🤖 Generated with Claude Code