-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Expanded the _validate_anthropic_response function to include comprehensive checks #10505
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
base: main
Are you sure you want to change the base?
Conversation
…ehensive checks for response structure, ensuring all required fields are validated. - Updated unit tests to utilize the new validation function for verifying response integrity in both non-streaming and streaming scenarios.
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
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.
mostly good, missing validation for streaming chunks. please add that
if isinstance(response, AsyncIterator): | ||
async for chunk in response: | ||
print("chunk=", chunk) | ||
collected_chunks.append(chunk) | ||
if "content" in chunk and len(chunk["content"]) > 0: | ||
for content_block in chunk["content"]: |
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.
please can you validate the streaming chunks received
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.
Done, also using Anthropic SDK for non-streaming validation.
One approach - use anthropic sdk's pydantic object and use For streaming, try to validate each chunk |
- Upgraded Poetry version in poetry.lock to 2.0.1. - Added the Anthropic library (version 0.50.0) to pyproject.toml. - Enhanced unit tests for Anthropic messages to utilize the new validation method and updated model references for consistency. - Improved response validation in tests to ensure compliance with the Anthropic Messages API structure.
…m_messages_support_update_tc
✅ Test
Changes