cohere-haystack 11.0.0__tar.gz → 11.0.1__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.
- {cohere_haystack-11.0.0 → cohere_haystack-11.0.1}/CHANGELOG.md +13 -0
- {cohere_haystack-11.0.0 → cohere_haystack-11.0.1}/PKG-INFO +1 -1
- {cohere_haystack-11.0.0 → cohere_haystack-11.0.1}/src/haystack_integrations/components/generators/cohere/chat/chat_generator.py +6 -4
- {cohere_haystack-11.0.0 → cohere_haystack-11.0.1}/tests/test_chat_generator.py +59 -0
- {cohere_haystack-11.0.0 → cohere_haystack-11.0.1}/.gitignore +0 -0
- {cohere_haystack-11.0.0 → cohere_haystack-11.0.1}/LICENSE.txt +0 -0
- {cohere_haystack-11.0.0 → cohere_haystack-11.0.1}/README.md +0 -0
- {cohere_haystack-11.0.0 → cohere_haystack-11.0.1}/examples/cohere_embedding.py +0 -0
- {cohere_haystack-11.0.0 → cohere_haystack-11.0.1}/examples/cohere_generation.py +0 -0
- {cohere_haystack-11.0.0 → cohere_haystack-11.0.1}/examples/cohere_ranker.py +0 -0
- {cohere_haystack-11.0.0 → cohere_haystack-11.0.1}/pydoc/config_docusaurus.yml +0 -0
- {cohere_haystack-11.0.0 → cohere_haystack-11.0.1}/pyproject.toml +0 -0
- {cohere_haystack-11.0.0 → cohere_haystack-11.0.1}/src/haystack_integrations/components/embedders/cohere/__init__.py +0 -0
- {cohere_haystack-11.0.0 → cohere_haystack-11.0.1}/src/haystack_integrations/components/embedders/cohere/document_embedder.py +0 -0
- {cohere_haystack-11.0.0 → cohere_haystack-11.0.1}/src/haystack_integrations/components/embedders/cohere/document_image_embedder.py +0 -0
- {cohere_haystack-11.0.0 → cohere_haystack-11.0.1}/src/haystack_integrations/components/embedders/cohere/embedding_types.py +0 -0
- {cohere_haystack-11.0.0 → cohere_haystack-11.0.1}/src/haystack_integrations/components/embedders/cohere/text_embedder.py +0 -0
- {cohere_haystack-11.0.0 → cohere_haystack-11.0.1}/src/haystack_integrations/components/embedders/cohere/utils.py +0 -0
- {cohere_haystack-11.0.0 → cohere_haystack-11.0.1}/src/haystack_integrations/components/embedders/py.typed +0 -0
- {cohere_haystack-11.0.0 → cohere_haystack-11.0.1}/src/haystack_integrations/components/generators/cohere/__init__.py +0 -0
- {cohere_haystack-11.0.0 → cohere_haystack-11.0.1}/src/haystack_integrations/components/generators/cohere/chat/__init__.py +0 -0
- {cohere_haystack-11.0.0 → cohere_haystack-11.0.1}/src/haystack_integrations/components/generators/py.typed +0 -0
- {cohere_haystack-11.0.0 → cohere_haystack-11.0.1}/src/haystack_integrations/components/rankers/cohere/__init__.py +0 -0
- {cohere_haystack-11.0.0 → cohere_haystack-11.0.1}/src/haystack_integrations/components/rankers/cohere/ranker.py +0 -0
- {cohere_haystack-11.0.0 → cohere_haystack-11.0.1}/src/haystack_integrations/components/rankers/py.typed +0 -0
- {cohere_haystack-11.0.0 → cohere_haystack-11.0.1}/src/haystack_integrations/utils/cohere/__init__.py +0 -0
- {cohere_haystack-11.0.0 → cohere_haystack-11.0.1}/src/haystack_integrations/utils/cohere/api_base_url.py +0 -0
- {cohere_haystack-11.0.0 → cohere_haystack-11.0.1}/src/haystack_integrations/utils/py.typed +0 -0
- {cohere_haystack-11.0.0 → cohere_haystack-11.0.1}/tests/__init__.py +0 -0
- {cohere_haystack-11.0.0 → cohere_haystack-11.0.1}/tests/conftest.py +0 -0
- {cohere_haystack-11.0.0 → cohere_haystack-11.0.1}/tests/test_api_base_url.py +0 -0
- {cohere_haystack-11.0.0 → cohere_haystack-11.0.1}/tests/test_chat_generator_async.py +0 -0
- {cohere_haystack-11.0.0 → cohere_haystack-11.0.1}/tests/test_chat_generator_chunks.py +0 -0
- {cohere_haystack-11.0.0 → cohere_haystack-11.0.1}/tests/test_document_embedder.py +0 -0
- {cohere_haystack-11.0.0 → cohere_haystack-11.0.1}/tests/test_document_image_embedder.py +0 -0
- {cohere_haystack-11.0.0 → cohere_haystack-11.0.1}/tests/test_files/apple.jpg +0 -0
- {cohere_haystack-11.0.0 → cohere_haystack-11.0.1}/tests/test_files/sample_pdf_1.pdf +0 -0
- {cohere_haystack-11.0.0 → cohere_haystack-11.0.1}/tests/test_ranker.py +0 -0
- {cohere_haystack-11.0.0 → cohere_haystack-11.0.1}/tests/test_text_embedder.py +0 -0
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [integrations/cohere-v11.0.0] - 2026-10-16
|
|
4
|
+
|
|
5
|
+
### 🧪 Testing
|
|
6
|
+
|
|
7
|
+
- Test compatible integrations with Python 3.15; update pyproject (#4104)
|
|
8
|
+
|
|
9
|
+
### 🧹 Chores
|
|
10
|
+
|
|
11
|
+
- Drop redundant deserialize_secrets_inplace calls in integrations requiring haystack-ai>=2.23 (#4058)
|
|
12
|
+
- Replace ToolInvoker with Agent in tests, examples and docstrings (#4108)
|
|
13
|
+
- [**breaking**] Drop Python 3.10 support (#4105)
|
|
14
|
+
|
|
15
|
+
|
|
3
16
|
## [integrations/cohere-v10.1.0] - 2026-09-28
|
|
4
17
|
|
|
5
18
|
### 🚀 Features
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: cohere-haystack
|
|
3
|
-
Version: 11.0.
|
|
3
|
+
Version: 11.0.1
|
|
4
4
|
Project-URL: Documentation, https://github.com/deepset-ai/haystack-core-integrations/tree/main/integrations/cohere#readme
|
|
5
5
|
Project-URL: Issues, https://github.com/deepset-ai/haystack-core-integrations/issues
|
|
6
6
|
Project-URL: Source, https://github.com/deepset-ai/haystack-core-integrations/tree/main/integrations/cohere
|
|
@@ -664,7 +664,8 @@ class CohereChatGenerator:
|
|
|
664
664
|
For more details on the parameters supported by the Cohere API, refer to the
|
|
665
665
|
Cohere [documentation](https://docs.cohere.com/reference/chat).
|
|
666
666
|
:param tools: A list of Tool and/or Toolset objects, or a single Toolset for which the model can prepare calls.
|
|
667
|
-
If set, it will override the `tools` parameter set during component initialization.
|
|
667
|
+
If set, it will override the `tools` parameter set during component initialization. Pass an empty
|
|
668
|
+
list to disable tools for this call.
|
|
668
669
|
:param streaming_callback: A callback function that is called when a new token is received from the stream.
|
|
669
670
|
The callback function accepts StreamingChunk as an argument.
|
|
670
671
|
|
|
@@ -679,7 +680,7 @@ class CohereChatGenerator:
|
|
|
679
680
|
generation_kwargs = {**self.generation_kwargs, **(generation_kwargs or {})}
|
|
680
681
|
|
|
681
682
|
# Handle tools
|
|
682
|
-
tools = tools
|
|
683
|
+
tools = tools if tools is not None else self.tools
|
|
683
684
|
flattened_tools = flatten_tools_or_toolsets(tools)
|
|
684
685
|
if flattened_tools:
|
|
685
686
|
_check_duplicate_tool_names(flattened_tools)
|
|
@@ -735,7 +736,8 @@ class CohereChatGenerator:
|
|
|
735
736
|
For more details on the parameters supported by the Cohere API, refer to the
|
|
736
737
|
Cohere [documentation](https://docs.cohere.com/reference/chat).
|
|
737
738
|
:param tools: A list of Tool and/or Toolset objects, or a single Toolset for which the model can prepare calls.
|
|
738
|
-
If set, it will override the `tools` parameter set during component initialization.
|
|
739
|
+
If set, it will override the `tools` parameter set during component initialization. Pass an empty
|
|
740
|
+
list to disable tools for this call.
|
|
739
741
|
:param streaming_callback: A callback function that is called when a new token is received from the stream.
|
|
740
742
|
:returns: A dictionary with the following keys:
|
|
741
743
|
- `replies`: a list of `ChatMessage` instances representing the generated responses.
|
|
@@ -748,7 +750,7 @@ class CohereChatGenerator:
|
|
|
748
750
|
generation_kwargs = {**self.generation_kwargs, **(generation_kwargs or {})}
|
|
749
751
|
|
|
750
752
|
# Handle tools
|
|
751
|
-
tools = tools
|
|
753
|
+
tools = tools if tools is not None else self.tools
|
|
752
754
|
flattened_tools = flatten_tools_or_toolsets(tools)
|
|
753
755
|
if flattened_tools:
|
|
754
756
|
_check_duplicate_tool_names(flattened_tools)
|
|
@@ -615,6 +615,65 @@ class TestRun:
|
|
|
615
615
|
assert kwargs["max_tokens"] == 100
|
|
616
616
|
assert kwargs["temperature"] == 0.9
|
|
617
617
|
|
|
618
|
+
@patch("haystack_integrations.components.generators.cohere.chat.chat_generator.ClientV2")
|
|
619
|
+
def test_run_with_empty_tools_override(self, mock_client_cls):
|
|
620
|
+
weather_tool = Tool(
|
|
621
|
+
name="weather",
|
|
622
|
+
description="Get the weather in a city",
|
|
623
|
+
parameters={"type": "object", "properties": {"city": {"type": "string"}}, "required": ["city"]},
|
|
624
|
+
function=weather,
|
|
625
|
+
)
|
|
626
|
+
generator = CohereChatGenerator(api_key=Secret.from_token("test-api-key"), tools=[weather_tool])
|
|
627
|
+
|
|
628
|
+
mock_response = MagicMock()
|
|
629
|
+
mock_response.message.content = [MagicMock()]
|
|
630
|
+
mock_response.message.content[0].text = "Paris"
|
|
631
|
+
mock_response.message.content[0].type = "text"
|
|
632
|
+
mock_response.message.tool_calls = None
|
|
633
|
+
mock_response.finish_reason = "COMPLETE"
|
|
634
|
+
mock_response.usage = None
|
|
635
|
+
|
|
636
|
+
client = mock_client_cls.return_value
|
|
637
|
+
client.chat.return_value = mock_response
|
|
638
|
+
|
|
639
|
+
generator.run([ChatMessage.from_user("Hello")])
|
|
640
|
+
_, kwargs = client.chat.call_args
|
|
641
|
+
assert len(kwargs["tools"]) == 1
|
|
642
|
+
|
|
643
|
+
generator.run([ChatMessage.from_user("Hello")], tools=[])
|
|
644
|
+
_, kwargs = client.chat.call_args
|
|
645
|
+
assert "tools" not in kwargs
|
|
646
|
+
|
|
647
|
+
@pytest.mark.asyncio
|
|
648
|
+
@patch("haystack_integrations.components.generators.cohere.chat.chat_generator.AsyncClientV2")
|
|
649
|
+
async def test_run_async_with_empty_tools_override(self, mock_client_cls):
|
|
650
|
+
weather_tool = Tool(
|
|
651
|
+
name="weather",
|
|
652
|
+
description="Get the weather in a city",
|
|
653
|
+
parameters={"type": "object", "properties": {"city": {"type": "string"}}, "required": ["city"]},
|
|
654
|
+
function=weather,
|
|
655
|
+
)
|
|
656
|
+
generator = CohereChatGenerator(api_key=Secret.from_token("test-api-key"), tools=[weather_tool])
|
|
657
|
+
|
|
658
|
+
mock_response = MagicMock()
|
|
659
|
+
mock_response.message.content = [MagicMock()]
|
|
660
|
+
mock_response.message.content[0].text = "Paris"
|
|
661
|
+
mock_response.message.content[0].type = "text"
|
|
662
|
+
mock_response.message.tool_calls = None
|
|
663
|
+
mock_response.finish_reason = "COMPLETE"
|
|
664
|
+
mock_response.usage = None
|
|
665
|
+
|
|
666
|
+
client = mock_client_cls.return_value
|
|
667
|
+
client.chat = AsyncMock(return_value=mock_response)
|
|
668
|
+
|
|
669
|
+
await generator.run_async([ChatMessage.from_user("Hello")])
|
|
670
|
+
_, kwargs = client.chat.call_args
|
|
671
|
+
assert len(kwargs["tools"]) == 1
|
|
672
|
+
|
|
673
|
+
await generator.run_async([ChatMessage.from_user("Hello")], tools=[])
|
|
674
|
+
_, kwargs = client.chat.call_args
|
|
675
|
+
assert "tools" not in kwargs
|
|
676
|
+
|
|
618
677
|
|
|
619
678
|
@pytest.mark.skipif(
|
|
620
679
|
not os.environ.get("COHERE_API_KEY", None) and not os.environ.get("CO_API_KEY", None),
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{cohere_haystack-11.0.0 → cohere_haystack-11.0.1}/src/haystack_integrations/utils/cohere/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|