google-genai-haystack 7.2.1__tar.gz → 7.2.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. {google_genai_haystack-7.2.1 → google_genai_haystack-7.2.2}/CHANGELOG.md +7 -0
  2. {google_genai_haystack-7.2.1 → google_genai_haystack-7.2.2}/PKG-INFO +1 -1
  3. {google_genai_haystack-7.2.1 → google_genai_haystack-7.2.2}/src/haystack_integrations/components/generators/google_genai/chat/chat_generator.py +10 -8
  4. {google_genai_haystack-7.2.1 → google_genai_haystack-7.2.2}/tests/test_chat_generator.py +59 -11
  5. {google_genai_haystack-7.2.1 → google_genai_haystack-7.2.2}/.gitignore +0 -0
  6. {google_genai_haystack-7.2.1 → google_genai_haystack-7.2.2}/LICENSE.txt +0 -0
  7. {google_genai_haystack-7.2.1 → google_genai_haystack-7.2.2}/README.md +0 -0
  8. {google_genai_haystack-7.2.1 → google_genai_haystack-7.2.2}/examples/chatgenerator_example.py +0 -0
  9. {google_genai_haystack-7.2.1 → google_genai_haystack-7.2.2}/pydoc/config_docusaurus.yml +0 -0
  10. {google_genai_haystack-7.2.1 → google_genai_haystack-7.2.2}/pyproject.toml +0 -0
  11. {google_genai_haystack-7.2.1 → google_genai_haystack-7.2.2}/src/haystack_integrations/common/google_genai/__init__.py +0 -0
  12. {google_genai_haystack-7.2.1 → google_genai_haystack-7.2.2}/src/haystack_integrations/common/google_genai/utils.py +0 -0
  13. {google_genai_haystack-7.2.1 → google_genai_haystack-7.2.2}/src/haystack_integrations/common/py.typed +0 -0
  14. {google_genai_haystack-7.2.1 → google_genai_haystack-7.2.2}/src/haystack_integrations/components/embedders/google_genai/__init__.py +0 -0
  15. {google_genai_haystack-7.2.1 → google_genai_haystack-7.2.2}/src/haystack_integrations/components/embedders/google_genai/document_embedder.py +0 -0
  16. {google_genai_haystack-7.2.1 → google_genai_haystack-7.2.2}/src/haystack_integrations/components/embedders/google_genai/multimodal_document_embedder.py +0 -0
  17. {google_genai_haystack-7.2.1 → google_genai_haystack-7.2.2}/src/haystack_integrations/components/embedders/google_genai/text_embedder.py +0 -0
  18. {google_genai_haystack-7.2.1 → google_genai_haystack-7.2.2}/src/haystack_integrations/components/embedders/py.typed +0 -0
  19. {google_genai_haystack-7.2.1 → google_genai_haystack-7.2.2}/src/haystack_integrations/components/generators/google_genai/__init__.py +0 -0
  20. {google_genai_haystack-7.2.1 → google_genai_haystack-7.2.2}/src/haystack_integrations/components/generators/google_genai/chat/interactions_chat_generator.py +0 -0
  21. {google_genai_haystack-7.2.1 → google_genai_haystack-7.2.2}/src/haystack_integrations/components/generators/google_genai/chat/interactions_utils.py +0 -0
  22. {google_genai_haystack-7.2.1 → google_genai_haystack-7.2.2}/src/haystack_integrations/components/generators/google_genai/chat/utils.py +0 -0
  23. {google_genai_haystack-7.2.1 → google_genai_haystack-7.2.2}/src/haystack_integrations/components/generators/py.typed +0 -0
  24. {google_genai_haystack-7.2.1 → google_genai_haystack-7.2.2}/src/haystack_integrations/token_counters/google_genai/__init__.py +0 -0
  25. {google_genai_haystack-7.2.1 → google_genai_haystack-7.2.2}/src/haystack_integrations/token_counters/google_genai/token_counter.py +0 -0
  26. {google_genai_haystack-7.2.1 → google_genai_haystack-7.2.2}/src/haystack_integrations/token_counters/py.typed +0 -0
  27. {google_genai_haystack-7.2.1 → google_genai_haystack-7.2.2}/tests/conftest.py +0 -0
  28. {google_genai_haystack-7.2.1 → google_genai_haystack-7.2.2}/tests/test_chat_generator_utils.py +0 -0
  29. {google_genai_haystack-7.2.1 → google_genai_haystack-7.2.2}/tests/test_document_embedder.py +0 -0
  30. {google_genai_haystack-7.2.1 → google_genai_haystack-7.2.2}/tests/test_files/apple.jpg +0 -0
  31. {google_genai_haystack-7.2.1 → google_genai_haystack-7.2.2}/tests/test_files/banana.png +0 -0
  32. {google_genai_haystack-7.2.1 → google_genai_haystack-7.2.2}/tests/test_files/sample_docx.docx +0 -0
  33. {google_genai_haystack-7.2.1 → google_genai_haystack-7.2.2}/tests/test_files/sample_pdf_3.pdf +0 -0
  34. {google_genai_haystack-7.2.1 → google_genai_haystack-7.2.2}/tests/test_interactions_chat_generator.py +0 -0
  35. {google_genai_haystack-7.2.1 → google_genai_haystack-7.2.2}/tests/test_interactions_chat_generator_utils.py +0 -0
  36. {google_genai_haystack-7.2.1 → google_genai_haystack-7.2.2}/tests/test_multimodal_document_embedder.py +0 -0
  37. {google_genai_haystack-7.2.1 → google_genai_haystack-7.2.2}/tests/test_text_embedder.py +0 -0
  38. {google_genai_haystack-7.2.1 → google_genai_haystack-7.2.2}/tests/test_token_counter.py +0 -0
  39. {google_genai_haystack-7.2.1 → google_genai_haystack-7.2.2}/tests/test_utils.py +0 -0
