Skip to content

Commit 98d754a

Browse files
SDK regeneration
1 parent 1231a31 commit 98d754a

19 files changed

+533
-467
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/base_client.py

Lines changed: 20 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -268,9 +268,8 @@ def chat_stream(
268268
Compatible Deployments: Cohere Platform, Azure, AWS Sagemaker/Bedrock, Private Deployments
269269
270270
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.
271+
Defaults to `"enabled"`.
272+
Citations are enabled by default for models that support it, but can be turned off by setting `"type": "disabled"`.
274273
275274
Compatible Deployments: Cohere Platform, Azure, AWS Sagemaker/Bedrock, Private Deployments
276275
@@ -406,7 +405,8 @@ def chat_stream(
406405
token="YOUR_TOKEN",
407406
)
408407
response = client.chat_stream(
409-
message="hello world!",
408+
model="command-a-03-2025",
409+
message="hello!",
410410
)
411411
for chunk in response:
412412
yield chunk
@@ -568,9 +568,8 @@ def chat(
568568
Compatible Deployments: Cohere Platform, Azure, AWS Sagemaker/Bedrock, Private Deployments
569569
570570
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.
571+
Defaults to `"enabled"`.
572+
Citations are enabled by default for models that support it, but can be turned off by setting `"type": "disabled"`.
574573
575574
Compatible Deployments: Cohere Platform, Azure, AWS Sagemaker/Bedrock, Private Deployments
576575
@@ -699,27 +698,15 @@ def chat(
699698
700699
Examples
701700
--------
702-
from cohere import ChatbotMessage, ChatConnector, Client, UserMessage
701+
from cohere import Client
703702
704703
client = Client(
705704
client_name="YOUR_CLIENT_NAME",
706705
token="YOUR_TOKEN",
707706
)
708707
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-
],
708+
model="command-a-03-2025",
709+
message="Tell me about LLMs",
723710
)
724711
"""
725712
_response = self._raw_client.chat(
@@ -1073,7 +1060,7 @@ def embed(
10731060
images : typing.Optional[typing.Sequence[str]]
10741061
An array of image data URIs for the model to embed. Maximum number of images per call is `1`.
10751062
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.
1063+
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.
10771064
10781065
Images are only supported with Embed v3.0 and newer models.
10791066
@@ -1724,9 +1711,8 @@ async def chat_stream(
17241711
Compatible Deployments: Cohere Platform, Azure, AWS Sagemaker/Bedrock, Private Deployments
17251712
17261713
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.
1714+
Defaults to `"enabled"`.
1715+
Citations are enabled by default for models that support it, but can be turned off by setting `"type": "disabled"`.
17301716
17311717
Compatible Deployments: Cohere Platform, Azure, AWS Sagemaker/Bedrock, Private Deployments
17321718
@@ -1867,7 +1853,8 @@ async def chat_stream(
18671853
18681854
async def main() -> None:
18691855
response = await client.chat_stream(
1870-
message="hello world!",
1856+
model="command-a-03-2025",
1857+
message="hello!",
18711858
)
18721859
async for chunk in response:
18731860
yield chunk
@@ -2033,9 +2020,8 @@ async def chat(
20332020
Compatible Deployments: Cohere Platform, Azure, AWS Sagemaker/Bedrock, Private Deployments
20342021
20352022
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.
2023+
Defaults to `"enabled"`.
2024+
Citations are enabled by default for models that support it, but can be turned off by setting `"type": "disabled"`.
20392025
20402026
Compatible Deployments: Cohere Platform, Azure, AWS Sagemaker/Bedrock, Private Deployments
20412027
@@ -2166,7 +2152,7 @@ async def chat(
21662152
--------
21672153
import asyncio
21682154
2169-
from cohere import AsyncClient, ChatbotMessage, ChatConnector, UserMessage
2155+
from cohere import AsyncClient
21702156
21712157
client = AsyncClient(
21722158
client_name="YOUR_CLIENT_NAME",
@@ -2176,20 +2162,8 @@ async def chat(
21762162
21772163
async def main() -> None:
21782164
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-
],
2165+
model="command-a-03-2025",
2166+
message="Tell me about LLMs",
21932167
)
21942168
21952169
@@ -2563,7 +2537,7 @@ async def embed(
25632537
images : typing.Optional[typing.Sequence[str]]
25642538
An array of image data URIs for the model to embed. Maximum number of images per call is `1`.
25652539
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.
2540+
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.
25672541
25682542
Images are only supported with Embed v3.0 and newer models.
25692543

src/cohere/core/client_wrapper.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,10 @@ def __init__(
2222

2323
def get_headers(self) -> typing.Dict[str, str]:
2424
headers: typing.Dict[str, str] = {
25-
"User-Agent": "cohere/5.18.0",
25+
"User-Agent": "cohere/5.19.0",
2626
"X-Fern-Language": "Python",
2727
"X-Fern-SDK-Name": "cohere",
28-
"X-Fern-SDK-Version": "5.18.0",
28+
"X-Fern-SDK-Version": "5.19.0",
2929
}
3030
if self._client_name is not None:
3131
headers["X-Client-Name"] = self._client_name

src/cohere/datasets/client.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ def create(
120120
The name of the uploaded dataset.
121121
122122
type : DatasetType
123-
The dataset type, which is used to validate the data. Valid types are `embed-input`, `reranker-finetune-input`, `single-label-classification-finetune-input`, `chat-finetune-input`, and `multi-label-classification-finetune-input`.
123+
The dataset type, which is used to validate the data. The only valid type is `embed-input` used in conjunction with the Embed Jobs API.
124124
125125
data : core.File
126126
See core.File for more documentation
@@ -384,7 +384,7 @@ async def create(
384384
The name of the uploaded dataset.
385385
386386
type : DatasetType
387-
The dataset type, which is used to validate the data. Valid types are `embed-input`, `reranker-finetune-input`, `single-label-classification-finetune-input`, `chat-finetune-input`, and `multi-label-classification-finetune-input`.
387+
The dataset type, which is used to validate the data. The only valid type is `embed-input` used in conjunction with the Embed Jobs API.
388388
389389
data : core.File
390390
See core.File for more documentation

src/cohere/datasets/raw_client.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,7 @@ def create(
265265
The name of the uploaded dataset.
266266
267267
type : DatasetType
268-
The dataset type, which is used to validate the data. Valid types are `embed-input`, `reranker-finetune-input`, `single-label-classification-finetune-input`, `chat-finetune-input`, and `multi-label-classification-finetune-input`.
268+
The dataset type, which is used to validate the data. The only valid type is `embed-input` used in conjunction with the Embed Jobs API.
269269
270270
data : core.File
271271
See core.File for more documentation
@@ -1207,7 +1207,7 @@ async def create(
12071207
The name of the uploaded dataset.
12081208
12091209
type : DatasetType
1210-
The dataset type, which is used to validate the data. Valid types are `embed-input`, `reranker-finetune-input`, `single-label-classification-finetune-input`, `chat-finetune-input`, and `multi-label-classification-finetune-input`.
1210+
The dataset type, which is used to validate the data. The only valid type is `embed-input` used in conjunction with the Embed Jobs API.
12111211
12121212
data : core.File
12131213
See core.File for more documentation

src/cohere/models/client.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ def list(
6666
request_options: typing.Optional[RequestOptions] = None,
6767
) -> ListModelsResponse:
6868
"""
69-
Returns a list of models available for use. The list contains models from Cohere as well as your fine-tuned models.
69+
Returns a list of models available for use.
7070
7171
Parameters
7272
----------
@@ -175,7 +175,7 @@ async def list(
175175
request_options: typing.Optional[RequestOptions] = None,
176176
) -> ListModelsResponse:
177177
"""
178-
Returns a list of models available for use. The list contains models from Cohere as well as your fine-tuned models.
178+
Returns a list of models available for use.
179179
180180
Parameters
181181
----------

src/cohere/models/raw_client.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ def list(
210210
request_options: typing.Optional[RequestOptions] = None,
211211
) -> HttpResponse[ListModelsResponse]:
212212
"""
213-
Returns a list of models available for use. The list contains models from Cohere as well as your fine-tuned models.
213+
Returns a list of models available for use.
214214
215215
Parameters
216216
----------
@@ -578,7 +578,7 @@ async def list(
578578
request_options: typing.Optional[RequestOptions] = None,
579579
) -> AsyncHttpResponse[ListModelsResponse]:
580580
"""
581-
Returns a list of models available for use. The list contains models from Cohere as well as your fine-tuned models.
581+
Returns a list of models available for use.
582582
583583
Parameters
584584
----------

src/cohere/raw_base_client.py

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -196,9 +196,8 @@ def chat_stream(
196196
Compatible Deployments: Cohere Platform, Azure, AWS Sagemaker/Bedrock, Private Deployments
197197
198198
citation_quality : typing.Optional[ChatStreamRequestCitationQuality]
199-
Defaults to `"accurate"`.
200-
201-
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.
199+
Defaults to `"enabled"`.
200+
Citations are enabled by default for models that support it, but can be turned off by setting `"type": "disabled"`.
202201
203202
Compatible Deployments: Cohere Platform, Azure, AWS Sagemaker/Bedrock, Private Deployments
204203
@@ -663,9 +662,8 @@ def chat(
663662
Compatible Deployments: Cohere Platform, Azure, AWS Sagemaker/Bedrock, Private Deployments
664663
665664
citation_quality : typing.Optional[ChatRequestCitationQuality]
666-
Defaults to `"accurate"`.
667-
668-
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.
665+
Defaults to `"enabled"`.
666+
Citations are enabled by default for models that support it, but can be turned off by setting `"type": "disabled"`.
669667
670668
Compatible Deployments: Cohere Platform, Azure, AWS Sagemaker/Bedrock, Private Deployments
671669
@@ -1607,7 +1605,7 @@ def embed(
16071605
images : typing.Optional[typing.Sequence[str]]
16081606
An array of image data URIs for the model to embed. Maximum number of images per call is `1`.
16091607
1610-
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.
1608+
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.
16111609
16121610
Images are only supported with Embed v3.0 and newer models.
16131611
@@ -3111,9 +3109,8 @@ async def chat_stream(
31113109
Compatible Deployments: Cohere Platform, Azure, AWS Sagemaker/Bedrock, Private Deployments
31123110
31133111
citation_quality : typing.Optional[ChatStreamRequestCitationQuality]
3114-
Defaults to `"accurate"`.
3115-
3116-
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.
3112+
Defaults to `"enabled"`.
3113+
Citations are enabled by default for models that support it, but can be turned off by setting `"type": "disabled"`.
31173114
31183115
Compatible Deployments: Cohere Platform, Azure, AWS Sagemaker/Bedrock, Private Deployments
31193116
@@ -3578,9 +3575,8 @@ async def chat(
35783575
Compatible Deployments: Cohere Platform, Azure, AWS Sagemaker/Bedrock, Private Deployments
35793576
35803577
citation_quality : typing.Optional[ChatRequestCitationQuality]
3581-
Defaults to `"accurate"`.
3582-
3583-
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.
3578+
Defaults to `"enabled"`.
3579+
Citations are enabled by default for models that support it, but can be turned off by setting `"type": "disabled"`.
35843580
35853581
Compatible Deployments: Cohere Platform, Azure, AWS Sagemaker/Bedrock, Private Deployments
35863582
@@ -4522,7 +4518,7 @@ async def embed(
45224518
images : typing.Optional[typing.Sequence[str]]
45234519
An array of image data URIs for the model to embed. Maximum number of images per call is `1`.
45244520
4525-
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.
4521+
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.
45264522
45274523
Images are only supported with Embed v3.0 and newer models.
45284524

src/cohere/types/api_meta.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,11 @@ class ApiMeta(UncheckedBaseModel):
1414
api_version: typing.Optional[ApiMetaApiVersion] = None
1515
billed_units: typing.Optional[ApiMetaBilledUnits] = None
1616
tokens: typing.Optional[ApiMetaTokens] = None
17+
cached_tokens: typing.Optional[float] = pydantic.Field(default=None)
18+
"""
19+
The number of prompt tokens that hit the inference cache.
20+
"""
21+
1722
warnings: typing.Optional[typing.List[str]] = None
1823

1924
if IS_PYDANTIC_V2:

0 commit comments

Comments
 (0)