-
Notifications
You must be signed in to change notification settings - Fork 2k
Support responseSchema in VertexAiGeminiChatOptions #3765
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 responseSchema in VertexAiGeminiChatOptions #3765
Conversation
|
@SuminAndrew, could you sign your commit using DCO? https://spring.io/blog/2025/01/06/hello-dco-goodbye-cla-simplifying-contributions-to-spring |
931d6b6 to
f8cc6d4
Compare
@sobychacko Done |
|
Hey @sobychacko, I wonder what are the next steps for this PR? Should I tag someone to get this reviewed? |
42e331b to
cfabfe0
Compare
|
Updated the branch to fix conflicts with the main branch |
|
Also tagging @ilayaperumalg |
cfabfe0 to
82a25f2
Compare
|
Rebased onto a fresh main branch to fix failing MCP Client tests (unrelated to the changeset). |
Closes spring-projects#2087 Signed-off-by: Andrei Sumin <[email protected]>
82a25f2 to
fe7f34a
Compare
|
Another rebase to stay up-to-date |
|
@SuminAndrew Sorry about the delay in response. The changes look good. Rebased, verified the tests and build locally, and merged as 31423e9. |
|
@SuminAndrew Thank you for adding this feature! |
Closes #2087
VertexAI's GenerationConfig natively uses a
Schemaobject to configure response schema, which represents an OpenAPI schema. There's also aresponseJsonSchemaoption, but it is only supported in Gemini 2.5 (see: https://ai.google.dev/gemini-api/docs/structured-output#json-schema).To support this, I added a new
String responseSchemaproperty toVertexAiGeminiChatOptions. This allows users to provide an OpenAPI schema as a string, which is then converted into aSchemaobject internally. The same approach is already used for tool definitions viainputSchemas, so I extracted the conversion logic into a shared utility class. I also added corresponding unit tests.