Skip to content

Commit e10ef08

Browse files
🌿 Fern Regeneration -- July 16, 2024 (#540)
Co-authored-by: fern-api <115122769+fern-api[bot]@users.noreply.github.com>
1 parent 11707a1 commit e10ef08

18 files changed

+471
-274
lines changed

poetry.lock

Lines changed: 160 additions & 147 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
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "cohere"
3-
version = "5.5.8"
3+
version = "5.6.0"
44
description = ""
55
readme = "README.md"
66
authors = []

src/cohere/__init__.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
ChatRequestCitationQuality,
1616
ChatRequestConnectorsSearchOptions,
1717
ChatRequestPromptTruncation,
18+
ChatRequestResponseFormat,
19+
ChatRequestResponseFormatType,
1820
ChatSearchQueriesGenerationEvent,
1921
ChatSearchQuery,
2022
ChatSearchResult,
@@ -26,6 +28,8 @@
2628
ChatStreamRequestCitationQuality,
2729
ChatStreamRequestConnectorsSearchOptions,
2830
ChatStreamRequestPromptTruncation,
31+
ChatStreamRequestResponseFormat,
32+
ChatStreamRequestResponseFormatType,
2933
ChatStreamStartEvent,
3034
ChatTextGenerationEvent,
3135
ChatToolCallsChunkEvent,
@@ -100,8 +104,8 @@
100104
NotImplementedErrorBody,
101105
OAuthAuthorizeResponse,
102106
ParseInfo,
107+
RerankDocument,
103108
RerankRequestDocumentsItem,
104-
RerankRequestDocumentsItemText,
105109
RerankResponse,
106110
RerankResponseResultsItem,
107111
RerankResponseResultsItemDocument,
@@ -181,6 +185,8 @@
181185
"ChatRequestCitationQuality",
182186
"ChatRequestConnectorsSearchOptions",
183187
"ChatRequestPromptTruncation",
188+
"ChatRequestResponseFormat",
189+
"ChatRequestResponseFormatType",
184190
"ChatSearchQueriesGenerationEvent",
185191
"ChatSearchQuery",
186192
"ChatSearchResult",
@@ -192,6 +198,8 @@
192198
"ChatStreamRequestCitationQuality",
193199
"ChatStreamRequestConnectorsSearchOptions",
194200
"ChatStreamRequestPromptTruncation",
201+
"ChatStreamRequestResponseFormat",
202+
"ChatStreamRequestResponseFormatType",
195203
"ChatStreamStartEvent",
196204
"ChatTextGenerationEvent",
197205
"ChatToolCallsChunkEvent",
@@ -280,8 +288,8 @@
280288
"NotImplementedErrorBody",
281289
"OAuthAuthorizeResponse",
282290
"ParseInfo",
291+
"RerankDocument",
283292
"RerankRequestDocumentsItem",
284-
"RerankRequestDocumentsItemText",
285293
"RerankResponse",
286294
"RerankResponseResultsItem",
287295
"RerankResponseResultsItemDocument",

src/cohere/base_client.py

Lines changed: 140 additions & 80 deletions
Large diffs are not rendered by default.

src/cohere/core/client_wrapper.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ def get_headers(self) -> typing.Dict[str, str]:
2525
headers: typing.Dict[str, str] = {
2626
"X-Fern-Language": "Python",
2727
"X-Fern-SDK-Name": "cohere",
28-
"X-Fern-SDK-Version": "5.5.8",
28+
"X-Fern-SDK-Version": "5.6.0",
2929
}
3030
if self._client_name is not None:
3131
headers["X-Client-Name"] = self._client_name

src/cohere/models/client.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ def get(self, model: str, *, request_options: typing.Optional[RequestOptions] =
5858
token="YOUR_TOKEN",
5959
)
6060
client.models.get(
61-
model="model",
61+
model="command-r",
6262
)
6363
"""
6464
_response = self._client_wrapper.httpx_client.request(
@@ -254,7 +254,7 @@ async def get(self, model: str, *, request_options: typing.Optional[RequestOptio
254254
token="YOUR_TOKEN",
255255
)
256256
await client.models.get(
257-
model="model",
257+
model="command-r",
258258
)
259259
"""
260260
_response = await self._client_wrapper.httpx_client.request(

src/cohere/types/__init__.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
from .chat_request_citation_quality import ChatRequestCitationQuality
1515
from .chat_request_connectors_search_options import ChatRequestConnectorsSearchOptions
1616
from .chat_request_prompt_truncation import ChatRequestPromptTruncation
17+
from .chat_request_response_format import ChatRequestResponseFormat
18+
from .chat_request_response_format_type import ChatRequestResponseFormatType
1719
from .chat_search_queries_generation_event import ChatSearchQueriesGenerationEvent
1820
from .chat_search_query import ChatSearchQuery
1921
from .chat_search_result import ChatSearchResult
@@ -25,6 +27,8 @@
2527
from .chat_stream_request_citation_quality import ChatStreamRequestCitationQuality
2628
from .chat_stream_request_connectors_search_options import ChatStreamRequestConnectorsSearchOptions
2729
from .chat_stream_request_prompt_truncation import ChatStreamRequestPromptTruncation
30+
from .chat_stream_request_response_format import ChatStreamRequestResponseFormat
31+
from .chat_stream_request_response_format_type import ChatStreamRequestResponseFormatType
2832
from .chat_stream_start_event import ChatStreamStartEvent
2933
from .chat_text_generation_event import ChatTextGenerationEvent
3034
from .chat_tool_calls_chunk_event import ChatToolCallsChunkEvent
@@ -97,8 +101,8 @@
97101
from .not_implemented_error_body import NotImplementedErrorBody
98102
from .o_auth_authorize_response import OAuthAuthorizeResponse
99103
from .parse_info import ParseInfo
104+
from .rerank_document import RerankDocument
100105
from .rerank_request_documents_item import RerankRequestDocumentsItem
101-
from .rerank_request_documents_item_text import RerankRequestDocumentsItemText
102106
from .rerank_response import RerankResponse
103107
from .rerank_response_results_item import RerankResponseResultsItem
104108
from .rerank_response_results_item_document import RerankResponseResultsItemDocument
@@ -147,6 +151,8 @@
147151
"ChatRequestCitationQuality",
148152
"ChatRequestConnectorsSearchOptions",
149153
"ChatRequestPromptTruncation",
154+
"ChatRequestResponseFormat",
155+
"ChatRequestResponseFormatType",
150156
"ChatSearchQueriesGenerationEvent",
151157
"ChatSearchQuery",
152158
"ChatSearchResult",
@@ -158,6 +164,8 @@
158164
"ChatStreamRequestCitationQuality",
159165
"ChatStreamRequestConnectorsSearchOptions",
160166
"ChatStreamRequestPromptTruncation",
167+
"ChatStreamRequestResponseFormat",
168+
"ChatStreamRequestResponseFormatType",
161169
"ChatStreamStartEvent",
162170
"ChatTextGenerationEvent",
163171
"ChatToolCallsChunkEvent",
@@ -232,8 +240,8 @@
232240
"NotImplementedErrorBody",
233241
"OAuthAuthorizeResponse",
234242
"ParseInfo",
243+
"RerankDocument",
235244
"RerankRequestDocumentsItem",
236-
"RerankRequestDocumentsItemText",
237245
"RerankResponse",
238246
"RerankResponseResultsItem",
239247
"RerankResponseResultsItemDocument",

src/cohere/types/chat_request_citation_quality.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22

33
import typing
44

5-
ChatRequestCitationQuality = typing.Union[typing.Literal["fast", "accurate"], typing.Any]
5+
ChatRequestCitationQuality = typing.Union[typing.Literal["fast", "accurate", "off"], typing.Any]

src/cohere/types/chat_request_connectors_search_options.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class ChatRequestConnectorsSearchOptions(UncheckedBaseModel):
1919
deterministically, such that repeated requests with the same
2020
seed and parameters should return the same result. However,
2121
determinism cannot be totally guaranteed.
22-
Compatible Deployments: Cohere Platform, Azure, AWS Sagemaker, Private Deployments
22+
Compatible Deployments: Cohere Platform, Azure, AWS Sagemaker/Bedrock, Private Deployments
2323
"""
2424

2525
def json(self, **kwargs: typing.Any) -> str:
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
# This file was auto-generated by Fern from our API Definition.
2+
3+
import datetime as dt
4+
import typing
5+
6+
from ..core.datetime_utils import serialize_datetime
7+
from ..core.pydantic_utilities import deep_union_pydantic_dicts, pydantic_v1
8+
from ..core.unchecked_base_model import UncheckedBaseModel
9+
from .chat_request_response_format_type import ChatRequestResponseFormatType
10+
11+
12+
class ChatRequestResponseFormat(UncheckedBaseModel):
13+
"""
14+
Configuration for forcing the model output to adhere to the specified format. Supported on [Command R](https://docs.cohere.com/docs/command-r), [Command R+](https://docs.cohere.com/docs/command-r-plus) and newer models.
15+
16+
The model can be forced into outputting JSON objects (with up to 5 levels of nesting) by setting `{ "type": "json_object" }`.
17+
18+
A [JSON Schema](https://json-schema.org/) can optionally be provided, to ensure a specific structure.
19+
20+
**Note**: When using `{ "type": "json_object" }` your `message` should always explicitly instruct the model to generate a JSON (eg: _"Generate a JSON ..."_) . Otherwise the model may end up getting stuck generating an infinite stream of characters and eventually run out of context length.
21+
"""
22+
23+
type: ChatRequestResponseFormatType = pydantic_v1.Field()
24+
"""
25+
When set to JSON, the model will return valid JSON. Note that running out of tokens will result in an invalid JSON.
26+
"""
27+
28+
schema_: typing.Optional[typing.Dict[str, typing.Any]] = pydantic_v1.Field(alias="schema", default=None)
29+
"""
30+
[BETA] A JSON schema object that the output will adhere to. There are some restrictions we have on the schema, refer to [our guide]() for more information.
31+
Example (required name and age object):
32+
33+
```json
34+
{
35+
"type": "object",
36+
"properties": {
37+
"name": { "type": "string" },
38+
"age": { "type": "integer" }
39+
},
40+
"required": ["name", "age"]
41+
}
42+
```
43+
"""
44+
45+
def json(self, **kwargs: typing.Any) -> str:
46+
kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs}
47+
return super().json(**kwargs_with_defaults)
48+
49+
def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]:
50+
kwargs_with_defaults_exclude_unset: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs}
51+
kwargs_with_defaults_exclude_none: typing.Any = {"by_alias": True, "exclude_none": True, **kwargs}
52+
53+
return deep_union_pydantic_dicts(
54+
super().dict(**kwargs_with_defaults_exclude_unset), super().dict(**kwargs_with_defaults_exclude_none)
55+
)
56+
57+
class Config:
58+
frozen = True
59+
smart_union = True
60+
allow_population_by_field_name = True
61+
populate_by_name = True
62+
extra = pydantic_v1.Extra.allow
63+
json_encoders = {dt.datetime: serialize_datetime}

0 commit comments

Comments
 (0)