-
-
Notifications
You must be signed in to change notification settings - Fork 918
fix(genai): preserve thought_signature in validation retries
#2001
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
Open
drdraad
wants to merge
6
commits into
567-labs:main
Choose a base branch
from
drdraad:feature/gemini-thought-signature
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
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.
Important
Looks good to me! 👍
Reviewed everything up to f10c1a1 in 1 minute and 5 seconds. Click for details.
- Reviewed
271lines of code in7files - Skipped
0files when reviewing. - Skipped posting
10draft comments. View those below. - Modify your settings and rules to customize what types of comments Ellipsis leaves. And don't forget to react with 👍 or 👎 to teach Ellipsis.
1. instructor/providers/gemini/utils.py:681
- Draft comment:
The shallow copying of the 'contents' list is clear, but consider if a deep copy might be needed for nested mutable objects in future modifications. - Reason this comment was not posted:
Confidence changes required:50%<= threshold85%None
2. instructor/providers/gemini/utils.py:693
- Draft comment:
Inside the loop iterating over candidates, the selection of 'function_call' and 'function_call_content' is clear. Adding a brief inline comment to explain the selection logic could improve future maintainability. - Reason this comment was not posted:
Confidence changes required:30%<= threshold85%None
3. instructor/providers/gemini/utils.py:718
- Draft comment:
In the branch where no function_call is found, the code appends the model content (if available) and a user message with the error. A comment explaining why this fallback is chosen would benefit future readers. - Reason this comment was not posted:
Confidence changes required:30%<= threshold85%None
4. instructor/providers/gemini/utils.py:730
- Draft comment:
When a function_call is found, the tool response is appended while preserving the original thought_signature. This behavior is validated by tests; ensure that any future changes maintain this preservation. - Reason this comment was not posted:
Confidence changes required:20%<= threshold85%None
5. scripts/audit_patterns.py:15
- Draft comment:
Removed the unused 'Set' import from typing. This cleanup improves code clarity. - Reason this comment was not posted:
Confidence changes required:0%<= threshold85%None
6. scripts/check_links.py:12
- Draft comment:
The removal of 'defaultdict' from the imports is appropriate since it's not used in this file. - Reason this comment was not posted:
Confidence changes required:0%<= threshold85%None
7. scripts/fix_old_patterns.py:14
- Draft comment:
Simplified type hints by removing unused types (e.g. Dict) from the imports. This reduces clutter in the code. - Reason this comment was not posted:
Confidence changes required:0%<= threshold85%None
8. scripts/validate_meta_tags.py:15
- Draft comment:
Removed the unused 'Set' import from typing to keep the import list clean. - Reason this comment was not posted:
Confidence changes required:0%<= threshold85%None
9. tests/llm/test_genai/test_reask.py:7
- Draft comment:
The test for GENAI_TOOLS validation retry is well-structured and clearly verifies that the retry mechanism triggers the expected InstructorRetryException with the correct number of attempts. - Reason this comment was not posted:
Confidence changes required:0%<= threshold85%None
10. tests/test_genai_reask.py:12
- Draft comment:
The newly added tests effectively validate reask_genai_tools behavior, including preservation of thought_signature, proper fallback when response is None, and handling cases with no function call. This provides comprehensive coverage. - Reason this comment was not posted:
Confidence changes required:0%<= threshold85%None
Workflow ID: wflow_vSPZ3odDPSOVjFeD
You can customize by changing your verbosity settings, reacting with 👍 or 👎, replying to comments, or adding code review rules.
Collaborator
|
@cursoragent can you update the change log and review this |
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.
Describe your changes
Preserve GenAI response metadata (e.g. thought_signature) across validation retries in GENAI_TOOLS by replaying the model Content and then adding a tool function_response with validation errors.
Add targeted tests covering the GENAI reask path (unit) and a minimal end-to-end validation retry check (LLM-gated).
Issue ticket number and link
N/A
Checklist before requesting a review
[x] I have performed a self-review of my code
[x] If it is a core feature, I have added thorough tests.
[x] If it is a core feature, I have added documentation.
Test plan:
test_genai_reask.py
test_reask.py
Important
Enhances
reask_genai_toolsto preservethought_signatureduring validation retries and adds tests for comprehensive coverage.reask_genai_toolsinutils.pynow preservesthought_signatureby replaying model content and adding tool function responses with validation errors.test_reask.pyto testreask_genai_toolsfor preservingthought_signature, handling absent function calls, and processingNoneresponses.test_genai_reask.pyfor end-to-end validation retry checks inGENAI_TOOLSmode.audit_patterns.py,check_links.py, andvalidate_meta_tags.py.This description was created by
for f10c1a1. You can customize this summary. It will automatically update as commits are pushed.