Skip to content

Conversation

@Amnah199
Copy link
Contributor

Related Issues

  • The to_dict method currently converts Pydantic models to JSON Schema, which can cause errors when the deserialized component is executed.
  • the generator needs to support JSON Schema with text instead of text_format.

Proposed Changes:

  • Fix the to_dict method.
  • Update the docstrings to explain how users can pass a JSON Schema instead of a Pydantic model.
  • Update the docstrings to clarify that streaming and Pydantic models are not supported together.
  • Note: OpenAI’s implementation with structured outputs is very unclear/messy. we still do not support streaming with structured outputs. Updated the docstring accordingly.

How did you test it?

Notes for the reviewer

Checklist

  • I have read the contributors guidelines and the code of conduct
  • I have updated the related issue with new insights and changes
  • I added unit tests and updated the docstrings
  • I've used one of the conventional commit types for my PR title: fix:, feat:, build:, chore:, ci:, docs:, style:, refactor:, perf:, test: and added ! in case the PR includes breaking changes.
  • I documented my code
  • I ran pre-commit hooks and fixed any issue

@vercel
Copy link

vercel bot commented Nov 10, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
haystack-docs Ready Ready Preview Comment Nov 11, 2025 10:42am

@Amnah199 Amnah199 added this to the 2.20.0 milestone Nov 10, 2025
@sjrl
Copy link
Contributor

sjrl commented Nov 10, 2025

@Amnah199 please make sure to update and fix the to_dict method of AzureOpenAIResponsesChatGenerator as well

@github-actions github-actions bot added the type:documentation Improvements on the docs label Nov 10, 2025
@Amnah199 Amnah199 added the ignore-for-release-notes PRs with this flag won't be included in the release notes. label Nov 10, 2025
@Amnah199 Amnah199 marked this pull request as ready for review November 10, 2025 14:10
@Amnah199 Amnah199 requested a review from a team as a code owner November 10, 2025 14:10
@Amnah199 Amnah199 requested review from mpangrazzi and sjrl and removed request for a team November 10, 2025 14:10
@sjrl
Copy link
Contributor

sjrl commented Nov 11, 2025

@Amnah199 should we also add an integration test where we pass in a pydantic model, serialize the component, deserialize it and run the deserialized component to ensure it has the expected output? I'm asking since it feels a bit odd that at serialization time we convert a text_format passed option by the user into text.

@Amnah199
Copy link
Contributor Author

I tested this aspect locally but sure will add it to the tests.

Copy link
Contributor

@sjrl sjrl left a comment

Choose a reason for hiding this comment

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

Looks good!

@Amnah199 Amnah199 merged commit 564780b into main Nov 11, 2025
28 of 29 checks passed
@Amnah199 Amnah199 deleted the fix-ser-and-schema-support branch November 11, 2025 11:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ignore-for-release-notes PRs with this flag won't be included in the release notes. topic:tests type:documentation Improvements on the docs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants