otari-haystack 2.0.0__tar.gz → 3.0.0__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 (31) hide show
  1. {otari_haystack-2.0.0 → otari_haystack-3.0.0}/CHANGELOG.md +7 -0
  2. {otari_haystack-2.0.0 → otari_haystack-3.0.0}/PKG-INFO +1 -1
  3. {otari_haystack-2.0.0 → otari_haystack-3.0.0}/docker-compose.yml +4 -0
  4. {otari_haystack-2.0.0 → otari_haystack-3.0.0}/src/haystack_integrations/components/generators/otari/chat/chat_generator.py +14 -3
  5. {otari_haystack-2.0.0 → otari_haystack-3.0.0}/tests/test_chat_generator.py +31 -3
  6. {otari_haystack-2.0.0 → otari_haystack-3.0.0}/tests/test_chat_generator_async.py +33 -3
  7. {otari_haystack-2.0.0 → otari_haystack-3.0.0}/.gitignore +0 -0
  8. {otari_haystack-2.0.0 → otari_haystack-3.0.0}/LICENSE.txt +0 -0
  9. {otari_haystack-2.0.0 → otari_haystack-3.0.0}/README.md +0 -0
  10. {otari_haystack-2.0.0 → otari_haystack-3.0.0}/pydoc/config_docusaurus.yml +0 -0
  11. {otari_haystack-2.0.0 → otari_haystack-3.0.0}/pyproject.toml +0 -0
  12. {otari_haystack-2.0.0 → otari_haystack-3.0.0}/src/haystack_integrations/common/otari/__init__.py +0 -0
  13. {otari_haystack-2.0.0 → otari_haystack-3.0.0}/src/haystack_integrations/common/otari/utils.py +0 -0
  14. {otari_haystack-2.0.0 → otari_haystack-3.0.0}/src/haystack_integrations/common/py.typed +0 -0
  15. {otari_haystack-2.0.0 → otari_haystack-3.0.0}/src/haystack_integrations/components/embedders/otari/__init__.py +0 -0
  16. {otari_haystack-2.0.0 → otari_haystack-3.0.0}/src/haystack_integrations/components/embedders/otari/document_embedder.py +0 -0
  17. {otari_haystack-2.0.0 → otari_haystack-3.0.0}/src/haystack_integrations/components/embedders/otari/text_embedder.py +0 -0
  18. {otari_haystack-2.0.0 → otari_haystack-3.0.0}/src/haystack_integrations/components/embedders/py.typed +0 -0
  19. {otari_haystack-2.0.0 → otari_haystack-3.0.0}/src/haystack_integrations/components/generators/otari/__init__.py +0 -0
  20. {otari_haystack-2.0.0 → otari_haystack-3.0.0}/src/haystack_integrations/components/generators/otari/chat/__init__.py +0 -0
  21. {otari_haystack-2.0.0 → otari_haystack-3.0.0}/src/haystack_integrations/components/generators/py.typed +0 -0
  22. {otari_haystack-2.0.0 → otari_haystack-3.0.0}/src/haystack_integrations/components/rankers/otari/__init__.py +0 -0
  23. {otari_haystack-2.0.0 → otari_haystack-3.0.0}/src/haystack_integrations/components/rankers/otari/ranker.py +0 -0
  24. {otari_haystack-2.0.0 → otari_haystack-3.0.0}/src/haystack_integrations/components/rankers/py.typed +0 -0
  25. {otari_haystack-2.0.0 → otari_haystack-3.0.0}/tests/__init__.py +0 -0
  26. {otari_haystack-2.0.0 → otari_haystack-3.0.0}/tests/conftest.py +0 -0
  27. {otari_haystack-2.0.0 → otari_haystack-3.0.0}/tests/test_chat_generator_reasoning.py +0 -0
  28. {otari_haystack-2.0.0 → otari_haystack-3.0.0}/tests/test_document_embedder.py +0 -0
  29. {otari_haystack-2.0.0 → otari_haystack-3.0.0}/tests/test_ranker.py +0 -0
  30. {otari_haystack-2.0.0 → otari_haystack-3.0.0}/tests/test_text_embedder.py +0 -0
  31. {otari_haystack-2.0.0 → otari_haystack-3.0.0}/tests/test_utils.py +0 -0
