-
Notifications
You must be signed in to change notification settings - Fork 215
Open
Labels
feature requestIdeas to improve an integrationIdeas to improve an integration
Description
Is your feature request related to a problem? Please describe.
GoogleGenAIChatGenerator doesn't support structured outputs. Users coming from OpenAIChatGenerator expect generation_kwargs={"response_format": MyModel} to work, but it's silently ignored.
Describe the solution you'd like
Accept response_format in generation_kwargs (Pydantic model or JSON schema dict) and internally translate it to Google's native response_schema + response_mime_type: "application/json" in GenerateContentConfig. Should work for both run() and run_async().
Describe alternatives you've considered
- Passing
response_schema+response_mime_typedirectly ingeneration_kwargs. Works but undocumented, requires Google SDK internals knowledge, and breaks cross-provider portability. - Wrapping the component in a custom pre-processing layer. Adds boilerplate and puts the burden on users.
Additional context
OpenAIChatGenerator,MistralChatGenerator,NvidiaChatGeneratorand others already supportresponse_format.GoogleGenAIChatGeneratoris notably absent from [the structured output tutorial](https://haystack.deepset.ai/tutorials/28_structured_output_with_openai).- Google's SDK docs on structured output: https://ai.google.dev/gemini-api/docs/structured-output
- The
OpenAIChatGeneratorstructured output implementation (v2.18.0) can serve as reference. - I'm willing to implement this, looking for maintainer alignment on the approach before opening a PR.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
feature requestIdeas to improve an integrationIdeas to improve an integration