Skip to content

Commit 87b7eac

Browse files
SDK regeneration
1 parent 1231a31 commit 87b7eac

30 files changed

+2092
-468
lines changed

poetry.lock

Lines changed: 456 additions & 364 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name = "cohere"
33

44
[tool.poetry]
55
name = "cohere"
6-
version = "5.18.0"
6+
version = "5.19.0"
77
description = ""
88
readme = "README.md"
99
authors = []

src/cohere/__init__.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@
251251
UnauthorizedError,
252252
UnprocessableEntityError,
253253
)
254-
from . import connectors, datasets, embed_jobs, finetuning, models, v2
254+
from . import batches, connectors, datasets, embed_jobs, finetuning, models, v2
255255
from .aliases import (
256256
ChatResponse,
257257
ContentDeltaStreamedChatResponseV2,
@@ -265,6 +265,7 @@
265265
ToolCallStartStreamedChatResponseV2,
266266
)
267267
from .aws_client import AwsClient
268+
from .batches import Batch, BatchStatus, CancelBatchResponse, CreateBatchResponse, GetBatchResponse, ListBatchesResponse
268269
from .bedrock_client import BedrockClient, BedrockClientV2
269270
from .client import AsyncClient, Client
270271
from .client_v2 import AsyncClientV2, ClientV2
@@ -315,8 +316,11 @@
315316
"AuthTokenType",
316317
"AwsClient",
317318
"BadRequestError",
319+
"Batch",
320+
"BatchStatus",
318321
"BedrockClient",
319322
"BedrockClientV2",
323+
"CancelBatchResponse",
320324
"ChatCitation",
321325
"ChatCitationGenerationEvent",
322326
"ChatCitationType",
@@ -417,6 +421,7 @@
417421
"ContentEndV2ChatStreamResponse",
418422
"ContentStartStreamedChatResponseV2",
419423
"ContentStartV2ChatStreamResponse",
424+
"CreateBatchResponse",
420425
"CreateConnectorOAuth",
421426
"CreateConnectorResponse",
422427
"CreateConnectorServiceAuth",
@@ -470,6 +475,7 @@
470475
"GenerateStreamText",
471476
"GenerateStreamedResponse",
472477
"Generation",
478+
"GetBatchResponse",
473479
"GetConnectorResponse",
474480
"GetModelResponse",
475481
"Image",
@@ -485,6 +491,7 @@
485491
"JsonResponseFormat",
486492
"JsonResponseFormatV2",
487493
"LabelMetric",
494+
"ListBatchesResponse",
488495
"ListConnectorsResponse",
489496
"ListEmbedJobResponse",
490497
"ListModelsResponse",
@@ -594,6 +601,7 @@
594601
"V2RerankResponse",
595602
"V2RerankResponseResultsItem",
596603
"__version__",
604+
"batches",
597605
"connectors",
598606
"datasets",
599607
"embed_jobs",

src/cohere/base_client.py

Lines changed: 23 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import typing
55

