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

Improve string format handling for gemini #609

Merged
merged 1 commit into from
Jan 6, 2025

Conversation

dmontagu
Copy link
Contributor

@dmontagu dmontagu commented Jan 3, 2025

Addresses an issue demonstrated in #582.

In particular, this PR pops the 'format' field from string schemas (the presence of which is causing API errors), and uses it to modify the field description, which seems to result in responses that don't have errors and parse successfully.

This PR doesn't go as far as was requested in that issue, but the approach I've used here seems reasonable given we do get API errors without it, it seems like a common usage scenario, and I also confirmed manually with gemini-1.5-flash that the changes in this PR result in responses that parse successfully, at least for the specific prompt/model I was using (basically the one from that issue).

Weirdly, the VertexAI docs say that:

For the format field, Vertex AI supports the following values: date, date-time, duration, and time. The description and format of each value is described in the OpenAPI Initiative Registry

But in practice it didn't seem to work with any of these. If/when those format values do start to work, we could revert this change.

Copy link

sonarqubecloud bot commented Jan 3, 2025

@samuelcolvin samuelcolvin merged commit faff8a9 into main Jan 6, 2025
15 checks passed
@samuelcolvin samuelcolvin deleted the dmontagu/improve-gemini-date-handling branch January 6, 2025 16:52
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.

2 participants