@@ -1,5 +1,12 @@
1
1
  # Changelog
2
2
 
3
+ ## [integrations/otari-v2.0.0] - 2026-10-16
4
+
5
+ ### 🧹 Chores
6
+
7
+ - [**breaking**] Otari - drop Python 3.10 and test with Python 3.15 (#4117)
8
+
9
+
3
10
  ## [integrations/otari-v1.0.0] - 2026-10-15
4
11
 
5
12
  ### 🚀 Features
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: otari-haystack
3
- Version: 2.0.0
3
+ Version: 3.0.0
4
4
  Summary: An integration between the Otari LLM gateway and Haystack
5
5
  Project-URL: Documentation, https://github.com/deepset-ai/haystack-core-integrations/tree/main/integrations/otari#readme
6
6
  Project-URL: Issues, https://github.com/deepset-ai/haystack-core-integrations/issues
@@ -26,6 +26,10 @@ services:
26
26
  api_key: $${ANTHROPIC_API_KEY}
27
27
  # The bundled prices don't cover rerank models; Cohere charges $2 per 1,000 search units
28
28
  pricing:
29
+ # Not among the prices bundled with this Otari version; OpenAI's standard price
30
+ openai:gpt-6.1-terra:
31
+ input_price_per_million: 1.00
32
+ output_price_per_million: 5.00
29
33
  cohere:rerank-v3.5:
30
34
  input_price_per_million: 2000
31
35
  output_price_per_million: 0
@@ -36,6 +36,11 @@ from pydantic import BaseModel
36
36
 
37
37
  from haystack_integrations.common.otari.utils import _warn_if_eu_key_on_default_url
38
38
 
39
+ # These models accept function tools over Chat Completions only with `reasoning_effort="none"` and return HTTP 400
40
+ # otherwise. Haystack's OpenAIChatGenerator applies this default for its own list of models, but matches the start of
41
+ # the model name, so it misses Otari selectors such as `openai:gpt-6.1-terra`.
42
+ _NO_REASONING_TOOL_CALL_MODEL_PREFIXES = ("gpt-6.1-terra",)
43
+
39
44
 
40
45
  def _reasoning_content(message_or_delta: Any) -> ReasoningContent | None:
41
46
  """
@@ -77,7 +82,7 @@ class OtariChatGenerator(OpenAIChatGenerator):
77
82
  region, whose API keys start with `otk_v1_eu_`, set `api_base_url` to `"https://eu.api.otari.ai/api/v1"`.
78
83
  To call a gateway you run yourself, set `api_base_url`, for example to `"http://localhost:8000/api/v1"`.
79
84
 
80
- Name models with a selector the gateway accepts, such as `provider:model` (`"openai:gpt-5-mini"`,
85
+ Name models with a selector the gateway accepts, such as `provider:model` (`"openai:gpt-6.1-terra"`,
81
86
  `"anthropic:claude-sonnet-4-6"`), a model alias, or a routing policy name. For details, see the
82
87
  [Otari model docs](https://github.com/mozilla-ai/otari/blob/main/docs/models.md).
83
88
 
@@ -114,7 +119,7 @@ class OtariChatGenerator(OpenAIChatGenerator):
114
119
  self,
115
120
  *,
116
121
  api_key: Secret = Secret.from_env_var("OTARI_API_KEY"),
117
- model: str = "openai:gpt-5-mini",
122
+ model: str = "openai:gpt-6.1-terra",
118
123
  streaming_callback: StreamingCallbackT | None = None,
119
124
  api_base_url: str = "https://api.otari.ai/api/v1",
120
125
  generation_kwargs: dict[str, Any] | None = None,
@@ -131,7 +136,7 @@ class OtariChatGenerator(OpenAIChatGenerator):
131
136
  The Otari API key: a key issued by your gateway, or an otari.ai API key.
132
137
  Defaults to the `OTARI_API_KEY` environment variable.
133
138
  :param model:
134
- The model selector, for example `"openai:gpt-5-mini"`. The gateway must have the provider configured.
139
+ The model selector, for example `"openai:gpt-6.1-terra"`. The gateway must have the provider configured.
135
140
  :param streaming_callback:
136
141
  A callback function that is called when a new token is received from the stream.
137
142
  The callback function accepts StreamingChunk as an argument.
@@ -333,6 +338,12 @@ class OtariChatGenerator(OpenAIChatGenerator):
333
338
  tools_strict=tools_strict,
334
339
  )
335
340
  api_args["messages"] = [self._convert_message_to_api_format(message) for message in messages]
341
+ # Not part of the haystack-ai < 3.5 bridge above: keep this when the bridge is removed.
342
+ # Strip the provider from selectors like "openai:gpt-6.1-terra" or "openai/gpt-6.1-terra"
343
+ model_id = self.model.split(":", 1)[-1].rsplit("/", 1)[-1]
344
+ # setdefault keeps a reasoning_effort the user set explicitly
345
+ if "tools" in api_args and model_id.startswith(_NO_REASONING_TOOL_CALL_MODEL_PREFIXES):
346
+ api_args.setdefault("reasoning_effort", "none")
336
347
  return api_args
337
348
 
338
349
  @component.output_types(replies=list[ChatMessage])
@@ -19,7 +19,7 @@ from haystack_integrations.components.generators.otari import OtariChatGenerator
19
19
 
20
20
  from .conftest import OTARI_API_BASE_URL, requires_api_key
21
21
 
22
- DEFAULT_MODEL = "openai:gpt-5-mini"
22
+ DEFAULT_MODEL = "openai:gpt-6.1-terra"
23
23
  DEFAULT_API_BASE_URL = "https://api.otari.ai/api/v1"
24
24
  COMPONENT_TYPE = "haystack_integrations.components.generators.otari.chat.chat_generator.OtariChatGenerator"
25
25
 
@@ -35,7 +35,7 @@ def mock_chat_completion():
35
35
  with patch("openai.resources.chat.completions.Completions.create") as mock_chat_completion_create:
36
36
  mock_chat_completion_create.return_value = ChatCompletion(
37
37
  id="foo",
38
- model="gpt-5-mini-2025-08-07",
38
+ model="gpt-6.1-terra",
39
39
  object="chat.completion",
40
40
  choices=[
41
41
  Choice(
@@ -208,6 +208,34 @@ class TestOtariChatGenerator:
208
208
  _, kwargs = mock_chat_completion.call_args
209
209
  assert kwargs["extra_headers"] == {"Idempotency-Key": "request-1"}
210
210
 
211
+ @pytest.mark.parametrize(
212
+ ("model", "use_tools", "generation_kwargs", "expected_reasoning_effort"),
213
+ [
214
+ ("openai:gpt-6.1-terra", True, {}, "none"),
215
+ ("openai/gpt-6.1-terra", True, {}, "none"),
216
+ ("openai:gpt-6.1-terra", True, {"reasoning_effort": "low"}, "low"),
217
+ ("openai:gpt-6.1-terra", False, {}, None),
218
+ ("openai:gpt-4.1", True, {}, None),
219
+ ],
220
+ )
221
+ def test_run_reasoning_effort_default_with_tools(
222
+ self,
223
+ chat_messages,
224
+ tools,
225
+ mock_chat_completion,
226
+ monkeypatch,
227
+ model,
228
+ use_tools,
229
+ generation_kwargs,
230
+ expected_reasoning_effort,
231
+ ):
232
+ monkeypatch.setenv("OTARI_API_KEY", "fake-api-key")
233
+ component = OtariChatGenerator(model=model)
234
+ component.run(chat_messages, tools=tools if use_tools else None, generation_kwargs=generation_kwargs)
235
+
236
+ _, kwargs = mock_chat_completion.call_args
237
+ assert kwargs.get("reasoning_effort") == expected_reasoning_effort
238
+
211
239
  def test_serde_in_pipeline(self, monkeypatch, tools):
212
240
  monkeypatch.setenv("ENV_VAR", "test-key")
213
241
  generator = OtariChatGenerator(
@@ -240,7 +268,7 @@ class TestOtariChatGenerator:
240
268
  assert len(results["replies"]) == 1
241
269
  message = results["replies"][0]
242
270
  assert "Paris" in message.text
243
- assert "gpt-5-mini" in message.meta["model"]
271
+ assert "gpt-6.1-terra" in message.meta["model"]
244
272
  assert message.meta["finish_reason"] == "stop"
245
273
  # the local test gateway prices the model with Otari's bundled prices, otari.ai with the organization's
246
274
  assert float(message.meta["usage"]["cost_usd"]) > 0
@@ -15,7 +15,7 @@ from haystack_integrations.components.generators.otari import OtariChatGenerator
15
15
 
16
16
  from .conftest import OTARI_API_BASE_URL, requires_api_key
17
17
 
18
- DEFAULT_MODEL = "openai:gpt-5-mini"
18
+ DEFAULT_MODEL = "openai:gpt-6.1-terra"
19
19
 
20
20
 
21
21
  @pytest.fixture
@@ -26,7 +26,7 @@ def mock_async_chat_completion():
26
26
  ) as mock_chat_completion_create:
27
27
  mock_chat_completion_create.return_value = ChatCompletion(
28
28
  id="foo",
29
- model="gpt-5-mini-2025-08-07",
29
+ model="gpt-6.1-terra",
30
30
  object="chat.completion",
31
31
  choices=[
32
32
  Choice(
@@ -73,6 +73,36 @@ class TestOtariChatGeneratorAsync:
73
73
  assert reply.text == "Hello world!"
74
74
  assert reply.meta["usage"]["cost_usd"] == "0.000279"
75
75
 
76
+ @pytest.mark.parametrize(
77
+ ("model", "use_tools", "generation_kwargs", "expected_reasoning_effort"),
78
+ [
79
+ ("openai:gpt-6.1-terra", True, {}, "none"),
80
+ ("openai/gpt-6.1-terra", True, {}, "none"),
81
+ ("openai:gpt-6.1-terra", True, {"reasoning_effort": "low"}, "low"),
82
+ ("openai:gpt-6.1-terra", False, {}, None),
83
+ ("openai:gpt-4.1", True, {}, None),
84
+ ],
85
+ )
86
+ async def test_run_async_reasoning_effort_default_with_tools(
87
+ self,
88
+ chat_messages,
89
+ tools,
90
+ mock_async_chat_completion,
91
+ monkeypatch,
92
+ model,
93
+ use_tools,
94
+ generation_kwargs,
95
+ expected_reasoning_effort,
96
+ ):
97
+ monkeypatch.setenv("OTARI_API_KEY", "fake-api-key")
98
+ component = OtariChatGenerator(model=model)
99
+ await component.run_async(
100
+ chat_messages, tools=tools if use_tools else None, generation_kwargs=generation_kwargs
101
+ )
102
+
103
+ _, kwargs = mock_async_chat_completion.call_args
104
+ assert kwargs.get("reasoning_effort") == expected_reasoning_effort
105
+
76
106
  @requires_api_key
77
107
  @pytest.mark.integration
78
108
  async def test_live_run_async(self):
@@ -82,7 +112,7 @@ class TestOtariChatGeneratorAsync:
82
112
  assert len(results["replies"]) == 1
83
113
  message = results["replies"][0]
84
114
  assert "Paris" in message.text
85
- assert "gpt-5-mini" in message.meta["model"]
115
+ assert "gpt-6.1-terra" in message.meta["model"]
86
116
  assert message.meta["finish_reason"] == "stop"
87
117
 
88
118
  @requires_api_key
File without changes