Skip to content

Commit f828aad

Browse files
committed
SDK regeneration
1 parent 4816a54 commit f828aad

28 files changed

+828
-74
lines changed

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-ai"
3-
version = "5.0.0"
3+
version = "5.0.0a0"
44
description = ""
55
readme = "README.md"
66
authors = []

src/cohere/__init__.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,15 +36,22 @@
3636
CreateConnectorOAuth,
3737
CreateConnectorResponse,
3838
CreateConnectorServiceAuth,
39+
CreateEmbedJobResponse,
3940
Dataset,
4041
DatasetPart,
42+
DatasetType,
43+
DatasetValidationStatus,
4144
DeleteConnectorResponse,
4245
DetectLanguageResponse,
4346
DetectLanguageResponseResultsItem,
4447
DetokenizeResponse,
4548
EmbedByTypeResponse,
4649
EmbedByTypeResponseEmbeddings,
4750
EmbedFloatsResponse,
51+
EmbedInputType,
52+
EmbedJob,
53+
EmbedJobStatus,
54+
EmbedJobTruncate,
4855
EmbedRequestTruncate,
4956
EmbedResponse,
5057
EmbedResponse_EmbeddingsByType,
@@ -66,6 +73,7 @@
6673
Generation,
6774
GetConnectorResponse,
6875
ListConnectorsResponse,
76+
ListEmbedJobResponse,
6977
NonStreamedChatResponse,
7078
OAuthAuthorizeResponse,
7179
RerankRequestDocumentsItem,
@@ -93,12 +101,14 @@
93101
)
94102
from .errors import BadRequestError, ForbiddenError, InternalServerError, NotFoundError
95103
from .resources import (
104+
CreateEmbedJobRequestTruncate,
96105
DatasetsCreateResponse,
97106
DatasetsGetResponse,
98107
DatasetsGetUsageResponse,
99108
DatasetsListResponse,
100109
connectors,
101110
datasets,
111+
embed_jobs,
102112
)
103113
from .environment import ClientEnvironment
104114

@@ -140,8 +150,12 @@
140150
"CreateConnectorOAuth",
141151
"CreateConnectorResponse",
142152
"CreateConnectorServiceAuth",
153+
"CreateEmbedJobRequestTruncate",
154+
"CreateEmbedJobResponse",
143155
"Dataset",
144156
"DatasetPart",
157+
"DatasetType",
158+
"DatasetValidationStatus",
145159
"DatasetsCreateResponse",
146160
"DatasetsGetResponse",
147161
"DatasetsGetUsageResponse",
@@ -153,6 +167,10 @@
153167
"EmbedByTypeResponse",
154168
"EmbedByTypeResponseEmbeddings",
155169
"EmbedFloatsResponse",
170+
"EmbedInputType",
171+
"EmbedJob",
172+
"EmbedJobStatus",
173+
"EmbedJobTruncate",
156174
"EmbedRequestTruncate",
157175
"EmbedResponse",
158176
"EmbedResponse_EmbeddingsByType",
@@ -176,6 +194,7 @@
176194
"GetConnectorResponse",
177195
"InternalServerError",
178196
"ListConnectorsResponse",
197+
"ListEmbedJobResponse",
179198
"NonStreamedChatResponse",
180199
"NotFoundError",
181200
"OAuthAuthorizeResponse",
@@ -203,4 +222,5 @@
203222
"UpdateConnectorResponse",
204223
"connectors",
205224
"datasets",
225+
"embed_jobs",
206226
]

src/cohere/client.py

Lines changed: 59 additions & 30 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
@@ -21,7 +21,7 @@ def get_headers(self) -> typing.Dict[str, str]:
2121
headers: typing.Dict[str, str] = {
2222
"X-Fern-Language": "Python",
2323
"X-Fern-SDK-Name": "cohere-ai",
24-
"X-Fern-SDK-Version": "5.0.0",
24+
"X-Fern-SDK-Version": "5.0.0a0",
2525
}
2626
if self._client_name is not None:
2727
headers["X-Client-Name"] = self._client_name

src/cohere/resources/__init__.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,16 @@
11
# This file was auto-generated by Fern from our API Definition.
22

3-
from . import connectors, datasets
3+
from . import connectors, datasets, embed_jobs
44
from .datasets import DatasetsCreateResponse, DatasetsGetResponse, DatasetsGetUsageResponse, DatasetsListResponse
5+
from .embed_jobs import CreateEmbedJobRequestTruncate
56

67
__all__ = [
8+
"CreateEmbedJobRequestTruncate",
79
"DatasetsCreateResponse",
810
"DatasetsGetResponse",
911
"DatasetsGetUsageResponse",
1012
"DatasetsListResponse",
1113
"connectors",
1214
"datasets",
15+
"embed_jobs",
1316
]

