Skip to content

feat(google_genai): add timeout and max_retries to embedder components - #3412

Merged
julian-risch merged 6 commits into
deepset-ai:mainfrom
GovindhKishore:feat/google-genai-embedder-timeouts
Jun 8, 2026
Merged

julian-risch merged 6 commits into
deepset-ai:mainfrom
GovindhKishore:feat/google-genai-embedder-timeouts

Conversation

@GovindhKishore

Copy link
Copy Markdown
Contributor

Related Issues

Proposed Changes:

  • Added timeout: float | None = None and max_retries: int | None = None to the constructors of all three classes.
  • Forwarded these arguments cleanly to the internal _get_client helper utility to natively apply network threshold and backoff configurations to the underlying Google GenAI client layer.
  • Extended the to_dict and from_dict serialization logic to guarantee settings persist cleanly inside declarative Haystack pipeline blueprints.

How did you test it?

Verified the adjustments locally across all testing matrices by expanding the existing test suites.

  • Unit Tests: Updated test_text_embedder.py, test_document_embedder.py, and test_multimodal_document_embedder.py to assert correct parameter initialization, default fallbacks, and serialization round-trips (to_dict / from_dict).
  • Execution: Executed hatch run test:unit confirming a 100% clean green pass.
  • Formatting: Code style and syntax layouts have been strictly checked and standardized using hatch run ruff format.

Notes for the reviewer

The serialization modifications for the Text and Document embedders use direct parameter mappings, while the Multimodal embedder relies on the dynamic fallback check behavior of component_to_dict and component_from_dict. All defaults are set to None ensuring zero disruption or backward-compatibility breakages for existing users.

Checklist

@GovindhKishore
GovindhKishore requested a review from a team as a code owner June 6, 2026 11:45
@GovindhKishore
GovindhKishore requested review from julian-risch and removed request for a team June 6, 2026 11:45
@CLAassistant

CLAassistant commented Jun 6, 2026 •

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@github-actions

github-actions Bot commented Jun 6, 2026

Copy link
Copy Markdown
Contributor

Heads-up for maintainers

This PR is from a fork and touches integrations whose integration tests require API keys.
Those tests are skipped in CI because fork PRs don't have access to repo secrets for security reasons.

Affected integrations:

  • google_genai

Please run the integration tests locally (hatch run test:integration inside each folder) before approving.

@github-actions github-actions Bot added the type:documentation Improvements or additions to documentation label Jun 6, 2026
@github-actions

github-actions Bot commented Jun 6, 2026 •

Copy link
Copy Markdown
Contributor

Coverage report (google_genai)

Click to see where and how coverage changed

FileStatementsMissingCoverageCoverage
(new stmts)
Lines missing
  integrations/google_genai/src/haystack_integrations/components/embedders/google_genai
  document_embedder.py
  multimodal_document_embedder.py
  text_embedder.py
Project Total  

This report was generated by python-coverage-comment-action

@julian-risch julian-risch left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks for opening this PR @GovindhKishore
I found an issue with GoogleGenAIMultimodalDocumentEmbedder serialization. A user who sets timeout=30, saves a pipeline to YAML, and reloads it gets timeout=None back.

Could you please give GoogleGenAIMultimodalDocumentEmbedder explicit to_dict/from_dict similar to what the Document embedder does. That will also fix a pre-existing issue with the serialization of model/batch_size/config.
You'll need to handle root_path explicitly too because it iss stored as self._root_path = root_path or "".
Please add tests covering the serialization of GoogleGenAIMultimodalDocumentEmbedder
for example add a test_to_dict_with_custom_init_parameters to check that non-default timeout/max_retries/model/batch_size survive to_dict. You could even add a full to_dict -> from_dict round trip as a test.

@GovindhKishore
GovindhKishore force-pushed the feat/google-genai-embedder-timeouts branch from 5b1cd80 to 075a9d2 Compare June 8, 2026 12:50
@GovindhKishore

Copy link
Copy Markdown
Contributor Author

Hi @julian-risch,
I've updated the PR and added those two extra serialization tests to the test file. Everything is running perfectly clean locally. Take your time looking it over, and let me know if anything else is needed!

@julian-risch julian-risch left a comment •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Looks good to me now! @GovindhKishore Thank you for addressing the change requests so quickly. I ran the integration tests locally and confirm they pass for me too. Congratulations on your first contribution to Haystack! 🎉

@julian-risch
julian-risch merged commit 0d8dbf1 into deepset-ai:main Jun 8, 2026
16 checks passed
@GovindhKishore

Copy link
Copy Markdown
Contributor Author

Thanks a lot @julian-risch for the review and the merge! Glad to make my first contribution here. Looking forward to tackling more issues in the ecosystem.

@GovindhKishore
GovindhKishore deleted the feat/google-genai-embedder-timeouts branch June 8, 2026 17:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

integration:google-genai type:documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(google_genai): Add timeout and max_retries configuration to Embedder components

3 participants