66
import httpx
7+
from .batches.client import AsyncBatchesClient, BatchesClient
78
from .connectors.client import AsyncConnectorsClient, ConnectorsClient
89
from .core.api_error import ApiError
910
from .core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
@@ -124,6 +125,7 @@ def __init__(
124125
)
125126
self._raw_client = RawBaseCohere(client_wrapper=self._client_wrapper)
126127
self.v2 = V2Client(client_wrapper=self._client_wrapper)
128+
self.batches = BatchesClient(client_wrapper=self._client_wrapper)
127129
self.embed_jobs = EmbedJobsClient(client_wrapper=self._client_wrapper)
128130
self.datasets = DatasetsClient(client_wrapper=self._client_wrapper)
129131
self.connectors = ConnectorsClient(client_wrapper=self._client_wrapper)
@@ -268,9 +270,8 @@ def chat_stream(
268270
Compatible Deployments: Cohere Platform, Azure, AWS Sagemaker/Bedrock, Private Deployments
269271
270272
citation_quality : typing.Optional[ChatStreamRequestCitationQuality]
271-
Defaults to `"accurate"`.
272-
273-
Dictates the approach taken to generating citations as part of the RAG flow by allowing the user to specify whether they want `"accurate"` results, `"fast"` results or no results.
273+
Defaults to `"enabled"`.
274+
Citations are enabled by default for models that support it, but can be turned off by setting `"type": "disabled"`.
274275
275276
Compatible Deployments: Cohere Platform, Azure, AWS Sagemaker/Bedrock, Private Deployments
276277
@@ -406,7 +407,8 @@ def chat_stream(
406407
token="YOUR_TOKEN",
407408
)
408409
response = client.chat_stream(
409-
message="hello world!",
410+
model="command-a-03-2025",
411+
message="hello!",
410412
)
411413
for chunk in response:
412414
yield chunk
@@ -568,9 +570,8 @@ def chat(
568570
Compatible Deployments: Cohere Platform, Azure, AWS Sagemaker/Bedrock, Private Deployments
569571
570572
citation_quality : typing.Optional[ChatRequestCitationQuality]
571-
Defaults to `"accurate"`.
572-
573-
Dictates the approach taken to generating citations as part of the RAG flow by allowing the user to specify whether they want `"accurate"` results, `"fast"` results or no results.
573+
Defaults to `"enabled"`.
574+
Citations are enabled by default for models that support it, but can be turned off by setting `"type": "disabled"`.
574575
575576
Compatible Deployments: Cohere Platform, Azure, AWS Sagemaker/Bedrock, Private Deployments
576577
@@ -699,27 +700,15 @@ def chat(
699700
700701
Examples
701702
--------
702-
from cohere import ChatbotMessage, ChatConnector, Client, UserMessage
703+
from cohere import Client
703704
704705
client = Client(
705706
client_name="YOUR_CLIENT_NAME",
706707
token="YOUR_TOKEN",
707708
)
708709
client.chat(
709-
chat_history=[
710-
UserMessage(
711-
message="Who discovered gravity?",
712-
),
713-
ChatbotMessage(
714-
message="The man who is widely credited with discovering gravity is Sir Isaac Newton",
715-
),
716-
],
717-
message="What year was he born?",
718-
connectors=[
719-
ChatConnector(
720-
id="web-search",
721-
)
722-
],
710+
model="command-a-03-2025",
711+
message="Tell me about LLMs",
723712
)
724713
"""
725714
_response = self._raw_client.chat(
@@ -1073,7 +1062,7 @@ def embed(
10731062
images : typing.Optional[typing.Sequence[str]]
10741063
An array of image data URIs for the model to embed. Maximum number of images per call is `1`.
10751064
1076-
The image must be a valid [data URI](https://developer.mozilla.org/en-US/docs/Web/URI/Schemes/data). The image must be in either `image/jpeg` or `image/png` format and has a maximum size of 5MB.
1065+
The image must be a valid [data URI](https://developer.mozilla.org/en-US/docs/Web/URI/Schemes/data). The image must be in either `image/jpeg`, `image/png`, `image/webp`, or `image/gif` format and has a maximum size of 5MB.
10771066
10781067
Images are only supported with Embed v3.0 and newer models.
10791068
@@ -1580,6 +1569,7 @@ def __init__(
15801569
)
15811570
self._raw_client = AsyncRawBaseCohere(client_wrapper=self._client_wrapper)
15821571
self.v2 = AsyncV2Client(client_wrapper=self._client_wrapper)
1572+
self.batches = AsyncBatchesClient(client_wrapper=self._client_wrapper)
15831573
self.embed_jobs = AsyncEmbedJobsClient(client_wrapper=self._client_wrapper)
15841574
self.datasets = AsyncDatasetsClient(client_wrapper=self._client_wrapper)
15851575
self.connectors = AsyncConnectorsClient(client_wrapper=self._client_wrapper)
@@ -1724,9 +1714,8 @@ async def chat_stream(
17241714
Compatible Deployments: Cohere Platform, Azure, AWS Sagemaker/Bedrock, Private Deployments
17251715
17261716
citation_quality : typing.Optional[ChatStreamRequestCitationQuality]
1727-
Defaults to `"accurate"`.
1728-
1729-
Dictates the approach taken to generating citations as part of the RAG flow by allowing the user to specify whether they want `"accurate"` results, `"fast"` results or no results.
1717+
Defaults to `"enabled"`.
1718+
Citations are enabled by default for models that support it, but can be turned off by setting `"type": "disabled"`.
17301719
17311720
Compatible Deployments: Cohere Platform, Azure, AWS Sagemaker/Bedrock, Private Deployments
17321721
@@ -1867,7 +1856,8 @@ async def chat_stream(
18671856
18681857
async def main() -> None:
18691858
response = await client.chat_stream(
1870-
message="hello world!",
1859+
model="command-a-03-2025",
1860+
message="hello!",
18711861
)
18721862
async for chunk in response:
18731863
yield chunk
@@ -2033,9 +2023,8 @@ async def chat(
20332023
Compatible Deployments: Cohere Platform, Azure, AWS Sagemaker/Bedrock, Private Deployments
20342024
20352025
citation_quality : typing.Optional[ChatRequestCitationQuality]
2036-
Defaults to `"accurate"`.
2037-
2038-
Dictates the approach taken to generating citations as part of the RAG flow by allowing the user to specify whether they want `"accurate"` results, `"fast"` results or no results.
2026+
Defaults to `"enabled"`.
2027+
Citations are enabled by default for models that support it, but can be turned off by setting `"type": "disabled"`.
20392028
20402029
Compatible Deployments: Cohere Platform, Azure, AWS Sagemaker/Bedrock, Private Deployments
20412030
@@ -2166,7 +2155,7 @@ async def chat(
21662155
--------
21672156
import asyncio
21682157
2169-
from cohere import AsyncClient, ChatbotMessage, ChatConnector, UserMessage
2158+
from cohere import AsyncClient
21702159
21712160
client = AsyncClient(
21722161
client_name="YOUR_CLIENT_NAME",
@@ -2176,20 +2165,8 @@ async def chat(
21762165
21772166
async def main() -> None:
21782167
await client.chat(
2179-
chat_history=[
2180-
UserMessage(
2181-
message="Who discovered gravity?",
2182-
),
2183-
ChatbotMessage(
2184-
message="The man who is widely credited with discovering gravity is Sir Isaac Newton",
2185-
),
2186-
],
2187-
message="What year was he born?",
2188-
connectors=[
2189-
ChatConnector(
2190-
id="web-search",
2191-
)
2192-
],
2168+
model="command-a-03-2025",
2169+
message="Tell me about LLMs",
21932170
)
21942171
21952172
@@ -2563,7 +2540,7 @@ async def embed(
25632540
images : typing.Optional[typing.Sequence[str]]
25642541
An array of image data URIs for the model to embed. Maximum number of images per call is `1`.
25652542
2566-
The image must be a valid [data URI](https://developer.mozilla.org/en-US/docs/Web/URI/Schemes/data). The image must be in either `image/jpeg` or `image/png` format and has a maximum size of 5MB.
2543+
The image must be a valid [data URI](https://developer.mozilla.org/en-US/docs/Web/URI/Schemes/data). The image must be in either `image/jpeg`, `image/png`, `image/webp`, or `image/gif` format and has a maximum size of 5MB.
25672544
25682545
Images are only supported with Embed v3.0 and newer models.
25692546

src/cohere/batches/__init__.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# This file was auto-generated by Fern from our API Definition.
2+
3+
# isort: skip_file
4+
5+
from .types import Batch, BatchStatus, CancelBatchResponse, CreateBatchResponse, GetBatchResponse, ListBatchesResponse
6+
7+
__all__ = [
8+
"Batch",
9+
"BatchStatus",
10+
"CancelBatchResponse",
11+
"CreateBatchResponse",
12+
"GetBatchResponse",
13+
"ListBatchesResponse",
14+
]

0 commit comments

Comments
 (0)