src/cohere/resources/connectors/client.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -263,12 +263,14 @@ def update(
263263
raise ApiError(status_code=_response.status_code, body=_response.text)
264264
raise ApiError(status_code=_response.status_code, body=_response_json)
265265

266-
def o_auth_authorize(self, id: str) -> OAuthAuthorizeResponse:
266+
def o_auth_authorize(self, id: str, *, after_token_redirect: typing.Optional[str] = None) -> OAuthAuthorizeResponse:
267267
"""
268268
Authorize the connector with the given ID for the connector oauth app. See ['Connector Authentication'](https://docs.cohere.com/docs/connector-authentication) for more information.
269269
270270
Parameters:
271271
- id: str. The ID of the connector to authorize.
272+
273+
- after_token_redirect: typing.Optional[str]. The URL to redirect to after the connector has been authorized.
272274
---
273275
from cohere.client import Client
274276
@@ -283,6 +285,7 @@ def o_auth_authorize(self, id: str) -> OAuthAuthorizeResponse:
283285
_response = self._client_wrapper.httpx_client.request(
284286
"POST",
285287
urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", f"v1/connectors/{id}/oauth/authorize"),
288+
params=remove_none_from_dict({"after_token_redirect": after_token_redirect}),
286289
headers=self._client_wrapper.get_headers(),
287290
timeout=60,
288291
)
@@ -535,12 +538,16 @@ async def update(
535538
raise ApiError(status_code=_response.status_code, body=_response.text)
536539
raise ApiError(status_code=_response.status_code, body=_response_json)
537540

538-
async def o_auth_authorize(self, id: str) -> OAuthAuthorizeResponse:
541+
async def o_auth_authorize(
542+
self, id: str, *, after_token_redirect: typing.Optional[str] = None
543+
) -> OAuthAuthorizeResponse:
539544
"""
540545
Authorize the connector with the given ID for the connector oauth app. See ['Connector Authentication'](https://docs.cohere.com/docs/connector-authentication) for more information.
541546
542547
Parameters:
543548
- id: str. The ID of the connector to authorize.
549+
550+
- after_token_redirect: typing.Optional[str]. The URL to redirect to after the connector has been authorized.
544551
---
545552
from cohere.client import AsyncClient
546553
@@ -555,6 +562,7 @@ async def o_auth_authorize(self, id: str) -> OAuthAuthorizeResponse:
555562
_response = await self._client_wrapper.httpx_client.request(
556563
"POST",
557564
urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", f"v1/connectors/{id}/oauth/authorize"),
565+
params=remove_none_from_dict({"after_token_redirect": after_token_redirect}),
558566
headers=self._client_wrapper.get_headers(),
559567
timeout=60,
560568
)

src/cohere/resources/datasets/client.py

Lines changed: 29 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
from ...core.datetime_utils import serialize_datetime
1111
from ...core.jsonable_encoder import jsonable_encoder
1212
from ...core.remove_none_from_dict import remove_none_from_dict
13+
from ...types.dataset_type import DatasetType
1314
from .types.datasets_create_response import DatasetsCreateResponse
1415
from .types.datasets_get_response import DatasetsGetResponse
1516
from .types.datasets_get_usage_response import DatasetsGetUsageResponse
@@ -86,8 +87,11 @@ def create(
8687
self,
8788
*,
8889
name: typing.Optional[str] = None,
89-
type: typing.Optional[str] = None,
90+
type: typing.Optional[DatasetType] = None,
9091
keep_original_file: typing.Optional[bool] = None,
92+
skip_malformed_input: typing.Optional[bool] = None,
93+
keep_fields: typing.Optional[typing.Union[str, typing.List[str]]] = None,
94+
optional_fields: typing.Optional[typing.Union[str, typing.List[str]]] = None,
9195
text_separator: typing.Optional[str] = None,
9296
csv_delimiter: typing.Optional[str] = None,
9397
data: typing.IO,
@@ -99,10 +103,16 @@ def create(
99103
Parameters:
100104
- name: typing.Optional[str]. The name of the uploaded dataset.
101105
102-
- type: typing.Optional[str]. The dataset type, which is used to validate the data.
106+
- type: typing.Optional[DatasetType]. The dataset type, which is used to validate the data.
103107
104108
- keep_original_file: typing.Optional[bool]. Indicates if the original file should be stored.
105109
110+
- skip_malformed_input: typing.Optional[bool]. Indicates whether rows with malformed input should be dropped (instead of failing the validation check). Dropped rows will be returned in the warnings field.
111+
112+
- keep_fields: typing.Optional[typing.Union[str, typing.List[str]]]. List of names of fields that will be persisted in the Dataset. By default the Dataset will retain only the required fields indicated in the [schema for the corresponding Dataset type](https://docs.cohere.com/docs/datasets#dataset-types). For example, datasets of type `embed-input` will drop all fields other than the required `text` field. If any of the fields in `keep_fields` are missing from the uploaded file, Dataset validation will fail.
113+
114+
- optional_fields: typing.Optional[typing.Union[str, typing.List[str]]]. List of names of fields that will be persisted in the Dataset. By default the Dataset will retain only the required fields indicated in the [schema for the corresponding Dataset type](https://docs.cohere.com/docs/datasets#dataset-types). For example, Datasets of type `embed-input` will drop all fields other than the required `text` field. If any of the fields in `optional_fields` are missing from the uploaded file, Dataset validation will pass.
115+
106116
- text_separator: typing.Optional[str]. Raw .txt uploads will be split into entries using the text_separator value.
107117
108118
- csv_delimiter: typing.Optional[str]. The delimiter used for .csv uploads.
@@ -119,6 +129,9 @@ def create(
119129
"name": name,
120130
"type": type,
121131
"keep_original_file": keep_original_file,
132+
"skip_malformed_input": skip_malformed_input,
133+
"keep_fields": keep_fields,
134+
"optional_fields": optional_fields,
122135
"text_separator": text_separator,
123136
"csv_delimiter": csv_delimiter,
124137
}
@@ -288,8 +301,11 @@ async def create(
288301
self,
289302
*,
290303
name: typing.Optional[str] = None,
291-
type: typing.Optional[str] = None,
304+
type: typing.Optional[DatasetType] = None,
292305
keep_original_file: typing.Optional[bool] = None,
306+
skip_malformed_input: typing.Optional[bool] = None,
307+
keep_fields: typing.Optional[typing.Union[str, typing.List[str]]] = None,
308+
optional_fields: typing.Optional[typing.Union[str, typing.List[str]]] = None,
293309
text_separator: typing.Optional[str] = None,
294310
csv_delimiter: typing.Optional[str] = None,
295311
data: typing.IO,
@@ -301,10 +317,16 @@ async def create(
301317
Parameters:
302318
- name: typing.Optional[str]. The name of the uploaded dataset.
303319
304-
- type: typing.Optional[str]. The dataset type, which is used to validate the data.
320+
- type: typing.Optional[DatasetType]. The dataset type, which is used to validate the data.
305321
306322
- keep_original_file: typing.Optional[bool]. Indicates if the original file should be stored.
307323
324+
- skip_malformed_input: typing.Optional[bool]. Indicates whether rows with malformed input should be dropped (instead of failing the validation check). Dropped rows will be returned in the warnings field.
325+
326+
- keep_fields: typing.Optional[typing.Union[str, typing.List[str]]]. List of names of fields that will be persisted in the Dataset. By default the Dataset will retain only the required fields indicated in the [schema for the corresponding Dataset type](https://docs.cohere.com/docs/datasets#dataset-types). For example, datasets of type `embed-input` will drop all fields other than the required `text` field. If any of the fields in `keep_fields` are missing from the uploaded file, Dataset validation will fail.
327+
328+
- optional_fields: typing.Optional[typing.Union[str, typing.List[str]]]. List of names of fields that will be persisted in the Dataset. By default the Dataset will retain only the required fields indicated in the [schema for the corresponding Dataset type](https://docs.cohere.com/docs/datasets#dataset-types). For example, Datasets of type `embed-input` will drop all fields other than the required `text` field. If any of the fields in `optional_fields` are missing from the uploaded file, Dataset validation will pass.
329+
308330
- text_separator: typing.Optional[str]. Raw .txt uploads will be split into entries using the text_separator value.
309331
310332
- csv_delimiter: typing.Optional[str]. The delimiter used for .csv uploads.
@@ -321,6 +343,9 @@ async def create(
321343
"name": name,
322344
"type": type,
323345
"keep_original_file": keep_original_file,
346+
"skip_malformed_input": skip_malformed_input,
347+
"keep_fields": keep_fields,
348+
"optional_fields": optional_fields,
324349
"text_separator": text_separator,
325350
"csv_delimiter": csv_delimiter,
326351
}

src/cohere/resources/datasets/types/datasets_get_usage_response.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
class DatasetsGetUsageResponse(pydantic.BaseModel):
1515
organization_usage: typing.Optional[str] = pydantic.Field(
16-
alias="organizationUsage", description="The total number of bytes used by the organization."
16+
description="The total number of bytes used by the organization."
1717
)
1818

1919
def json(self, **kwargs: typing.Any) -> str:
@@ -27,5 +27,4 @@ def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]:
2727
class Config:
2828
frozen = True
2929
smart_union = True
30-
allow_population_by_field_name = True
3130
json_encoders = {dt.datetime: serialize_datetime}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# This file was auto-generated by Fern from our API Definition.
2+
3+
from .types import CreateEmbedJobRequestTruncate
4+
5+
__all__ = ["CreateEmbedJobRequestTruncate"]

0 commit comments

Comments
 (0)