@@ -1,5 +1,12 @@
1
1
  # Changelog
2
2
 
3
+ ## [integrations/google_genai-v7.2.1] - 2026-11-06
4
+
5
+ ### 🐛 Bug Fixes
6
+
7
+ - Keep parallel Gemini tool calls when replaying thought signatures (#4167)
8
+
9
+
3
10
  ## [integrations/google_genai-v7.2.0] - 2026-11-06
4
11
 
5
12
  ### 🚀 Features
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: google-genai-haystack
3
- Version: 7.2.1
3
+ Version: 7.2.2
4
4
  Summary: Use models like Gemini via Google Gen AI SDK
5
5
  Project-URL: Documentation, https://github.com/deepset-ai/haystack-core-integrations/tree/main/integrations/google_genai#readme
6
6
  Project-URL: Issues, https://github.com/deepset-ai/haystack-core-integrations/issues
@@ -458,11 +458,12 @@ class GoogleGenAIChatGenerator:
458
458
  keys set only at initialization are kept. Supports `thinking_budget` for Gemini 2.5 series
459
459
  thinking configuration.
460
460
  :param safety_settings: Safety settings for content filtering. If provided, it will override the
461
- default settings.
461
+ default settings. Pass an empty list to send no safety settings for this call.
462
462
  :param streaming_callback: A callback function that is called when a new token is
463
463
  received from the stream.
464
464
  :param tools: A list of Tool and/or Toolset objects, or a single Toolset for which the model can prepare calls.
465
- If provided, it will override the tools set during initialization.
465
+ If provided, it will override the tools set during initialization. Pass an empty list to disable tools for
466
+ this call.
466
467
  :returns: A dictionary with the following keys:
467
468
  - `replies`: A list containing the generated ChatMessage responses.
468
469
 
@@ -476,8 +477,8 @@ class GoogleGenAIChatGenerator:
476
477
  messages = _normalize_messages(messages)
477
478
  # Merge generation_kwargs with instance defaults; other configs fall back to instance defaults
478
479
  generation_kwargs = {**self._generation_kwargs, **(generation_kwargs or {})}
479
- safety_settings = safety_settings or self._safety_settings
480
- tools = tools or self._tools
480
+ safety_settings = safety_settings if safety_settings is not None else self._safety_settings
481
+ tools = tools if tools is not None else self._tools
481
482
 
482
483
  # Process thinking configuration and response format
483
484
  generation_kwargs = _process_thinking_config(generation_kwargs)
@@ -576,11 +577,12 @@ class GoogleGenAIChatGenerator:
576
577
  thinking configuration.
577
578
  See https://ai.google.dev/gemini-api/docs/thinking for possible values.
578
579
  :param safety_settings: Safety settings for content filtering. If provided, it will override the
579
- default settings.
580
+ default settings. Pass an empty list to send no safety settings for this call.
580
581
  :param streaming_callback: A callback function that is called when a new token is
581
582
  received from the stream.
582
583
  :param tools: A list of Tool and/or Toolset objects, or a single Toolset for which the model can prepare calls.
583
- If provided, it will override the tools set during initialization.
584
+ If provided, it will override the tools set during initialization. Pass an empty list to disable tools for
585
+ this call.
584
586
  :returns: A dictionary with the following keys:
585
587
  - `replies`: A list containing the generated ChatMessage responses.
586
588
 
@@ -594,8 +596,8 @@ class GoogleGenAIChatGenerator:
594
596
  messages = _normalize_messages(messages)
595
597
  # Merge generation_kwargs with instance defaults; other configs fall back to instance defaults
596
598
  generation_kwargs = {**self._generation_kwargs, **(generation_kwargs or {})}
597
- safety_settings = safety_settings or self._safety_settings
598
- tools = tools or self._tools
599
+ safety_settings = safety_settings if safety_settings is not None else self._safety_settings
600
+ tools = tools if tools is not None else self._tools
599
601
 
600
602
  # Process thinking configuration and response format
601
603
  generation_kwargs = _process_thinking_config(generation_kwargs)
@@ -459,7 +459,7 @@ class TestGoogleGenAIChatGeneratorRun:
459
459
  assert results["replies"][0].tool_calls[0].tool_name == "weather"
460
460
 
461
461
  def test_run_streaming_parallel_tool_calls_in_separate_chunks(self):
462
- component = GoogleGenAIChatGenerator(model="gemini-3-flash-preview")
462
+ component = GoogleGenAIChatGenerator(model="gemini-3.8-flash")
463
463
  component._client = MagicMock()
464
464
  component._client.models.generate_content_stream = Mock(return_value=iter(_parallel_call_stream_chunks()))
465
465
 
@@ -505,6 +505,19 @@ class TestGoogleGenAIChatGeneratorRun:
505
505
  config = call_kwargs.kwargs.get("config") or call_kwargs[1].get("config")
506
506
  assert config.tools is not None
507
507
 
508
+ def test_run_with_empty_tools_override(self, mock_response, tools):
509
+ # an empty runtime list must disable the init tools for this call, not fall back to them;
510
+ # generation_kwargs keeps a config object in the request so its tools can be inspected
511
+ component = GoogleGenAIChatGenerator(tools=tools, generation_kwargs={"temperature": 0.5})
512
+ component._client = MagicMock()
513
+ component._client.models.generate_content = Mock(return_value=mock_response)
514
+
515
+ component.run([ChatMessage.from_user("Weather in Paris?")])
516
+ assert component._client.models.generate_content.call_args.kwargs["config"].tools is not None
517
+
518
+ component.run([ChatMessage.from_user("Weather in Paris?")], tools=[])
519
+ assert component._client.models.generate_content.call_args.kwargs["config"].tools is None
520
+
508
521
  def test_run_with_safety_settings(self, mock_response):
509
522
  safety = [{"category": "HARM_CATEGORY_HARASSMENT", "threshold": "BLOCK_MEDIUM_AND_ABOVE"}]
510
523
  component = GoogleGenAIChatGenerator()
@@ -628,6 +641,45 @@ class TestGoogleGenAIChatGeneratorRun:
628
641
  assert config.temperature == 0.9
629
642
  assert config.max_output_tokens == 100
630
643
 
644
+ @pytest.mark.asyncio
645
+ async def test_run_async_with_empty_tools_override(self, mock_response, tools):
646
+ component = GoogleGenAIChatGenerator(tools=tools, generation_kwargs={"temperature": 0.5})
647
+ component._async_client = MagicMock()
648
+ component._async_client.models.generate_content = AsyncMock(return_value=mock_response)
649
+
650
+ await component.run_async([ChatMessage.from_user("Weather in Paris?")])
651
+ assert component._async_client.models.generate_content.call_args.kwargs["config"].tools is not None
652
+
653
+ await component.run_async([ChatMessage.from_user("Weather in Paris?")], tools=[])
654
+ assert component._async_client.models.generate_content.call_args.kwargs["config"].tools is None
655
+
656
+ def test_run_with_empty_safety_settings_override(self, mock_response):
657
+ # an empty runtime list must send no safety settings for this call, not fall back to the init ones;
658
+ # generation_kwargs keeps a config object in the request so its safety settings can be inspected
659
+ safety_settings = [{"category": "HARM_CATEGORY_HATE_SPEECH", "threshold": "BLOCK_LOW_AND_ABOVE"}]
660
+ component = GoogleGenAIChatGenerator(safety_settings=safety_settings, generation_kwargs={"temperature": 0.5})
661
+ component._client = MagicMock()
662
+ component._client.models.generate_content = Mock(return_value=mock_response)
663
+
664
+ component.run([ChatMessage.from_user("Hello")])
665
+ assert component._client.models.generate_content.call_args.kwargs["config"].safety_settings is not None
666
+
667
+ component.run([ChatMessage.from_user("Hello")], safety_settings=[])
668
+ assert component._client.models.generate_content.call_args.kwargs["config"].safety_settings is None
669
+
670
+ @pytest.mark.asyncio
671
+ async def test_run_async_with_empty_safety_settings_override(self, mock_response):
672
+ safety_settings = [{"category": "HARM_CATEGORY_HATE_SPEECH", "threshold": "BLOCK_LOW_AND_ABOVE"}]
673
+ component = GoogleGenAIChatGenerator(safety_settings=safety_settings, generation_kwargs={"temperature": 0.5})
674
+ component._async_client = MagicMock()
675
+ component._async_client.models.generate_content = AsyncMock(return_value=mock_response)
676
+
677
+ await component.run_async([ChatMessage.from_user("Hello")])
678
+ assert component._async_client.models.generate_content.call_args.kwargs["config"].safety_settings is not None
679
+
680
+ await component.run_async([ChatMessage.from_user("Hello")], safety_settings=[])
681
+ assert component._async_client.models.generate_content.call_args.kwargs["config"].safety_settings is None
682
+
631
683
  @pytest.mark.asyncio
632
684
  async def test_run_async_streaming(self, mock_streaming_chunk):
633
685
  component = GoogleGenAIChatGenerator()
@@ -680,7 +732,7 @@ class TestGoogleGenAIChatGeneratorRun:
680
732
 
681
733
  @pytest.mark.asyncio
682
734
  async def test_run_async_streaming_parallel_tool_calls_in_separate_chunks(self):
683
- component = GoogleGenAIChatGenerator(model="gemini-3-flash-preview")
735
+ component = GoogleGenAIChatGenerator(model="gemini-3.8-flash")
684
736
  component._async_client = MagicMock()
685
737
 
686
738
  async def mock_stream():
@@ -928,7 +980,7 @@ class TestGoogleGenAIChatGeneratorInference:
928
980
  "What's the weather like in Paris and Berlin? Produce a separate tool call for each city."
929
981
  )
