Skip to content

Commit 2feb9e1

Browse files
committed
SDK regeneration
1 parent f828aad commit 2feb9e1

File tree

11 files changed

+459
-22
lines changed

11 files changed

+459
-22
lines changed

src/cohere/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
ApiMeta,
55
ApiMetaApiVersion,
66
ApiMetaBilledUnits,
7+
AuthTokenType,
78
ChatCitation,
89
ChatCitationGenerationEvent,
910
ChatConnector,
@@ -116,6 +117,7 @@
116117
"ApiMeta",
117118
"ApiMetaApiVersion",
118119
"ApiMetaBilledUnits",
120+
"AuthTokenType",
119121
"BadRequestError",
120122
"ChatCitation",
121123
"ChatCitationGenerationEvent",

src/cohere/client.py

Lines changed: 229 additions & 6 deletions
Large diffs are not rendered by default.

src/cohere/environment.py

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

55

66
class ClientEnvironment(enum.Enum):
7-
PRODUCTION = "https://api.cohere.ai/v1"
7+
PRODUCTION = "https://api.cohere.ai"

src/cohere/resources/connectors/client.py

Lines changed: 127 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
from ...errors.not_found_error import NotFoundError
1515
from ...types.create_connector_o_auth import CreateConnectorOAuth
1616
from ...types.create_connector_response import CreateConnectorResponse
17+
from ...types.create_connector_service_auth import CreateConnectorServiceAuth
1718
from ...types.delete_connector_response import DeleteConnectorResponse
1819
from ...types.get_connector_response import GetConnectorResponse
1920
from ...types.list_connectors_response import ListConnectorsResponse
@@ -81,6 +82,7 @@ def create(
8182
oauth: typing.Optional[CreateConnectorOAuth] = OMIT,
8283
active: typing.Optional[bool] = OMIT,
8384
continue_on_failure: typing.Optional[bool] = OMIT,
85+
service_auth: typing.Optional[CreateConnectorServiceAuth] = OMIT,
8486
) -> CreateConnectorResponse:
8587
"""
8688
Creates a new connector. The connector is tested during registration and will cancel registration when the test is unsuccessful. See ['Creating and Deploying a Connector'](https://docs.cohere.com/docs/creating-and-deploying-a-connector) for more information.
@@ -99,6 +101,29 @@ def create(
99101
- active: typing.Optional[bool]. Whether the connector is active or not.
100102
101103
- continue_on_failure: typing.Optional[bool]. Whether a chat request should continue or not if the request to this connector fails.
104+
105+
- service_auth: typing.Optional[CreateConnectorServiceAuth]. The service to service authentication configuration for the connector. Cannot be specified if oauth is specified.
106+
---
107+
from cohere import (
108+
AuthTokenType,
109+
CreateConnectorOAuth,
110+
CreateConnectorServiceAuth,
111+
)
112+
from cohere.client import Client
113+
114+
client = Client(
115+
client_name="YOUR_CLIENT_NAME",
116+
token="YOUR_TOKEN",
117+
)
118+
client.connectors.create(
119+
name="string",
120+
url="string",
121+
oauth=CreateConnectorOAuth(),
122+
service_auth=CreateConnectorServiceAuth(
123+
type=AuthTokenType.BEARER,
124+
token="string",
125+
),
126+
)
102127
"""
103128
_request: typing.Dict[str, typing.Any] = {"name": name, "url": url}
104129
if description is not OMIT:
@@ -111,6 +136,8 @@ def create(
111136
_request["active"] = active
112137
if continue_on_failure is not OMIT:
113138
_request["continue_on_failure"] = continue_on_failure
139+
if service_auth is not OMIT:
140+
_request["service_auth"] = service_auth
114141
_response = self._client_wrapper.httpx_client.request(
115142
"POST",
116143
urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "v1/connectors"),
@@ -138,6 +165,16 @@ def get(self, id: str) -> GetConnectorResponse:
138165
139166
Parameters:
140167
- id: str. The ID of the connector to retrieve.
168+
---
169+
from cohere.client import Client
170+
171+
client = Client(
172+
client_name="YOUR_CLIENT_NAME",
173+
token="YOUR_TOKEN",
174+
)
175+
client.connectors.get(
176+
id="string",
177+
)
141178
"""
142179
_response = self._client_wrapper.httpx_client.request(
143180
"GET",
@@ -173,7 +210,7 @@ def delete(self, id: str) -> DeleteConnectorResponse:
173210
token="YOUR_TOKEN",
174211
)
175212
client.connectors.delete(
176-
id="id",
213+
id="string",
177214
)
178215
"""
179216
_response = self._client_wrapper.httpx_client.request(
@@ -208,6 +245,7 @@ def update(
208245
oauth: typing.Optional[CreateConnectorOAuth] = OMIT,
209246
active: typing.Optional[bool] = OMIT,
210247
continue_on_failure: typing.Optional[bool] = OMIT,
248+
service_auth: typing.Optional[CreateConnectorServiceAuth] = OMIT,
211249
) -> UpdateConnectorResponse:
212250
"""
213251
Update a connector by ID. Omitted fields will not be updated. See ['Managing your Connector'](https://docs.cohere.com/docs/managing-your-connector) for more information.
@@ -226,6 +264,28 @@ def update(
226264
- active: typing.Optional[bool].
227265
228266
- continue_on_failure: typing.Optional[bool].
267+
268+
- service_auth: typing.Optional[CreateConnectorServiceAuth]. The service to service authentication configuration for the connector. Cannot be specified if oauth is specified.
269+
---
270+
from cohere import (
271+
AuthTokenType,
272+
CreateConnectorOAuth,
273+
CreateConnectorServiceAuth,
274+
)
275+
from cohere.client import Client
276+
277+
client = Client(
278+
client_name="YOUR_CLIENT_NAME",
279+
token="YOUR_TOKEN",
280+
)
281+
client.connectors.update(
282+
id="string",
283+
oauth=CreateConnectorOAuth(),
284+
service_auth=CreateConnectorServiceAuth(
285+
type=AuthTokenType.BEARER,
286+
token="string",
287+
),
288+
)
229289
"""
230290
_request: typing.Dict[str, typing.Any] = {}
231291
if name is not OMIT:
@@ -240,6 +300,8 @@ def update(
240300
_request["active"] = active
241301
if continue_on_failure is not OMIT:
242302
_request["continue_on_failure"] = continue_on_failure
303+
if service_auth is not OMIT:
304+
_request["service_auth"] = service_auth
243305
_response = self._client_wrapper.httpx_client.request(
244306
"PATCH",
245307
urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", f"v1/connectors/{id}"),
@@ -279,7 +341,7 @@ def o_auth_authorize(self, id: str, *, after_token_redirect: typing.Optional[str
279341
token="YOUR_TOKEN",
280342
)
281343
client.connectors.o_auth_authorize(
282-
id="id",
344+
id="string",
283345
)
284346
"""
285347
_response = self._client_wrapper.httpx_client.request(
@@ -356,6 +418,7 @@ async def create(
356418
oauth: typing.Optional[CreateConnectorOAuth] = OMIT,
357419
active: typing.Optional[bool] = OMIT,
358420
continue_on_failure: typing.Optional[bool] = OMIT,
421+
service_auth: typing.Optional[CreateConnectorServiceAuth] = OMIT,
359422
) -> CreateConnectorResponse:
360423
"""
361424
Creates a new connector. The connector is tested during registration and will cancel registration when the test is unsuccessful. See ['Creating and Deploying a Connector'](https://docs.cohere.com/docs/creating-and-deploying-a-connector) for more information.
@@ -374,6 +437,29 @@ async def create(
374437
- active: typing.Optional[bool]. Whether the connector is active or not.
375438
376439
- continue_on_failure: typing.Optional[bool]. Whether a chat request should continue or not if the request to this connector fails.
440+
441+
- service_auth: typing.Optional[CreateConnectorServiceAuth]. The service to service authentication configuration for the connector. Cannot be specified if oauth is specified.
442+
---
443+
from cohere import (
444+
AuthTokenType,
445+
CreateConnectorOAuth,
446+
CreateConnectorServiceAuth,
447+
)
448+
from cohere.client import AsyncClient
449+
450+
client = AsyncClient(
451+
client_name="YOUR_CLIENT_NAME",
452+
token="YOUR_TOKEN",
453+
)
454+
await client.connectors.create(
455+
name="string",
456+
url="string",
457+
oauth=CreateConnectorOAuth(),
458+
service_auth=CreateConnectorServiceAuth(
459+
type=AuthTokenType.BEARER,
460+
token="string",
461+
),
462+
)
377463
"""
378464
_request: typing.Dict[str, typing.Any] = {"name": name, "url": url}
379465
if description is not OMIT:
@@ -386,6 +472,8 @@ async def create(
386472
_request["active"] = active
387473
if continue_on_failure is not OMIT:
388474
_request["continue_on_failure"] = continue_on_failure
475+
if service_auth is not OMIT:
476+
_request["service_auth"] = service_auth
389477
_response = await self._client_wrapper.httpx_client.request(
390478
"POST",
391479
urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "v1/connectors"),
@@ -413,6 +501,16 @@ async def get(self, id: str) -> GetConnectorResponse:
413501
414502
Parameters:
415503
- id: str. The ID of the connector to retrieve.
504+
---
505+
from cohere.client import AsyncClient
506+
507+
client = AsyncClient(
508+
client_name="YOUR_CLIENT_NAME",
509+
token="YOUR_TOKEN",
510+
)
511+
await client.connectors.get(
512+
id="string",
513+
)
416514
"""
417515
_response = await self._client_wrapper.httpx_client.request(
418516
"GET",
@@ -448,7 +546,7 @@ async def delete(self, id: str) -> DeleteConnectorResponse:
448546
token="YOUR_TOKEN",
449547
)
450548
await client.connectors.delete(
451-
id="id",
549+
id="string",
452550
)
453551
"""
454552
_response = await self._client_wrapper.httpx_client.request(
@@ -483,6 +581,7 @@ async def update(
483581
oauth: typing.Optional[CreateConnectorOAuth] = OMIT,
484582
active: typing.Optional[bool] = OMIT,
485583
continue_on_failure: typing.Optional[bool] = OMIT,
584+
service_auth: typing.Optional[CreateConnectorServiceAuth] = OMIT,
486585
) -> UpdateConnectorResponse:
487586
"""
488587
Update a connector by ID. Omitted fields will not be updated. See ['Managing your Connector'](https://docs.cohere.com/docs/managing-your-connector) for more information.
@@ -501,6 +600,28 @@ async def update(
501600
- active: typing.Optional[bool].
502601
503602
- continue_on_failure: typing.Optional[bool].
603+
604+
- service_auth: typing.Optional[CreateConnectorServiceAuth]. The service to service authentication configuration for the connector. Cannot be specified if oauth is specified.
605+
---
606+
from cohere import (
607+
AuthTokenType,
608+
CreateConnectorOAuth,
609+
CreateConnectorServiceAuth,
610+
)
611+
from cohere.client import AsyncClient
612+
613+
client = AsyncClient(
614+
client_name="YOUR_CLIENT_NAME",
615+
token="YOUR_TOKEN",
616+
)
617+
await client.connectors.update(
618+
id="string",
619+
oauth=CreateConnectorOAuth(),
620+
service_auth=CreateConnectorServiceAuth(
621+
type=AuthTokenType.BEARER,
622+
token="string",
623+
),
624+
)
504625
"""
505626
_request: typing.Dict[str, typing.Any] = {}
506627
if name is not OMIT:
@@ -515,6 +636,8 @@ async def update(
515636
_request["active"] = active
516637
if continue_on_failure is not OMIT:
517638
_request["continue_on_failure"] = continue_on_failure
639+
if service_auth is not OMIT:
640+
_request["service_auth"] = service_auth
518641
_response = await self._client_wrapper.httpx_client.request(
519642
"PATCH",
520643
urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", f"v1/connectors/{id}"),
@@ -556,7 +679,7 @@ async def o_auth_authorize(
556679
token="YOUR_TOKEN",
557680
)
558681
await client.connectors.o_auth_authorize(
559-
id="id",
682+
id="string",
560683
)
561684
"""
562685
_response = await self._client_wrapper.httpx_client.request(

src/cohere/resources/datasets/client.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ def get(self, id: str) -> DatasetsGetResponse:
190190
token="YOUR_TOKEN",
191191
)
192192
client.datasets.get(
193-
id="id",
193+
id="string",
194194
)
195195
"""
196196
_response = self._client_wrapper.httpx_client.request(
@@ -221,7 +221,7 @@ def delete(self, id: str) -> typing.Dict[str, typing.Any]:
221221
token="YOUR_TOKEN",
222222
)
223223
client.datasets.delete(
224-
id="id",
224+
id="string",
225225
)
226226
"""
227227
_response = self._client_wrapper.httpx_client.request(
@@ -404,7 +404,7 @@ async def get(self, id: str) -> DatasetsGetResponse:
404404
token="YOUR_TOKEN",
405405
)
406406
await client.datasets.get(
407-
id="id",
407+
id="string",
408408
)
409409
"""
410410
_response = await self._client_wrapper.httpx_client.request(
@@ -435,7 +435,7 @@ async def delete(self, id: str) -> typing.Dict[str, typing.Any]:
435435
token="YOUR_TOKEN",
436436
)
437437
await client.datasets.delete(
438-
id="id",
438+
id="string",
439439
)
440440
"""
441441
_response = await self._client_wrapper.httpx_client.request(

0 commit comments

Comments
 (0)