Skip to content
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

Support nested pydantic models with Gemini tool calling [DRAFT] #222

Draft
wants to merge 3 commits into
base: dev
Choose a base branch
from

Conversation

barapa
Copy link
Contributor

@barapa barapa commented May 9, 2024

Attempt at addressing #221

The google-supported schema is very far off from openapi spec. This may be worth waiting for them to solve it themselves.

@barapa barapa marked this pull request as draft May 9, 2024 00:31
@barapa barapa changed the title Support nested pydantic models with Gemini tool calling Support nested pydantic models with Gemini tool calling [DRAFT] May 9, 2024
pprint.pprint(without_refs)

# Get the name and description, and remove them from the schema
name: str = without_refs.pop("title") # type: ignore
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

quick note:

name and description are already in super().tool_schema(), so it's really just the parameters field that needs to be modified (and thus remove duplicate code).


# Remove all instances of title key in each param definition
# This is careful not to delete keys that represent a field with the name title
remove_invalid_title_keys_from_parameters(parameters)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what if all of the conversion of parameters was pushed inside this utility function so the main function remains clean and the utility function can be separately unit tested?

@barapa
Copy link
Contributor Author

barapa commented May 9, 2024

This isn't quite ready for review - it's still messy as I am experimenting. If I get it over the finish line I will clean it up beforehand.

@barapa barapa closed this May 9, 2024
@barapa barapa reopened this May 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants