sentiogate-python 1.3.1__py3-none-any.whl → 1.3.2__py3-none-any.whl
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.
- sentiogate/client.py +25 -1
- {sentiogate_python-1.3.1.dist-info → sentiogate_python-1.3.2.dist-info}/METADATA +1 -1
- sentiogate_python-1.3.2.dist-info/RECORD +8 -0
- sentiogate_python-1.3.1.dist-info/RECORD +0 -8
- {sentiogate_python-1.3.1.dist-info → sentiogate_python-1.3.2.dist-info}/WHEEL +0 -0
- {sentiogate_python-1.3.1.dist-info → sentiogate_python-1.3.2.dist-info}/licenses/LICENSE +0 -0
- {sentiogate_python-1.3.1.dist-info → sentiogate_python-1.3.2.dist-info}/top_level.txt +0 -0
sentiogate/client.py
CHANGED
|
@@ -18,7 +18,7 @@ import urllib.request
|
|
|
18
18
|
from collections.abc import Callable, Iterator
|
|
19
19
|
from typing import Any
|
|
20
20
|
|
|
21
|
-
VERSION = "1.3.
|
|
21
|
+
VERSION = "1.3.2"
|
|
22
22
|
# Sent on every request: honest, names this SDK, its real version and the OS it runs on (never a browser string,
|
|
23
23
|
# never the default Python-urllib agent, which the gateway's bot check may refuse).
|
|
24
24
|
USER_AGENT = f"sentiogate-python/{VERSION} ({platform.system() or 'unknown'})"
|
|
@@ -187,6 +187,10 @@ class AutoRouterClient:
|
|
|
187
187
|
hedge_delay_ms: int | None = None, # deprecated no-op: ignored by the gateway
|
|
188
188
|
cache: bool = False,
|
|
189
189
|
cache_bypass: bool = False,
|
|
190
|
+
max_cost_usd: float | None = None,
|
|
191
|
+
max_latency_ms: int | None = None,
|
|
192
|
+
strict_cost: bool = False,
|
|
193
|
+
tool_search: str | bool | None = None,
|
|
190
194
|
extra_body: dict[str, Any] | None = None,
|
|
191
195
|
) -> dict[str, Any]:
|
|
192
196
|
"""Send a chat completion request to the router.
|
|
@@ -217,6 +221,14 @@ class AutoRouterClient:
|
|
|
217
221
|
payload["plugins"] = plugins
|
|
218
222
|
if router_metadata:
|
|
219
223
|
payload["router_metadata"] = True
|
|
224
|
+
if max_cost_usd is not None:
|
|
225
|
+
payload["max_cost_usd"] = max_cost_usd
|
|
226
|
+
if max_latency_ms is not None:
|
|
227
|
+
payload["max_latency_ms"] = max_latency_ms
|
|
228
|
+
if strict_cost:
|
|
229
|
+
payload["strict_cost"] = True
|
|
230
|
+
if tool_search is not None:
|
|
231
|
+
payload["tool_search"] = tool_search
|
|
220
232
|
if extra_body:
|
|
221
233
|
payload.update(extra_body)
|
|
222
234
|
|
|
@@ -302,6 +314,10 @@ class AutoRouterClient:
|
|
|
302
314
|
constraints: dict[str, Any] | None = None,
|
|
303
315
|
plugins: list[dict[str, Any]] | None = None,
|
|
304
316
|
tier: str = "free",
|
|
317
|
+
max_cost_usd: float | None = None,
|
|
318
|
+
max_latency_ms: int | None = None,
|
|
319
|
+
strict_cost: bool = False,
|
|
320
|
+
tool_search: str | bool | None = None,
|
|
305
321
|
extra_body: dict[str, Any] | None = None,
|
|
306
322
|
) -> Iterator[dict[str, Any]]:
|
|
307
323
|
"""Stream chat completion chunks (SSE) from the router.
|
|
@@ -327,6 +343,14 @@ class AutoRouterClient:
|
|
|
327
343
|
payload["constraints"] = constraints
|
|
328
344
|
if plugins is not None:
|
|
329
345
|
payload["plugins"] = plugins
|
|
346
|
+
if max_cost_usd is not None:
|
|
347
|
+
payload["max_cost_usd"] = max_cost_usd
|
|
348
|
+
if max_latency_ms is not None:
|
|
349
|
+
payload["max_latency_ms"] = max_latency_ms
|
|
350
|
+
if strict_cost:
|
|
351
|
+
payload["strict_cost"] = True
|
|
352
|
+
if tool_search is not None:
|
|
353
|
+
payload["tool_search"] = tool_search
|
|
330
354
|
if extra_body:
|
|
331
355
|
payload.update(extra_body)
|
|
332
356
|
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
sentiogate/__init__.py,sha256=29ukbIt-wtLmQrTZqO06A20-fO6RiDzhTO2L_VMA-uQ,494
|
|
2
|
+
sentiogate/client.py,sha256=5ZadLMYjM9bchJ-dYd_gGR-n9wAxmaX62cNve5ReWc8,24904
|
|
3
|
+
sentiogate/py.typed,sha256=-yl3TJziRnBGR4RQVDoLxLVJCMoslIXZL48QaM0ulXI,35
|
|
4
|
+
sentiogate_python-1.3.2.dist-info/licenses/LICENSE,sha256=z8d0m5b2O9McPEK1xHG_dWgUBT6EfBDz6wA0F7xSPTA,11358
|
|
5
|
+
sentiogate_python-1.3.2.dist-info/METADATA,sha256=c8wIoktFw6eUL9yFappVLZ-whZuqW7GM37tLXMhxj2c,4921
|
|
6
|
+
sentiogate_python-1.3.2.dist-info/WHEEL,sha256=mOdXR9C3wMVov7cSY8PY-XCzo3SmmWCHvGQr5csJoao,91
|
|
7
|
+
sentiogate_python-1.3.2.dist-info/top_level.txt,sha256=fxARYgd5oUze_a7WfsncfYRu5Qfu75FhwXhKE97He4c,11
|
|
8
|
+
sentiogate_python-1.3.2.dist-info/RECORD,,
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
sentiogate/__init__.py,sha256=29ukbIt-wtLmQrTZqO06A20-fO6RiDzhTO2L_VMA-uQ,494
|
|
2
|
-
sentiogate/client.py,sha256=7Yma-EQfAEz-mDyhdrvrgaitvcBcx70CLSOfKwXyUN8,23902
|
|
3
|
-
sentiogate/py.typed,sha256=-yl3TJziRnBGR4RQVDoLxLVJCMoslIXZL48QaM0ulXI,35
|
|
4
|
-
sentiogate_python-1.3.1.dist-info/licenses/LICENSE,sha256=z8d0m5b2O9McPEK1xHG_dWgUBT6EfBDz6wA0F7xSPTA,11358
|
|
5
|
-
sentiogate_python-1.3.1.dist-info/METADATA,sha256=thBCu-XrFdjLVpAG7lGCun-ZAn3zk37xvlSEycP-k0o,4921
|
|
6
|
-
sentiogate_python-1.3.1.dist-info/WHEEL,sha256=mOdXR9C3wMVov7cSY8PY-XCzo3SmmWCHvGQr5csJoao,91
|
|
7
|
-
sentiogate_python-1.3.1.dist-info/top_level.txt,sha256=fxARYgd5oUze_a7WfsncfYRu5Qfu75FhwXhKE97He4c,11
|
|
8
|
-
sentiogate_python-1.3.1.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|