-
Notifications
You must be signed in to change notification settings - Fork 928
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
fix(agents-api): fix model=None
case for chat endpoint
#1206
Conversation
WalkthroughThe update enhances the model validation process by relocating it from Changes
Entelligence.ai can learn from your feedback. Simply add 👍 / 👎 emojis to teach it your preferences. More shortcuts belowEmoji Descriptions:
Interact with the Bot:
|
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
|
PR Code Suggestions ✨Explore these optional code suggestions:
|
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.
👍 Looks good to me! Reviewed everything up to b2599e5 in 4 minutes and 12 seconds
More details
- Looked at
1643
lines of code in5
files - Skipped
0
files when reviewing. - Skipped posting
17
drafted comments based on config settings.
1. schemas/create_agent_request.json:11696
-
Draft comment:
This schema duplicates the existingVectorDocSearchRequest
Pydantic model. Consider reusing the existing model instead of creating a new schema definition. -
class VectorDocSearchRequest (Docs.py)
-
Reason this comment was not posted:
Decided after close inspection that this draft comment was likely wrong and/or not actionable: usefulness confidence = 0% vs. threshold = 50%
The comment appears to be incorrect. While there is some overlap in fields between VectorDocSearch and VectorDocSearchRequest, they serve different purposes and have different field sets. VectorDocSearch appears to be a more complete configuration schema while VectorDocSearchRequest seems to be a more focused request schema. This is a common pattern in APIs where you have different schemas for different use cases even if they share some fields. The comment also violates the rule about only commenting on changed code, since it's referencing an existing model rather than focusing on the changes.
Could I be missing some architectural context where reusing the model would actually be beneficial? Perhaps there's a broader pattern of model reuse I'm not seeing?
Even if model reuse might be beneficial in some cases, the schemas clearly serve different purposes with different field sets. Additionally, per the review rules, we should only comment on the changes themselves, not suggest architectural changes based on existing code.
The comment should be deleted because it incorrectly suggests the schemas are duplicates when they serve different purposes with different fields, and it violates the rule about only commenting on the changes themselves.
2. agents-api/agents_api/routers/sessions/render.py:80
- Draft comment:
Instead of validating chat_input.model directly, this uses settings.get('model'). Ensure that merging settings doesn’t override a valid model provided in the request unintentionally. - Reason this comment was not posted:
Decided after close inspection that this draft comment was likely wrong and/or not actionable: usefulness confidence = 10% vs. threshold = 50%
The comment raises a reasonable point about potential model overrides. However, merge_settings() is likely designed to handle this properly, and without seeing its implementation, we can't be certain there's an actual issue. The code change appears intentional to validate the final merged model rather than just the input model. The suggestion to revert seems speculative without strong evidence of a problem.
I don't have visibility into how merge_settings() works or what the intended behavior is. The current code could be the correct approach if we want to validate the final model after merging all settings.
Without clear evidence of a bug or seeing merge_settings() implementation, this comment is speculative and asks for verification rather than pointing out a definite issue.
The comment should be deleted as it's speculative and asks for verification without strong evidence of an actual problem.
3. agents-api/agents_api/routers/utils/model_validation.py:4
- Draft comment:
Updated function signature to accept None, but consider explicitly checking for None and returning a clear, user‐friendly error message. - Reason this comment was not posted:
Decided after close inspection that this draft comment was likely wrong and/or not actionable: usefulness confidence = 10% vs. threshold = 50%
The current implementation will already handle None gracefully - it will result in a 400 error saying "Model None not available". This is actually a perfectly clear and user-friendly error message. Adding a special case for None would just duplicate error handling logic without adding value. The comment suggests adding complexity that isn't necessary.
Maybe None deserves a more specific error message like "Model name cannot be null" instead of treating it like any other invalid model name?
The current error message is actually more helpful because it shows the available models list, which is more actionable than just saying the name can't be null.
The comment should be deleted because the current implementation already handles None gracefully with a clear error message, and adding special None handling would be unnecessary complexity.
4. agents-api/tests/test_model_validation.py:26
- Draft comment:
Test updated to expect failure when model is None. Confirm that the error message 'Model None not available' is acceptable for end users. - Reason this comment was not posted:
Comment did not seem useful. Confidence is useful =0%
<= threshold50%
The comment is asking the PR author to confirm if the error message is acceptable for end users. This falls under asking the author to confirm their intention or ensure behavior, which is against the rules.
5. schemas/create_agent_request.json:102
- Draft comment:
Renaming 'ApiCallDef-Input' and similar definitions improves consistency but ensure that any downstream clients or integrations are updated accordingly. - Reason this comment was not posted:
Comment did not seem useful. Confidence is useful =0%
<= threshold50%
The comment is asking the PR author to ensure that downstream clients or integrations are updated, which violates the rule against asking the author to ensure things are tested or verified. It does not provide a specific code suggestion or ask for a specific test to be written.
6. schemas/create_agent_request.json:3734
- Draft comment:
Adding '$ref' for VectorDocSearch and TextOnlyDocSearch in 'recall_options' enhances search flexibility. Verify that the new schemas meet all integration tests and client expectations. - Reason this comment was not posted:
Comment was not on a location in the diff, so it can't be submitted as a review comment.
7. schemas/create_agent_request.json:6056
- Draft comment:
Updated HybridDocSearch alpha default from 0.75 to 0.5 and added a const constraint for 'mode'. Ensure that this adjustment is intentional and consistently applied across all environments. - Reason this comment was not posted:
Comment was not on a location in the diff, so it can't be submitted as a review comment.
8. schemas/create_agent_request.json:10664
- Draft comment:
New entries for TextOnlyDocSearch and VectorDocSearch definitions are added. Confirm validation constraints (e.g., defaults, limits, const for mode) match requirements thoroughly. - Reason this comment was not posted:
Comment was not on a location in the diff, so it can't be submitted as a review comment.
9. schemas/create_task_request.json:102
- Draft comment:
Renaming 'ApiCallDef-Input' to 'ApiCallDef' is repeated in create_task_request.json for consistency. Make sure any backward compatibility concerns are addressed. - Reason this comment was not posted:
Comment did not seem useful. Confidence is useful =20%
<= threshold50%
The comment is asking the author to ensure backward compatibility, which is against the rules. It does not provide a specific suggestion or ask for a specific test to be written. It is more of a general cautionary note.
10. agents-api/agents_api/routers/sessions/render.py:80
- Draft comment:
Ensure that chat_context.merge_settings properly copies chat_input.model into settings, so that validate_model receives the intended value rather than unnecessarily receiving None. - Reason this comment was not posted:
Comment looked like it was already resolved.
11. agents-api/agents_api/routers/utils/model_validation.py:4
- Draft comment:
Since the function now accepts a None value, consider refining the error message to clarify if no model was provided (e.g., 'No model specified' vs. 'Model None not available'). - Reason this comment was not posted:
Confidence changes required:50%
<= threshold50%
None
12. schemas/create_agent_request.json:102
- Draft comment:
Renaming 'ApiCallDef-Input' to 'ApiCallDef' is a significant breaking change. Please ensure that all downstream consumers are updated to use the new definition. - Reason this comment was not posted:
Comment did not seem useful. Confidence is useful =0%
<= threshold50%
The comment is asking the PR author to ensure that all downstream consumers are updated, which violates the rule against asking the author to ensure compatibility or test changes. It does not provide a specific code suggestion or ask for a specific test to be written.
13. schemas/create_agent_request.json:6056
- Draft comment:
The default alpha value in HybridDocSearch has been changed from 0.75 to 0.5. Confirm that this adjustment is intentional and that related functionality has been tested. - Reason this comment was not posted:
Comment was not on a location in the diff, so it can't be submitted as a review comment.
14. schemas/create_agent_request.json:9686
- Draft comment:
SpiderIntegrationDef now contains only the 'arguments' property; properties like 'method', 'provider', and 'setup' have been removed. Verify that this intentional removal matches the current integration requirements. - Reason this comment was not posted:
Comment was not on a location in the diff, so it can't be submitted as a review comment.
15. schemas/create_agent_request.json:3734
- Draft comment:
The recall_options now include new alternatives ($ref to VectorDocSearch and TextOnlyDocSearch). Ensure that downstream systems correctly handle these new search types. - Reason this comment was not posted:
Comment was not on a location in the diff, so it can't be submitted as a review comment.
16. schemas/create_task_request.json:102
- Draft comment:
Similar to the agent request schema, 'ApiCallDef-Input' has been renamed to 'ApiCallDef' in the task request schema. Ensure that all client integrations referencing these schemas are aware of this breaking change. - Reason this comment was not posted:
Comment did not seem useful. Confidence is useful =0%
<= threshold50%
The comment is asking the PR author to ensure that all client integrations are aware of a breaking change. This falls under the rule of not asking the author to ensure behavior is intended or to double-check things. Therefore, this comment should be removed.
17. schemas/create_agent_request.json:2920
- Draft comment:
Typo detected: The schema titled 'CompetionUsage' appears to be misspelled. Consider renaming it to 'CompletionUsage' for clarity and consistency. - Reason this comment was not posted:
Comment was not on a location in the diff, so it can't be submitted as a review comment.
Workflow ID: wflow_9Nn12D0uYUF0KeOE
You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet
mode, and more.
User description
closes #1060
EntelligenceAI PR Summary
Purpose:
Changes:
settings
for better accuracy.ApiCallDef
andSpiderIntegrationDef
in schema files.TextOnlyDocSearch
andVectorDocSearch
for improved search capabilities.Impact:
PR Type
Bug fix, Enhancement, Tests
Description
Fixed validation for
None
model in chat endpoint.Enhanced schema definitions by consolidating redundant entries.
Added new
TextOnlyDocSearch
andVectorDocSearch
schema types.Introduced tests for
None
model validation and improved error handling.Changes walkthrough 📝
render.py
Refactored model validation in chat endpoint
agents-api/agents_api/routers/sessions/render.py
chat_input.model
.create_agent_request.json
Enhanced schema definitions with new types
schemas/create_agent_request.json
ApiCallDef
andSpiderIntegrationDef
schema definitions.TextOnlyDocSearch
andVectorDocSearch
schema types.HybridDocSearch
properties.create_task_request.json
Enhanced schema definitions with new types
schemas/create_task_request.json
ApiCallDef
andSpiderIntegrationDef
schema definitions.TextOnlyDocSearch
andVectorDocSearch
schema types.HybridDocSearch
properties.model_validation.py
Enhanced model validation logic
agents-api/agents_api/routers/utils/model_validation.py
validate_model
to handleNone
as input.test_model_validation.py
Added tests for model validation
agents-api/tests/test_model_validation.py
None
model validation.