fix: serialize timeout and max_retries in OpenAIImageGenerator.to_dict - #12518
Open
pcbeingused333 wants to merge 2 commits into
Open
Conversation
Both are stored on the instance and feed _client_kwargs(), but to_dict dropped them, so a saved pipeline reloaded with the OPENAI_TIMEOUT/OPENAI_MAX_RETRIES fallbacks (30s, 5) instead of the configured values. OpenAIChatGenerator, OpenAITextEmbedder and OpenAIDocumentEmbedder already serialize both — the embedders since deepset-ai#9421, which fixed this same defect for them. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PqBhR4HokMA14K9nLLQDTh
pcbeingused333
requested review from
julian-risch
and removed request for
a team
August 31, 2026 02:49
|
@pcbeingused333 is attempting to deploy a commit to the deepset Team on Vercel. A member of the Team first needs to authorize it. |
Contributor
Author
|
The red The release-note job was mine (single backticks in reST); fixed in
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Related Issues
OpenAITextEmbedderandOpenAIDocumentEmbedderin fix: Add missingtimeoutandmax_retriestoOpenAITextEmbedderandOpenAIDocumentEmbedder#9421;OpenAIImageGeneratorhas it too.Proposed Changes:
OpenAIImageGenerator.__init__acceptstimeoutandmax_retries, stores them, and_client_kwargs()uses them to build the OpenAI client — butto_dictdidn't include them, so they were dropped on serialization and reverted to theOPENAI_TIMEOUT/OPENAI_MAX_RETRIESfallbacks (30s, 5) on load:Silent: a pipeline saved and reloaded runs against different timeout and retry settings than the ones it was configured with, with nothing in the serialized dict to show it.
The two lines add both to
default_to_dict, which is whatOpenAIChatGenerator,OpenAITextEmbedderandOpenAIDocumentEmbedderalready do.response_formatstays out on purpose — it's documented as ignored and kept only for backward compatibility.How did you test it?
Unit tests, in
test/components/generators/test_openai_image_generator.py:test_to_dictandtest_to_dict_with_paramsupdated. Worth noting:test_to_dict_with_paramsalready passedtimeout=60, max_retries=10and then asserted a dict without them, which is what made this look unintentional rather than a deliberate omission.test_to_dict_from_dict_roundtrip_preserves_client_settingsadded: it asserts through_client_kwargs(), so it fails on the observable consequence (the client is built with the wrong settings) rather than only on the shape of the dict.All three fail without the two-line change, verified by reverting it. Full file: 23 passed, 2 skipped.
ruff checkandruff formatclean.Notes for the reviewer
I found this with a small AST script that compares every
@component's__init__parameters against the keys reachingdefault_to_dict, after seeing the same class of defect in #3808. This is the only instance it found in this repo that survived manual verification (DocumentSplitter'ssplitting_functionis a false positive — it's serialized separately withserialize_callable). It also flagged a few inhaystack-core-integrations; I'll raise those there.This PR was generated with an AI assistant. I have reviewed the changes and run the tests locally.
Checklist