Skip to content

Commit d54defd

Browse files
feat(api): update via SDK Studio (#49)
1 parent b49c8a0 commit d54defd

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+3813
-205
lines changed

.stats.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
configured_endpoints: 35
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/contextual-ai%2Fsunrise-d79ccb778953ad5c2ae4b99115429c8b3f68b3b23d9b6d90b1b40393f11a4383.yml
1+
configured_endpoints: 46
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/contextual-ai%2Fsunrise-5298551c424bb999f258bdd6c311e96c80c70701ad59bbce19b46c788ee13bd4.yml

api.md

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ Methods:
3838
- <code title="delete /datastores/{datastore_id}/documents/{document_id}">client.datastores.documents.<a href="./src/contextual/resources/datastores/documents.py">delete</a>(document_id, \*, datastore_id) -> <a href="./src/contextual/types/datastores/document_delete_response.py">object</a></code>
3939
- <code title="post /datastores/{datastore_id}/documents">client.datastores.documents.<a href="./src/contextual/resources/datastores/documents.py">ingest</a>(datastore_id, \*\*<a href="src/contextual/types/datastores/document_ingest_params.py">params</a>) -> <a href="./src/contextual/types/datastores/ingestion_response.py">IngestionResponse</a></code>
4040
- <code title="get /datastores/{datastore_id}/documents/{document_id}/metadata">client.datastores.documents.<a href="./src/contextual/resources/datastores/documents.py">metadata</a>(document_id, \*, datastore_id) -> <a href="./src/contextual/types/datastores/document_metadata.py">DocumentMetadata</a></code>
41+
- <code title="post /datastores/{datastore_id}/documents/{document_id}/metadata">client.datastores.documents.<a href="./src/contextual/resources/datastores/documents.py">set_metadata</a>(document_id, \*, datastore_id, \*\*<a href="src/contextual/types/datastores/document_set_metadata_params.py">params</a>) -> <a href="./src/contextual/types/datastores/document_metadata.py">DocumentMetadata</a></code>
4142

4243
# Agents
4344

@@ -120,6 +121,23 @@ Types:
120121
from contextual.types.agents import CreateDatasetResponse, DatasetMetadata, ListDatasetsResponse
121122
```
122123

124+
### Tune
125+
126+
Types:
127+
128+
```python
129+
from contextual.types.agents.datasets import TuneDeleteResponse
130+
```
131+
132+
Methods:
133+
134+
- <code title="post /agents/{agent_id}/datasets/tune">client.agents.datasets.tune.<a href="./src/contextual/resources/agents/datasets/tune.py">create</a>(agent_id, \*\*<a href="src/contextual/types/agents/datasets/tune_create_params.py">params</a>) -> <a href="./src/contextual/types/agents/create_dataset_response.py">CreateDatasetResponse</a></code>
135+
- <code title="get /agents/{agent_id}/datasets/tune/{dataset_name}">client.agents.datasets.tune.<a href="./src/contextual/resources/agents/datasets/tune.py">retrieve</a>(dataset_name, \*, agent_id, \*\*<a href="src/contextual/types/agents/datasets/tune_retrieve_params.py">params</a>) -> BinaryAPIResponse</code>
136+
- <code title="put /agents/{agent_id}/datasets/tune/{dataset_name}">client.agents.datasets.tune.<a href="./src/contextual/resources/agents/datasets/tune.py">update</a>(dataset_name, \*, agent_id, \*\*<a href="src/contextual/types/agents/datasets/tune_update_params.py">params</a>) -> <a href="./src/contextual/types/agents/create_dataset_response.py">CreateDatasetResponse</a></code>
137+
- <code title="get /agents/{agent_id}/datasets/tune">client.agents.datasets.tune.<a href="./src/contextual/resources/agents/datasets/tune.py">list</a>(agent_id, \*\*<a href="src/contextual/types/agents/datasets/tune_list_params.py">params</a>) -> <a href="./src/contextual/types/agents/list_datasets_response.py">ListDatasetsResponse</a></code>
138+
- <code title="delete /agents/{agent_id}/datasets/tune/{dataset_name}">client.agents.datasets.tune.<a href="./src/contextual/resources/agents/datasets/tune.py">delete</a>(dataset_name, \*, agent_id) -> <a href="./src/contextual/types/agents/datasets/tune_delete_response.py">object</a></code>
139+
- <code title="get /agents/{agent_id}/datasets/tune/{dataset_name}/metadata">client.agents.datasets.tune.<a href="./src/contextual/resources/agents/datasets/tune.py">metadata</a>(dataset_name, \*, agent_id, \*\*<a href="src/contextual/types/agents/datasets/tune_metadata_params.py">params</a>) -> <a href="./src/contextual/types/agents/dataset_metadata.py">DatasetMetadata</a></code>
140+
123141
### Evaluate
124142

125143
Types:
@@ -175,6 +193,27 @@ Methods:
175193

176194
- <code title="get /agents/{agent_id}/tune/models">client.agents.tune.models.<a href="./src/contextual/resources/agents/tune/models.py">list</a>(agent_id) -> <a href="./src/contextual/types/agents/tune/list_tune_models_response.py">ListTuneModelsResponse</a></code>
177195

196+
# Users
197+
198+
Types:
199+
200+
```python
201+
from contextual.types import (
202+
InviteUsersResponse,
203+
ListUsersResponse,
204+
NewUser,
205+
UserUpdateResponse,
206+
UserDeactivateResponse,
207+
)
208+
```
209+
210+
Methods:
211+
212+
- <code title="put /users">client.users.<a href="./src/contextual/resources/users.py">update</a>(\*\*<a href="src/contextual/types/user_update_params.py">params</a>) -> <a href="./src/contextual/types/user_update_response.py">object</a></code>
213+
- <code title="get /users">client.users.<a href="./src/contextual/resources/users.py">list</a>(\*\*<a href="src/contextual/types/user_list_params.py">params</a>) -> <a href="./src/contextual/types/list_users_response.py">ListUsersResponse</a></code>
214+
- <code title="delete /users">client.users.<a href="./src/contextual/resources/users.py">deactivate</a>(\*\*<a href="src/contextual/types/user_deactivate_params.py">params</a>) -> <a href="./src/contextual/types/user_deactivate_response.py">object</a></code>
215+
- <code title="post /users">client.users.<a href="./src/contextual/resources/users.py">invite</a>(\*\*<a href="src/contextual/types/user_invite_params.py">params</a>) -> <a href="./src/contextual/types/invite_users_response.py">InviteUsersResponse</a></code>
216+
178217
# LMUnit
179218

180219
Types:

src/contextual/_client.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
get_async_library,
2525
)
2626
from ._version import __version__
27-
from .resources import lmunit, rerank, generate
27+
from .resources import users, lmunit, rerank, generate
2828
from ._streaming import Stream as Stream, AsyncStream as AsyncStream
2929
from ._exceptions import APIStatusError, ContextualAIError
3030
from ._base_client import (
@@ -50,6 +50,7 @@
5050
class ContextualAI(SyncAPIClient):
5151
datastores: datastores.DatastoresResource
5252
agents: agents.AgentsResource
53+
users: users.UsersResource
5354
lmunit: lmunit.LMUnitResource
5455
rerank: rerank.RerankResource
5556
generate: generate.GenerateResource
@@ -118,6 +119,7 @@ def __init__(
118119

119120
self.datastores = datastores.DatastoresResource(self)
120121
self.agents = agents.AgentsResource(self)
122+
self.users = users.UsersResource(self)
121123
self.lmunit = lmunit.LMUnitResource(self)
122124
self.rerank = rerank.RerankResource(self)
123125
self.generate = generate.GenerateResource(self)
@@ -235,6 +237,7 @@ def _make_status_error(
235237
class AsyncContextualAI(AsyncAPIClient):
236238
datastores: datastores.AsyncDatastoresResource
237239
agents: agents.AsyncAgentsResource
240+
users: users.AsyncUsersResource
238241
lmunit: lmunit.AsyncLMUnitResource
239242
rerank: rerank.AsyncRerankResource
240243
generate: generate.AsyncGenerateResource
@@ -303,6 +306,7 @@ def __init__(
303306

304307
self.datastores = datastores.AsyncDatastoresResource(self)
305308
self.agents = agents.AsyncAgentsResource(self)
309+
self.users = users.AsyncUsersResource(self)
306310
self.lmunit = lmunit.AsyncLMUnitResource(self)
307311
self.rerank = rerank.AsyncRerankResource(self)
308312
self.generate = generate.AsyncGenerateResource(self)
@@ -421,6 +425,7 @@ class ContextualAIWithRawResponse:
421425
def __init__(self, client: ContextualAI) -> None:
422426
self.datastores = datastores.DatastoresResourceWithRawResponse(client.datastores)
423427
self.agents = agents.AgentsResourceWithRawResponse(client.agents)
428+
self.users = users.UsersResourceWithRawResponse(client.users)
424429
self.lmunit = lmunit.LMUnitResourceWithRawResponse(client.lmunit)
425430
self.rerank = rerank.RerankResourceWithRawResponse(client.rerank)
426431
self.generate = generate.GenerateResourceWithRawResponse(client.generate)
@@ -430,6 +435,7 @@ class AsyncContextualAIWithRawResponse:
430435
def __init__(self, client: AsyncContextualAI) -> None:
431436
self.datastores = datastores.AsyncDatastoresResourceWithRawResponse(client.datastores)
432437
self.agents = agents.AsyncAgentsResourceWithRawResponse(client.agents)
438+
self.users = users.AsyncUsersResourceWithRawResponse(client.users)
433439
self.lmunit = lmunit.AsyncLMUnitResourceWithRawResponse(client.lmunit)
434440
self.rerank = rerank.AsyncRerankResourceWithRawResponse(client.rerank)
435441
self.generate = generate.AsyncGenerateResourceWithRawResponse(client.generate)
@@ -439,6 +445,7 @@ class ContextualAIWithStreamedResponse:
439445
def __init__(self, client: ContextualAI) -> None:
440446
self.datastores = datastores.DatastoresResourceWithStreamingResponse(client.datastores)
441447
self.agents = agents.AgentsResourceWithStreamingResponse(client.agents)
448+
self.users = users.UsersResourceWithStreamingResponse(client.users)
442449
self.lmunit = lmunit.LMUnitResourceWithStreamingResponse(client.lmunit)
443450
self.rerank = rerank.RerankResourceWithStreamingResponse(client.rerank)
444451
self.generate = generate.GenerateResourceWithStreamingResponse(client.generate)
@@ -448,6 +455,7 @@ class AsyncContextualAIWithStreamedResponse:
448455
def __init__(self, client: AsyncContextualAI) -> None:
449456
self.datastores = datastores.AsyncDatastoresResourceWithStreamingResponse(client.datastores)
450457
self.agents = agents.AsyncAgentsResourceWithStreamingResponse(client.agents)
458+
self.users = users.AsyncUsersResourceWithStreamingResponse(client.users)
451459
self.lmunit = lmunit.AsyncLMUnitResourceWithStreamingResponse(client.lmunit)
452460
self.rerank = rerank.AsyncRerankResourceWithStreamingResponse(client.rerank)
453461
self.generate = generate.AsyncGenerateResourceWithStreamingResponse(client.generate)

src/contextual/resources/__init__.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
22

3+
from .users import (
4+
UsersResource,
5+
AsyncUsersResource,
6+
UsersResourceWithRawResponse,
7+
AsyncUsersResourceWithRawResponse,
8+
UsersResourceWithStreamingResponse,
9+
AsyncUsersResourceWithStreamingResponse,
10+
)
311
from .agents import (
412
AgentsResource,
513
AsyncAgentsResource,
@@ -54,6 +62,12 @@
5462
"AsyncAgentsResourceWithRawResponse",
5563
"AgentsResourceWithStreamingResponse",
5664
"AsyncAgentsResourceWithStreamingResponse",
65+
"UsersResource",
66+
"AsyncUsersResource",
67+
"UsersResourceWithRawResponse",
68+
"AsyncUsersResourceWithRawResponse",
69+
"UsersResourceWithStreamingResponse",
70+
"AsyncUsersResourceWithStreamingResponse",
5771
"LMUnitResource",
5872
"AsyncLMUnitResource",
5973
"LMUnitResourceWithRawResponse",

src/contextual/resources/agents/agents.py

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ def create(
101101
self,
102102
*,
103103
name: str,
104+
agent_configs: agent_create_params.AgentConfigs | NotGiven = NOT_GIVEN,
104105
datastore_ids: List[str] | NotGiven = NOT_GIVEN,
105106
description: str | NotGiven = NOT_GIVEN,
106107
suggested_queries: List[str] | NotGiven = NOT_GIVEN,
@@ -128,8 +129,9 @@ def create(
128129
Args:
129130
name: Name of the agent
130131
131-
datastore_ids: The IDs of the datastore associated with the agent. Leave empty to automatically
132-
create a new datastore.
132+
agent_configs: The following advanced parameters are experimental and subject to change.
133+
134+
datastore_ids: The IDs of the datastore to associate with this agent.
133135
134136
description: Description of the agent
135137
@@ -154,6 +156,7 @@ def create(
154156
body=maybe_transform(
155157
{
156158
"name": name,
159+
"agent_configs": agent_configs,
157160
"datastore_ids": datastore_ids,
158161
"description": description,
159162
"suggested_queries": suggested_queries,
@@ -171,6 +174,7 @@ def update(
171174
self,
172175
agent_id: str,
173176
*,
177+
agent_configs: agent_update_params.AgentConfigs | NotGiven = NOT_GIVEN,
174178
datastore_ids: List[str] | NotGiven = NOT_GIVEN,
175179
llm_model_id: str | NotGiven = NOT_GIVEN,
176180
suggested_queries: List[str] | NotGiven = NOT_GIVEN,
@@ -190,6 +194,8 @@ def update(
190194
Args:
191195
agent_id: ID of the agent to edit
192196
197+
agent_configs: The following advanced parameters are experimental and subject to change.
198+
193199
datastore_ids: IDs of the datastore to associate with the agent.
194200
195201
llm_model_id: The model ID to use for generation. Tuned models can only be used for the agents
@@ -218,6 +224,7 @@ def update(
218224
f"/agents/{agent_id}",
219225
body=maybe_transform(
220226
{
227+
"agent_configs": agent_configs,
221228
"datastore_ids": datastore_ids,
222229
"llm_model_id": llm_model_id,
223230
"suggested_queries": suggested_queries,
@@ -395,6 +402,7 @@ async def create(
395402
self,
396403
*,
397404
name: str,
405+
agent_configs: agent_create_params.AgentConfigs | NotGiven = NOT_GIVEN,
398406
datastore_ids: List[str] | NotGiven = NOT_GIVEN,
399407
description: str | NotGiven = NOT_GIVEN,
400408
suggested_queries: List[str] | NotGiven = NOT_GIVEN,
@@ -422,8 +430,9 @@ async def create(
422430
Args:
423431
name: Name of the agent
424432
425-
datastore_ids: The IDs of the datastore associated with the agent. Leave empty to automatically
426-
create a new datastore.
433+
agent_configs: The following advanced parameters are experimental and subject to change.
434+
435+
datastore_ids: The IDs of the datastore to associate with this agent.
427436
428437
description: Description of the agent
429438
@@ -448,6 +457,7 @@ async def create(
448457
body=await async_maybe_transform(
449458
{
450459
"name": name,
460+
"agent_configs": agent_configs,
451461
"datastore_ids": datastore_ids,
452462
"description": description,
453463
"suggested_queries": suggested_queries,
@@ -465,6 +475,7 @@ async def update(
465475
self,
466476
agent_id: str,
467477
*,
478+
agent_configs: agent_update_params.AgentConfigs | NotGiven = NOT_GIVEN,
468479
datastore_ids: List[str] | NotGiven = NOT_GIVEN,
469480
llm_model_id: str | NotGiven = NOT_GIVEN,
470481
suggested_queries: List[str] | NotGiven = NOT_GIVEN,
@@ -484,6 +495,8 @@ async def update(
484495
Args:
485496
agent_id: ID of the agent to edit
486497
498+
agent_configs: The following advanced parameters are experimental and subject to change.
499+
487500
datastore_ids: IDs of the datastore to associate with the agent.
488501
489502
llm_model_id: The model ID to use for generation. Tuned models can only be used for the agents
@@ -512,6 +525,7 @@ async def update(
512525
f"/agents/{agent_id}",
513526
body=await async_maybe_transform(
514527
{
528+
"agent_configs": agent_configs,
515529
"datastore_ids": datastore_ids,
516530
"llm_model_id": llm_model_id,
517531
"suggested_queries": suggested_queries,

src/contextual/resources/agents/datasets/__init__.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
22

3+
from .tune import (
4+
TuneResource,
5+
AsyncTuneResource,
6+
TuneResourceWithRawResponse,
7+
AsyncTuneResourceWithRawResponse,
8+
TuneResourceWithStreamingResponse,
9+
AsyncTuneResourceWithStreamingResponse,
10+
)
311
from .datasets import (
412
DatasetsResource,
513
AsyncDatasetsResource,
@@ -18,6 +26,12 @@
1826
)
1927

2028
__all__ = [
29+
"TuneResource",
30+
"AsyncTuneResource",
31+
"TuneResourceWithRawResponse",
32+
"AsyncTuneResourceWithRawResponse",
33+
"TuneResourceWithStreamingResponse",
34+
"AsyncTuneResourceWithStreamingResponse",
2135
"EvaluateResource",
2236
"AsyncEvaluateResource",
2337
"EvaluateResourceWithRawResponse",

src/contextual/resources/agents/datasets/datasets.py

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,14 @@
22

33
from __future__ import annotations
44

5+
from .tune import (
6+
TuneResource,
7+
AsyncTuneResource,
8+
TuneResourceWithRawResponse,
9+
AsyncTuneResourceWithRawResponse,
10+
TuneResourceWithStreamingResponse,
11+
AsyncTuneResourceWithStreamingResponse,
12+
)
513
from .evaluate import (
614
EvaluateResource,
715
AsyncEvaluateResource,
@@ -17,6 +25,10 @@
1725

1826

1927
class DatasetsResource(SyncAPIResource):
28+
@cached_property
29+
def tune(self) -> TuneResource:
30+
return TuneResource(self._client)
31+
2032
@cached_property
2133
def evaluate(self) -> EvaluateResource:
2234
return EvaluateResource(self._client)
@@ -42,6 +54,10 @@ def with_streaming_response(self) -> DatasetsResourceWithStreamingResponse:
4254

4355

4456
class AsyncDatasetsResource(AsyncAPIResource):
57+
@cached_property
58+
def tune(self) -> AsyncTuneResource:
59+
return AsyncTuneResource(self._client)
60+
4561
@cached_property
4662
def evaluate(self) -> AsyncEvaluateResource:
4763
return AsyncEvaluateResource(self._client)
@@ -70,6 +86,10 @@ class DatasetsResourceWithRawResponse:
7086
def __init__(self, datasets: DatasetsResource) -> None:
7187
self._datasets = datasets
7288

89+
@cached_property
90+
def tune(self) -> TuneResourceWithRawResponse:
91+
return TuneResourceWithRawResponse(self._datasets.tune)
92+
7393
@cached_property
7494
def evaluate(self) -> EvaluateResourceWithRawResponse:
7595
return EvaluateResourceWithRawResponse(self._datasets.evaluate)
@@ -79,6 +99,10 @@ class AsyncDatasetsResourceWithRawResponse:
7999
def __init__(self, datasets: AsyncDatasetsResource) -> None:
80100
self._datasets = datasets
81101

102+
@cached_property
103+
def tune(self) -> AsyncTuneResourceWithRawResponse:
104+
return AsyncTuneResourceWithRawResponse(self._datasets.tune)
105+
82106
@cached_property
83107
def evaluate(self) -> AsyncEvaluateResourceWithRawResponse:
84108
return AsyncEvaluateResourceWithRawResponse(self._datasets.evaluate)
@@ -88,6 +112,10 @@ class DatasetsResourceWithStreamingResponse:
88112
def __init__(self, datasets: DatasetsResource) -> None:
89113
self._datasets = datasets
90114

115+
@cached_property
116+
def tune(self) -> TuneResourceWithStreamingResponse:
117+
return TuneResourceWithStreamingResponse(self._datasets.tune)
118+
91119
@cached_property
92120
def evaluate(self) -> EvaluateResourceWithStreamingResponse:
93121
return EvaluateResourceWithStreamingResponse(self._datasets.evaluate)
@@ -97,6 +125,10 @@ class AsyncDatasetsResourceWithStreamingResponse:
97125
def __init__(self, datasets: AsyncDatasetsResource) -> None:
98126
self._datasets = datasets
99127

128+
@cached_property
129+
def tune(self) -> AsyncTuneResourceWithStreamingResponse:
130+
return AsyncTuneResourceWithStreamingResponse(self._datasets.tune)
131+
100132
@cached_property
101133
def evaluate(self) -> AsyncEvaluateResourceWithStreamingResponse:
102134
return AsyncEvaluateResourceWithStreamingResponse(self._datasets.evaluate)

0 commit comments

Comments
 (0)