Conversation
- Updated comparison, groundedness, semantic similarity, and string matching checks to use the new JsonPathStr type for key fields. - Added validation for JSONPath syntax in the extraction module. - Introduced unit tests for JSONPath validation and enforcement tests to ensure all relevant fields use JsonPathStr.
Summary of ChangesHello @davidberenstein1957, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request significantly enhances the robustness and maintainability of JSONPath usage across the codebase by introducing a dedicated Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
The pull request introduces a new JsonPathStr type for JSONPath validation, enhancing type safety and ensuring correct JSONPath syntax in various check implementations. This is a good improvement for code quality and robustness. The changes correctly apply the new type to relevant fields in comparison, groundedness, semantic similarity, and string matching checks, and include appropriate unit and enforcement tests.
…at-initialization
…at-initialization
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request introduces a JsonPathStr type to validate JSONPath expressions at model creation time, which is a great improvement for robustness and user experience. The implementation is solid, using Pydantic's Annotated type and AfterValidator to enforce that paths are syntactically correct and start with the required 'trace.' prefix. The changes are consistently applied across all relevant check classes. The addition of comprehensive unit tests for the validation logic and a clever enforcement test to ensure future compliance demonstrates strong engineering practice. Overall, this is an excellent refactoring that enhances code quality and maintainability.
mattbit
left a comment
There was a problem hiding this comment.
I noted a quick fix on naming convention :)
| description="The text string to search within. If None, extracted from trace using text_key.", | ||
| ) | ||
| text_key: str = Field( | ||
| text_key: JsonPathStr = Field( |
There was a problem hiding this comment.
Minor thing but for consistency, JSONPathStr would be the recommended PEP8 style:
When using acronyms in CapWords, capitalize all the letters of the acronym. Thus HTTPServerError is better than HttpServerError.
| """Marker placed in JsonPathStr metadata. Used by the enforcement test.""" | ||
|
|
||
|
|
||
| _REQUIRED_JSONPATH_PREFIX = "trace." |
There was a problem hiding this comment.
I'm wondering: what's the use of forcing each key to start with trace? If this is the only thing allowed, shouldn't we extract the trace attributes instead?
E.g. trace.last -> last. Not needed in this PR, but maybe worth a quick discussion on the desired interface here.
There was a problem hiding this comment.
to make clear that is coming from the trace
Description
Related Issue
Type of Change
Checklist
CODE_OF_CONDUCT.mddocument.CONTRIBUTING.mdguide.pdm.lockrunningpdm update-lock(only applicable whenpyproject.tomlhas beenmodified)