-
Notifications
You must be signed in to change notification settings - Fork 16
fix(response_format): changed default serialization #648
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
Conversation
ebebac2 to
2d635f6
Compare
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.
Pull Request Overview
This PR fixes response format handling and serialization issues in the UiPath Python SDK. The changes improve message format compatibility and resolve JSON serialization errors when using Pydantic BaseModel classes as parameters.
- Enhanced message format support to accept both dictionaries and tuples with role normalization
- Improved serialization handling for Pydantic BaseModel classes and instances
- Added comprehensive test coverage for the new functionality
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
src/uipath/_services/llm_gateway_service.py |
Added role mapping and message format conversion to support tuples and normalize roles |
src/uipath/tracing/_utils.py |
Enhanced serialization to handle Pydantic BaseModel classes with schema representation |
tests/tracing/test_traced.py |
Added comprehensive test for Pydantic BaseModel serialization and tuple message handling |
pyproject.toml |
Version bump to 2.1.73 |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
e06040f to
40af737
Compare
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.
Pull Request Overview
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
5f9f886 to
066c2e9
Compare
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.
Thanks for addressing this! :)
066c2e9 to
7ffcd26
Compare
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.
LGTM 🚀
7ffcd26 to
55aed6b
Compare
55aed6b to
2154b2d
Compare
|
|
||
| request_body = { | ||
| "messages": messages, | ||
| "messages": converted_messages, |
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.
do we have a clear error message from llm gateway if the 'roles' passed are not the expected ones? If not we should validate them against a well known roles list before sending the request
2154b2d to
b630081
Compare
b630081 to
80035ec
Compare
Description
Updated the
chat_completionsmethod inllm_gateway_service.pyto accept both lists of dictionaries and lists of tuples as message input.Improved the
_simple_serialize_defaultsfunction intracing/_utils.pyto handle PydanticBaseModelinstances and classes, including schema serialization for classes and preventing serialization of class types as instances.Fix Issue Invoking
chat_completionswithresponse_format=pydantic_modelthrows exception #635