930
982
  ]
931
- component = GoogleGenAIChatGenerator(model="gemini-3-flash-preview", tools=tools)
983
+ component = GoogleGenAIChatGenerator(model="gemini-3.8-flash", tools=tools)
932
984
  results = component.run(messages=initial_messages)
933
985
 
934
986
  assert len(results["replies"]) == 1
@@ -972,9 +1024,7 @@ class TestGoogleGenAIChatGeneratorInference:
972
1024
  """
973
1025
  # We use a model that supports the thinking feature
974
1026
  chat_messages = [ChatMessage.from_user("Why is the sky blue? Explain in one sentence.")]
975
- component = GoogleGenAIChatGenerator(
976
- model="gemini-3-flash-preview", generation_kwargs={"thinking_level": "low"}
977
- )
1027
+ component = GoogleGenAIChatGenerator(model="gemini-3.8-flash", generation_kwargs={"thinking_level": "medium"})
978
1028
  results = component.run(chat_messages)
979
1029
 
980
1030
  assert len(results["replies"]) == 1
@@ -999,7 +1049,7 @@ class TestGoogleGenAIChatGeneratorInference:
999
1049
  """
1000
1050
  # Use a model that supports thinking with tools
1001
1051
  component = GoogleGenAIChatGenerator(
1002
- model="gemini-3-flash-preview",
1052
+ model="gemini-3.8-flash",
1003
1053
  tools=tools,
1004
1054
  generation_kwargs={"thinking_level": "low"}, # Dynamic allocation
1005
1055
  )
