cohere-haystack 2.0.1__tar.gz → 2.0.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.
- {cohere_haystack-2.0.1 → cohere_haystack-2.0.2}/CHANGELOG.md +80 -16
- {cohere_haystack-2.0.1 → cohere_haystack-2.0.2}/PKG-INFO +4 -3
- {cohere_haystack-2.0.1 → cohere_haystack-2.0.2}/src/haystack_integrations/components/generators/cohere/chat/chat_generator.py +2 -2
- {cohere_haystack-2.0.1 → cohere_haystack-2.0.2}/tests/test_cohere_chat_generator.py +5 -25
- {cohere_haystack-2.0.1 → cohere_haystack-2.0.2}/tests/test_cohere_generator.py +0 -21
- {cohere_haystack-2.0.1 → cohere_haystack-2.0.2}/.gitignore +0 -0
- {cohere_haystack-2.0.1 → cohere_haystack-2.0.2}/LICENSE.txt +0 -0
- {cohere_haystack-2.0.1 → cohere_haystack-2.0.2}/README.md +0 -0
- {cohere_haystack-2.0.1 → cohere_haystack-2.0.2}/examples/cohere_embedding.py +0 -0
- {cohere_haystack-2.0.1 → cohere_haystack-2.0.2}/examples/cohere_generation.py +0 -0
- {cohere_haystack-2.0.1 → cohere_haystack-2.0.2}/examples/cohere_ranker.py +0 -0
- {cohere_haystack-2.0.1 → cohere_haystack-2.0.2}/pydoc/config.yml +0 -0
- {cohere_haystack-2.0.1 → cohere_haystack-2.0.2}/pyproject.toml +0 -0
- {cohere_haystack-2.0.1 → cohere_haystack-2.0.2}/src/haystack_integrations/components/embedders/cohere/__init__.py +0 -0
- {cohere_haystack-2.0.1 → cohere_haystack-2.0.2}/src/haystack_integrations/components/embedders/cohere/document_embedder.py +0 -0
- {cohere_haystack-2.0.1 → cohere_haystack-2.0.2}/src/haystack_integrations/components/embedders/cohere/text_embedder.py +0 -0
- {cohere_haystack-2.0.1 → cohere_haystack-2.0.2}/src/haystack_integrations/components/embedders/cohere/utils.py +0 -0
- {cohere_haystack-2.0.1 → cohere_haystack-2.0.2}/src/haystack_integrations/components/generators/cohere/__init__.py +0 -0
- {cohere_haystack-2.0.1 → cohere_haystack-2.0.2}/src/haystack_integrations/components/generators/cohere/chat/__init__.py +0 -0
- {cohere_haystack-2.0.1 → cohere_haystack-2.0.2}/src/haystack_integrations/components/generators/cohere/generator.py +0 -0
- {cohere_haystack-2.0.1 → cohere_haystack-2.0.2}/src/haystack_integrations/components/rankers/cohere/__init__.py +0 -0
- {cohere_haystack-2.0.1 → cohere_haystack-2.0.2}/src/haystack_integrations/components/rankers/cohere/ranker.py +0 -0
- {cohere_haystack-2.0.1 → cohere_haystack-2.0.2}/tests/__init__.py +0 -0
- {cohere_haystack-2.0.1 → cohere_haystack-2.0.2}/tests/test_cohere_ranker.py +0 -0
- {cohere_haystack-2.0.1 → cohere_haystack-2.0.2}/tests/test_document_embedder.py +0 -0
- {cohere_haystack-2.0.1 → cohere_haystack-2.0.2}/tests/test_text_embedder.py +0 -0
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [integrations/cohere-v2.0.1] - 2024-12-09
|
|
4
|
+
|
|
5
|
+
### ⚙️ CI
|
|
6
|
+
|
|
7
|
+
- Adopt uv as installer (#1142)
|
|
8
|
+
|
|
9
|
+
### 🧹 Chores
|
|
10
|
+
|
|
11
|
+
- Update ruff linting scripts and settings (#1105)
|
|
12
|
+
- Fix linting/isort (#1215)
|
|
13
|
+
|
|
14
|
+
### 🌀 Miscellaneous
|
|
15
|
+
|
|
16
|
+
- Chore: use class methods to create `ChatMessage` (#1222)
|
|
17
|
+
- Chore: use `text` instead of `content` for `ChatMessage` in Cohere and Anthropic (#1237)
|
|
18
|
+
|
|
3
19
|
## [integrations/cohere-v2.0.0] - 2024-09-16
|
|
4
20
|
|
|
5
21
|
### 🚀 Features
|
|
@@ -16,28 +32,49 @@
|
|
|
16
32
|
|
|
17
33
|
- Do not retry tests in `hatch run test` command (#954)
|
|
18
34
|
|
|
19
|
-
### ⚙️
|
|
35
|
+
### ⚙️ CI
|
|
20
36
|
|
|
21
37
|
- Retry tests to reduce flakyness (#836)
|
|
38
|
+
|
|
39
|
+
### 🧹 Chores
|
|
40
|
+
|
|
22
41
|
- Update ruff invocation to include check parameter (#853)
|
|
23
42
|
|
|
24
|
-
###
|
|
43
|
+
### 🌀 Miscellaneous
|
|
25
44
|
|
|
45
|
+
- Ci: install `pytest-rerunfailures` where needed; add retry config to `test-cov` script (#845)
|
|
26
46
|
- Update CohereChatGenerator docstrings (#958)
|
|
27
47
|
- Update CohereGenerator docstrings (#960)
|
|
28
48
|
|
|
29
49
|
## [integrations/cohere-v1.1.1] - 2024-06-12
|
|
30
50
|
|
|
51
|
+
### 🌀 Miscellaneous
|
|
52
|
+
|
|
53
|
+
- Chore: `CohereGenerator` - remove warning about `generate` API (#805)
|
|
54
|
+
|
|
31
55
|
## [integrations/cohere-v1.1.0] - 2024-05-24
|
|
32
56
|
|
|
33
57
|
### 🐛 Bug Fixes
|
|
34
58
|
|
|
35
59
|
- Remove support for generate API (#755)
|
|
36
60
|
|
|
61
|
+
### 🌀 Miscellaneous
|
|
62
|
+
|
|
63
|
+
- Chore: change the pydoc renderer class (#718)
|
|
64
|
+
|
|
37
65
|
## [integrations/cohere-v1.0.0] - 2024-05-03
|
|
38
66
|
|
|
67
|
+
### 🌀 Miscellaneous
|
|
68
|
+
|
|
69
|
+
- Follow up: update Cohere integration to use Cohere SDK v5 (#711)
|
|
70
|
+
|
|
39
71
|
## [integrations/cohere-v0.7.0] - 2024-05-02
|
|
40
72
|
|
|
73
|
+
### 🌀 Miscellaneous
|
|
74
|
+
|
|
75
|
+
- Chore: add license classifiers (#680)
|
|
76
|
+
- Update Cohere integration to use Cohere SDK v5 (#702)
|
|
77
|
+
|
|
41
78
|
## [integrations/cohere-v0.6.0] - 2024-04-08
|
|
42
79
|
|
|
43
80
|
### 🚀 Features
|
|
@@ -46,21 +83,17 @@
|
|
|
46
83
|
|
|
47
84
|
## [integrations/cohere-v0.5.0] - 2024-03-29
|
|
48
85
|
|
|
86
|
+
### 🌀 Miscellaneous
|
|
87
|
+
|
|
88
|
+
- Add the Cohere client name to cohere requests (#362)
|
|
89
|
+
|
|
49
90
|
## [integrations/cohere-v0.4.1] - 2024-03-21
|
|
50
91
|
|
|
51
92
|
### 🐛 Bug Fixes
|
|
52
93
|
|
|
53
94
|
- Fix order of API docs (#447)
|
|
54
|
-
|
|
55
|
-
This PR will also push the docs to Readme
|
|
56
95
|
- Fix tests (#561)
|
|
57
96
|
|
|
58
|
-
* fix unit tests
|
|
59
|
-
|
|
60
|
-
* try
|
|
61
|
-
|
|
62
|
-
* remove flaky check
|
|
63
|
-
|
|
64
97
|
### 📚 Documentation
|
|
65
98
|
|
|
66
99
|
- Update category slug (#442)
|
|
@@ -68,14 +101,20 @@ This PR will also push the docs to Readme
|
|
|
68
101
|
- Small consistency improvements (#536)
|
|
69
102
|
- Disable-class-def (#556)
|
|
70
103
|
|
|
71
|
-
###
|
|
104
|
+
### 🧹 Chores
|
|
72
105
|
|
|
73
106
|
- Update Cohere integration to use new generic callable (de)serializers for their callback handlers (#453)
|
|
74
107
|
- Use `serialize_callable` instead of `serialize_callback_handler` in Cohere (#460)
|
|
75
108
|
|
|
76
|
-
###
|
|
109
|
+
### 🌀 Miscellaneous
|
|
77
110
|
|
|
111
|
+
- Choere - remove matching error message from tests (#419)
|
|
78
112
|
- Fix linting (#509)
|
|
113
|
+
- Make tests show coverage (#566)
|
|
114
|
+
- Refactor tests (#574)
|
|
115
|
+
- Test: relax test constraints (#591)
|
|
116
|
+
- Remove references to Python 3.7 (#601)
|
|
117
|
+
- Fix: Pin cohere version (#609)
|
|
79
118
|
|
|
80
119
|
## [integrations/cohere-v0.4.0] - 2024-02-12
|
|
81
120
|
|
|
@@ -92,32 +131,57 @@ This PR will also push the docs to Readme
|
|
|
92
131
|
|
|
93
132
|
- Fix failing `TestCohereChatGenerator.test_from_dict_fail_wo_env_var` test (#393)
|
|
94
133
|
|
|
95
|
-
|
|
134
|
+
### 🌀 Miscellaneous
|
|
96
135
|
|
|
97
|
-
|
|
136
|
+
- Cohere: generate api docs (#321)
|
|
137
|
+
- Fix: update to latest haystack-ai version (#348)
|
|
98
138
|
|
|
99
|
-
-
|
|
139
|
+
## [integrations/cohere-v0.3.0] - 2024-01-25
|
|
100
140
|
|
|
141
|
+
### 🐛 Bug Fixes
|
|
101
142
|
|
|
143
|
+
- Fix project URLs (#96)
|
|
102
144
|
- Cohere namespace reorg (#271)
|
|
103
145
|
|
|
104
146
|
### 🚜 Refactor
|
|
105
147
|
|
|
106
148
|
- Use `hatch_vcs` to manage integrations versioning (#103)
|
|
107
149
|
|
|
108
|
-
###
|
|
150
|
+
### 🧹 Chores
|
|
109
151
|
|
|
110
152
|
- [**breaking**] Rename `model_name` to `model` in the Cohere integration (#222)
|
|
111
153
|
- Cohere namespace change (#247)
|
|
112
154
|
|
|
155
|
+
### 🌀 Miscellaneous
|
|
156
|
+
|
|
157
|
+
- Cohere: remove unused constant (#91)
|
|
158
|
+
- Change default 'input_type' for CohereTextEmbedder (#99)
|
|
159
|
+
- Change metadata to meta (#152)
|
|
160
|
+
- Add cohere chat generator (#88)
|
|
161
|
+
- Optimize API key reading (#162)
|
|
162
|
+
- Cohere - change metadata to meta (#178)
|
|
163
|
+
|
|
113
164
|
## [integrations/cohere-v0.2.0] - 2023-12-11
|
|
114
165
|
|
|
115
166
|
### 🚀 Features
|
|
116
167
|
|
|
117
168
|
- Add support for V3 Embed models to CohereEmbedders (#89)
|
|
118
169
|
|
|
170
|
+
### 🌀 Miscellaneous
|
|
171
|
+
|
|
172
|
+
- Cohere: increase version to prepare release (#92)
|
|
173
|
+
|
|
119
174
|
## [integrations/cohere-v0.1.1] - 2023-12-07
|
|
120
175
|
|
|
176
|
+
### 🌀 Miscellaneous
|
|
177
|
+
|
|
178
|
+
- [cohere] Add text and document embedders (#80)
|
|
179
|
+
- [cohere] fix cohere pypi version badge and add Embedder note (#86)
|
|
180
|
+
|
|
121
181
|
## [integrations/cohere-v0.0.1] - 2023-12-04
|
|
122
182
|
|
|
183
|
+
### 🌀 Miscellaneous
|
|
184
|
+
|
|
185
|
+
- Add `cohere_haystack` integration package (#75)
|
|
186
|
+
|
|
123
187
|
<!-- generated by git-cliff -->
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: cohere-haystack
|
|
3
|
-
Version: 2.0.
|
|
3
|
+
Version: 2.0.2
|
|
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
|
|
7
7
|
Author-email: deepset GmbH <info@deepset.ai>
|
|
8
|
-
License: Apache-2.0
|
|
8
|
+
License-Expression: Apache-2.0
|
|
9
|
+
License-File: LICENSE.txt
|
|
9
10
|
Classifier: Development Status :: 4 - Beta
|
|
10
11
|
Classifier: License :: OSI Approved :: Apache Software License
|
|
11
12
|
Classifier: Programming Language :: Python
|
|
@@ -172,7 +172,7 @@ class CohereChatGenerator:
|
|
|
172
172
|
response_text += event.text
|
|
173
173
|
elif event.event_type == "stream-end":
|
|
174
174
|
finish_response = event.response
|
|
175
|
-
chat_message = ChatMessage.from_assistant(
|
|
175
|
+
chat_message = ChatMessage.from_assistant(response_text)
|
|
176
176
|
|
|
177
177
|
if finish_response and finish_response.meta:
|
|
178
178
|
if finish_response.meta.billed_units:
|
|
@@ -219,7 +219,7 @@ class CohereChatGenerator:
|
|
|
219
219
|
# TODO revisit to see if we need to handle multiple tool calls
|
|
220
220
|
message = ChatMessage.from_assistant(cohere_response.tool_calls[0].json())
|
|
221
221
|
elif cohere_response.text:
|
|
222
|
-
message = ChatMessage.from_assistant(
|
|
222
|
+
message = ChatMessage.from_assistant(cohere_response.text)
|
|
223
223
|
message.meta.update(
|
|
224
224
|
{
|
|
225
225
|
"model": self.model,
|
|
@@ -27,7 +27,7 @@ def streaming_chunk(text: str):
|
|
|
27
27
|
|
|
28
28
|
@pytest.fixture
|
|
29
29
|
def chat_messages():
|
|
30
|
-
return [ChatMessage.from_assistant(
|
|
30
|
+
return [ChatMessage.from_assistant("What's the capital of France")]
|
|
31
31
|
|
|
32
32
|
|
|
33
33
|
class TestCohereChatGenerator:
|
|
@@ -98,26 +98,6 @@ class TestCohereChatGenerator:
|
|
|
98
98
|
},
|
|
99
99
|
}
|
|
100
100
|
|
|
101
|
-
def test_to_dict_with_lambda_streaming_callback(self, monkeypatch):
|
|
102
|
-
monkeypatch.setenv("COHERE_API_KEY", "test-api-key")
|
|
103
|
-
component = CohereChatGenerator(
|
|
104
|
-
model="command-r",
|
|
105
|
-
streaming_callback=lambda x: x,
|
|
106
|
-
api_base_url="test-base-url",
|
|
107
|
-
generation_kwargs={"max_tokens": 10, "some_test_param": "test-params"},
|
|
108
|
-
)
|
|
109
|
-
data = component.to_dict()
|
|
110
|
-
assert data == {
|
|
111
|
-
"type": "haystack_integrations.components.generators.cohere.chat.chat_generator.CohereChatGenerator",
|
|
112
|
-
"init_parameters": {
|
|
113
|
-
"model": "command-r",
|
|
114
|
-
"api_base_url": "test-base-url",
|
|
115
|
-
"api_key": {"env_vars": ["COHERE_API_KEY", "CO_API_KEY"], "strict": True, "type": "env_var"},
|
|
116
|
-
"streaming_callback": "tests.test_cohere_chat_generator.<lambda>",
|
|
117
|
-
"generation_kwargs": {"max_tokens": 10, "some_test_param": "test-params"},
|
|
118
|
-
},
|
|
119
|
-
}
|
|
120
|
-
|
|
121
101
|
def test_from_dict(self, monkeypatch):
|
|
122
102
|
monkeypatch.setenv("COHERE_API_KEY", "fake-api-key")
|
|
123
103
|
monkeypatch.setenv("CO_API_KEY", "fake-api-key")
|
|
@@ -164,7 +144,7 @@ class TestCohereChatGenerator:
|
|
|
164
144
|
)
|
|
165
145
|
@pytest.mark.integration
|
|
166
146
|
def test_live_run(self):
|
|
167
|
-
chat_messages = [ChatMessage.from_user(
|
|
147
|
+
chat_messages = [ChatMessage.from_user("What's the capital of France")]
|
|
168
148
|
component = CohereChatGenerator(generation_kwargs={"temperature": 0.8})
|
|
169
149
|
results = component.run(chat_messages)
|
|
170
150
|
assert len(results["replies"]) == 1
|
|
@@ -201,7 +181,7 @@ class TestCohereChatGenerator:
|
|
|
201
181
|
|
|
202
182
|
callback = Callback()
|
|
203
183
|
component = CohereChatGenerator(streaming_callback=callback)
|
|
204
|
-
results = component.run([ChatMessage.from_user(
|
|
184
|
+
results = component.run([ChatMessage.from_user("What's the capital of France? answer in a word")])
|
|
205
185
|
|
|
206
186
|
assert len(results["replies"]) == 1
|
|
207
187
|
message: ChatMessage = results["replies"][0]
|
|
@@ -222,7 +202,7 @@ class TestCohereChatGenerator:
|
|
|
222
202
|
)
|
|
223
203
|
@pytest.mark.integration
|
|
224
204
|
def test_live_run_with_connector(self):
|
|
225
|
-
chat_messages = [ChatMessage.from_user(
|
|
205
|
+
chat_messages = [ChatMessage.from_user("What's the capital of France")]
|
|
226
206
|
component = CohereChatGenerator(generation_kwargs={"temperature": 0.8})
|
|
227
207
|
results = component.run(chat_messages, generation_kwargs={"connectors": [{"id": "web-search"}]})
|
|
228
208
|
assert len(results["replies"]) == 1
|
|
@@ -247,7 +227,7 @@ class TestCohereChatGenerator:
|
|
|
247
227
|
self.responses += chunk.content if chunk.content else ""
|
|
248
228
|
|
|
249
229
|
callback = Callback()
|
|
250
|
-
chat_messages = [ChatMessage.from_user(
|
|
230
|
+
chat_messages = [ChatMessage.from_user("What's the capital of France? answer in a word")]
|
|
251
231
|
component = CohereChatGenerator(streaming_callback=callback)
|
|
252
232
|
results = component.run(chat_messages, generation_kwargs={"connectors": [{"id": "web-search"}]})
|
|
253
233
|
|
|
@@ -78,27 +78,6 @@ class TestCohereGenerator:
|
|
|
78
78
|
},
|
|
79
79
|
}
|
|
80
80
|
|
|
81
|
-
def test_to_dict_with_lambda_streaming_callback(self, monkeypatch):
|
|
82
|
-
monkeypatch.setenv("COHERE_API_KEY", "test-api-key")
|
|
83
|
-
component = CohereGenerator(
|
|
84
|
-
model="command-r",
|
|
85
|
-
max_tokens=10,
|
|
86
|
-
some_test_param="test-params",
|
|
87
|
-
streaming_callback=lambda x: x,
|
|
88
|
-
api_base_url="test-base-url",
|
|
89
|
-
)
|
|
90
|
-
data = component.to_dict()
|
|
91
|
-
assert data == {
|
|
92
|
-
"type": "haystack_integrations.components.generators.cohere.generator.CohereGenerator",
|
|
93
|
-
"init_parameters": {
|
|
94
|
-
"model": "command-r",
|
|
95
|
-
"streaming_callback": "tests.test_cohere_generator.<lambda>",
|
|
96
|
-
"api_base_url": "test-base-url",
|
|
97
|
-
"api_key": {"type": "env_var", "env_vars": ["COHERE_API_KEY", "CO_API_KEY"], "strict": True},
|
|
98
|
-
"generation_kwargs": {},
|
|
99
|
-
},
|
|
100
|
-
}
|
|
101
|
-
|
|
102
81
|
def test_from_dict(self, monkeypatch):
|
|
103
82
|
monkeypatch.setenv("COHERE_API_KEY", "fake-api-key")
|
|
104
83
|
monkeypatch.setenv("CO_API_KEY", "fake-api-key")
|
|
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
|