-
Notifications
You must be signed in to change notification settings - Fork 317
genai: improve _convert_pydantic_to_genai_function()
#1065
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
genai: improve _convert_pydantic_to_genai_function()
#1065
Conversation
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.
Approved
| }, | ||
| ) | ||
| return function_declaration | ||
| def _convert_pydantic_to_genai_function(model: BaseModel, function_name: str = None) -> dict: |
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.
Could you add test and inline citation to the Gemini function tool schema? Also run lint please 🥺
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.
sorry, it will take time for me so i will try to make updates within 2 weeks.
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.
doing it now
_convert_pydantic_to_genai_function()
PR Description
Refactored the
_convert_pydantic_to_genai_functionfunction to improve compatibility with Gemini'sfunction_declarationsformat. The internal logic was updated to ensure that apydantic.BaseModelis properly converted to Gemini-compatible tool definitions. No changes were made to the function name, signature, or external interface.Relevant issues
N/A
Type
🐛 Bug Fix
🧹 Refactoring
Changes
Rewrote the internal logic of
_convert_pydantic_to_genai_functionto:function_declarationslistdescription