@@ -1105,7 +1155,7 @@ class TestGoogleGenAIChatGeneratorInference:
1105
1155
  )
1106
1156
 
1107
1157
  agent = Agent(
1108
- chat_generator=GoogleGenAIChatGenerator(model="gemini-3-flash-preview"),
1158
+ chat_generator=GoogleGenAIChatGenerator(model="gemini-3.8-flash"),
1109
1159
  system_prompt="You are an Agent that can retrieve and analyze images and documents.",
1110
1160
  tools=[multimodal_retriever_tool],
1111
1161
  )
@@ -1188,9 +1238,7 @@ class TestAsyncGoogleGenAIChatGeneratorInference:
1188
1238
  Async integration test for the thinking feature.
1189
1239
  """
1190
1240
  chat_messages = [ChatMessage.from_user("Why is the sky blue? Explain in one sentence.")]
1191
- component = GoogleGenAIChatGenerator(
1192
- model="gemini-3-flash-preview", generation_kwargs={"thinking_level": "low"}
1193
- )
1241
+ component = GoogleGenAIChatGenerator(model="gemini-3.8-flash", generation_kwargs={"thinking_level": "medium"})
1194
1242
  results = await component.run_async(chat_messages)
1195
1243
 
1196
1244
  assert len(results["replies"]) == 1