Repository navigation
feat(google_genai): add timeout and max_retries to embedder components - #3412
julian-risch merged 6 commits into
Conversation
|
Heads-up for maintainers This PR is from a fork and touches integrations whose integration tests require API keys. Affected integrations:
Please run the integration tests locally ( |
Coverage report (google_genai)Click to see where and how coverage changed
This report was generated by python-coverage-comment-action |
||||||||||||||||||||||||||||||||||||
julian-risch
left a comment
There was a problem hiding this comment.
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.
5b1cd80 to
075a9d2
Compare
|
Hi @julian-risch, |
There was a problem hiding this comment.
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! 🎉
|
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. |
Related Issues
Proposed Changes:
timeout: float | None = Noneandmax_retries: int | None = Noneto the constructors of all three classes._get_clienthelper utility to natively apply network threshold and backoff configurations to the underlying Google GenAI client layer.to_dictandfrom_dictserialization 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.
test_text_embedder.py,test_document_embedder.py, andtest_multimodal_document_embedder.pyto assert correct parameter initialization, default fallbacks, and serialization round-trips (to_dict/from_dict).hatch run test:unitconfirming a 100% clean green pass.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
fix:,feat:,build:,chore:,ci:,docs:,style:,refactor:,perf:,test:.