Skip to content

Commit d61d495

Browse files
feat(api): add inference errors
1 parent 33fe04b commit d61d495

15 files changed

+159
-6
lines changed

.stats.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 175
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/digitalocean%2Fgradient-cb3bf9b21459cad24410206c27a32fd31ef6cf86711700597549dbbd0d634002.yml
3-
openapi_spec_hash: 6a9149a81ba15e7c5c5c1f4d77daad92
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/digitalocean%2Fgradient-f07d74847e620dfa26d8df40ea4680814af9bba381b3a57a7b6ed76ad49d85f8.yml
3+
openapi_spec_hash: e3553dc2abf2afd4368b736bcc32a289
44
config_hash: bad49c3bf949d5168ec3896bedff253a

src/gradient/resources/agents/agents.py

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,12 +185,14 @@ def create(
185185
description: str | Omit = omit,
186186
instruction: str | Omit = omit,
187187
knowledge_base_uuid: SequenceNotStr[str] | Omit = omit,
188+
model_provider_key_uuid: str | Omit = omit,
188189
model_uuid: str | Omit = omit,
189190
name: str | Omit = omit,
190191
openai_key_uuid: str | Omit = omit,
191192
project_id: str | Omit = omit,
192193
region: str | Omit = omit,
193194
tags: SequenceNotStr[str] | Omit = omit,
195+
workspace_uuid: str | Omit = omit,
194196
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
195197
# The extra values given here take precedence over values defined on the client or passed to this method.
196198
extra_headers: Headers | None = None,
@@ -227,6 +229,8 @@ def create(
227229
228230
tags: Agent tag to organize related resources
229231
232+
workspace_uuid: Identifier for the workspace
233+
230234
extra_headers: Send extra headers
231235
232236
extra_query: Add additional query parameters to the request
@@ -245,12 +249,14 @@ def create(
245249
"description": description,
246250
"instruction": instruction,
247251
"knowledge_base_uuid": knowledge_base_uuid,
252+
"model_provider_key_uuid": model_provider_key_uuid,
248253
"model_uuid": model_uuid,
249254
"name": name,
250255
"openai_key_uuid": openai_key_uuid,
251256
"project_id": project_id,
252257
"region": region,
253258
"tags": tags,
259+
"workspace_uuid": workspace_uuid,
254260
},
255261
agent_create_params.AgentCreateParams,
256262
),
@@ -302,12 +308,14 @@ def update(
302308
path_uuid: str,
303309
*,
304310
agent_log_insights_enabled: bool | Omit = omit,
311+
allowed_domains: SequenceNotStr[str] | Omit = omit,
305312
anthropic_key_uuid: str | Omit = omit,
306313
conversation_logs_enabled: bool | Omit = omit,
307314
description: str | Omit = omit,
308315
instruction: str | Omit = omit,
309316
k: int | Omit = omit,
310317
max_tokens: int | Omit = omit,
318+
model_provider_key_uuid: str | Omit = omit,
311319
model_uuid: str | Omit = omit,
312320
name: str | Omit = omit,
313321
openai_key_uuid: str | Omit = omit,
@@ -331,6 +339,9 @@ def update(
331339
response body is a JSON object containing the agent.
332340
333341
Args:
342+
allowed_domains: Optional list of allowed domains for the chatbot - Must use fully qualified
343+
domain name (FQDN) such as https://example.com
344+
334345
anthropic_key_uuid: Optional anthropic key uuid for use with anthropic models
335346
336347
conversation_logs_enabled: Optional update of conversation logs enabled
@@ -348,6 +359,8 @@ def update(
348359
or output, set as a number between 1 and 512. This determines the length of each
349360
response.
350361
362+
model_provider_key_uuid: Optional Model Provider uuid for use with provider models
363+
351364
model_uuid: Identifier for the foundation model.
352365
353366
name: Agent name
@@ -391,12 +404,14 @@ def update(
391404
body=maybe_transform(
392405
{
393406
"agent_log_insights_enabled": agent_log_insights_enabled,
407+
"allowed_domains": allowed_domains,
394408
"anthropic_key_uuid": anthropic_key_uuid,
395409
"conversation_logs_enabled": conversation_logs_enabled,
396410
"description": description,
397411
"instruction": instruction,
398412
"k": k,
399413
"max_tokens": max_tokens,
414+
"model_provider_key_uuid": model_provider_key_uuid,
400415
"model_uuid": model_uuid,
401416
"name": name,
402417
"openai_key_uuid": openai_key_uuid,
@@ -767,12 +782,14 @@ async def create(
767782
description: str | Omit = omit,
768783
instruction: str | Omit = omit,
769784
knowledge_base_uuid: SequenceNotStr[str] | Omit = omit,
785+
model_provider_key_uuid: str | Omit = omit,
770786
model_uuid: str | Omit = omit,
771787
name: str | Omit = omit,
772788
openai_key_uuid: str | Omit = omit,
773789
project_id: str | Omit = omit,
774790
region: str | Omit = omit,
775791
tags: SequenceNotStr[str] | Omit = omit,
792+
workspace_uuid: str | Omit = omit,
776793
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
777794
# The extra values given here take precedence over values defined on the client or passed to this method.
778795
extra_headers: Headers | None = None,
@@ -809,6 +826,8 @@ async def create(
809826
810827
tags: Agent tag to organize related resources
811828
829+
workspace_uuid: Identifier for the workspace
830+
812831
extra_headers: Send extra headers
813832
814833
extra_query: Add additional query parameters to the request
@@ -827,12 +846,14 @@ async def create(
827846
"description": description,
828847
"instruction": instruction,
829848
"knowledge_base_uuid": knowledge_base_uuid,
849+
"model_provider_key_uuid": model_provider_key_uuid,
830850
"model_uuid": model_uuid,
831851
"name": name,
832852
"openai_key_uuid": openai_key_uuid,
833853
"project_id": project_id,
834854
"region": region,
835855
"tags": tags,
856+
"workspace_uuid": workspace_uuid,
836857
},
837858
agent_create_params.AgentCreateParams,
838859
),
@@ -884,12 +905,14 @@ async def update(
884905
path_uuid: str,
885906
*,
886907
agent_log_insights_enabled: bool | Omit = omit,
908+
allowed_domains: SequenceNotStr[str] | Omit = omit,
887909
anthropic_key_uuid: str | Omit = omit,
888910
conversation_logs_enabled: bool | Omit = omit,
889911
description: str | Omit = omit,
890912
instruction: str | Omit = omit,
891913
k: int | Omit = omit,
892914
max_tokens: int | Omit = omit,
915+
model_provider_key_uuid: str | Omit = omit,
893916
model_uuid: str | Omit = omit,
894917
name: str | Omit = omit,
895918
openai_key_uuid: str | Omit = omit,
@@ -913,6 +936,9 @@ async def update(
913936
response body is a JSON object containing the agent.
914937
915938
Args:
939+
allowed_domains: Optional list of allowed domains for the chatbot - Must use fully qualified
940+
domain name (FQDN) such as https://example.com
941+
916942
anthropic_key_uuid: Optional anthropic key uuid for use with anthropic models
917943
918944
conversation_logs_enabled: Optional update of conversation logs enabled
@@ -930,6 +956,8 @@ async def update(
930956
or output, set as a number between 1 and 512. This determines the length of each
931957
response.
932958
959+
model_provider_key_uuid: Optional Model Provider uuid for use with provider models
960+
933961
model_uuid: Identifier for the foundation model.
934962
935963
name: Agent name
@@ -973,12 +1001,14 @@ async def update(
9731001
body=await async_maybe_transform(
9741002
{
9751003
"agent_log_insights_enabled": agent_log_insights_enabled,
1004+
"allowed_domains": allowed_domains,
9761005
"anthropic_key_uuid": anthropic_key_uuid,
9771006
"conversation_logs_enabled": conversation_logs_enabled,
9781007
"description": description,
9791008
"instruction": instruction,
9801009
"k": k,
9811010
"max_tokens": max_tokens,
1011+
"model_provider_key_uuid": model_provider_key_uuid,
9821012
"model_uuid": model_uuid,
9831013
"name": name,
9841014
"openai_key_uuid": openai_key_uuid,

src/gradient/types/agent_create_params.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ class AgentCreateParams(TypedDict, total=False):
2828
knowledge_base_uuid: SequenceNotStr[str]
2929
"""Ids of the knowledge base(s) to attach to the agent"""
3030

31+
model_provider_key_uuid: str
32+
3133
model_uuid: str
3234
"""Identifier for the foundation model."""
3335

@@ -45,3 +47,6 @@ class AgentCreateParams(TypedDict, total=False):
4547

4648
tags: SequenceNotStr[str]
4749
"""Agent tag to organize related resources"""
50+
51+
workspace_uuid: str
52+
"""Identifier for the workspace"""

src/gradient/types/agent_list_response.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@
2424

2525

2626
class AgentChatbot(BaseModel):
27+
allowed_domains: Optional[List[str]] = None
28+
2729
button_background_color: Optional[str] = None
2830

2931
logo: Optional[str] = None
@@ -61,6 +63,7 @@ class AgentDeployment(BaseModel):
6163
"STATUS_UNDEPLOYING",
6264
"STATUS_UNDEPLOYMENT_FAILED",
6365
"STATUS_DELETED",
66+
"STATUS_BUILDING",
6467
]
6568
] = None
6669

src/gradient/types/agent_update_params.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,12 @@
1414
class AgentUpdateParams(TypedDict, total=False):
1515
agent_log_insights_enabled: bool
1616

17+
allowed_domains: SequenceNotStr[str]
18+
"""
19+
Optional list of allowed domains for the chatbot - Must use fully qualified
20+
domain name (FQDN) such as https://example.com
21+
"""
22+
1723
anthropic_key_uuid: str
1824
"""Optional anthropic key uuid for use with anthropic models"""
1925

@@ -41,6 +47,9 @@ class AgentUpdateParams(TypedDict, total=False):
4147
response.
4248
"""
4349

50+
model_provider_key_uuid: str
51+
"""Optional Model Provider uuid for use with provider models"""
52+
4453
model_uuid: str
4554
"""Identifier for the foundation model."""
4655

src/gradient/types/api_agent.py

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
from datetime import datetime
77
from typing_extensions import Literal
88

9+
from pydantic import Field as FieldInfo
10+
911
from .._models import BaseModel
1012
from .api_agent_model import APIAgentModel
1113
from .api_knowledge_base import APIKnowledgeBase
@@ -24,6 +26,7 @@
2426
"Function",
2527
"Guardrail",
2628
"LoggingConfig",
29+
"ModelProviderKey",
2730
"Template",
2831
"TemplateGuardrail",
2932
]
@@ -35,6 +38,8 @@ class APIKey(BaseModel):
3538

3639

3740
class Chatbot(BaseModel):
41+
allowed_domains: Optional[List[str]] = None
42+
3843
button_background_color: Optional[str] = None
3944

4045
logo: Optional[str] = None
@@ -72,6 +77,7 @@ class Deployment(BaseModel):
7277
"STATUS_UNDEPLOYING",
7378
"STATUS_UNDEPLOYMENT_FAILED",
7479
"STATUS_DELETED",
80+
"STATUS_BUILDING",
7581
]
7682
] = None
7783

@@ -186,6 +192,33 @@ class LoggingConfig(BaseModel):
186192
"""Name of the log stream"""
187193

188194

195+
class ModelProviderKey(BaseModel):
196+
api_key_uuid: Optional[str] = None
197+
"""API key ID"""
198+
199+
created_at: Optional[datetime] = None
200+
"""Key creation date"""
201+
202+
created_by: Optional[str] = None
203+
"""Created by user id from DO"""
204+
205+
deleted_at: Optional[datetime] = None
206+
"""Key deleted date"""
207+
208+
models: Optional[List[APIAgentModel]] = None
209+
"""Models supported by the openAI api key"""
210+
211+
name: Optional[str] = None
212+
"""Name of the key"""
213+
214+
provider: Optional[Literal["MODEL_PROVIDER_DIGITALOCEAN", "MODEL_PROVIDER_ANTHROPIC", "MODEL_PROVIDER_OPENAI"]] = (
215+
None
216+
)
217+
218+
updated_at: Optional[datetime] = None
219+
"""Key last updated date"""
220+
221+
189222
class TemplateGuardrail(BaseModel):
190223
priority: Optional[int] = None
191224
"""Priority of the guardrail"""
@@ -311,6 +344,8 @@ class APIAgent(BaseModel):
311344
model: Optional[APIAgentModel] = None
312345
"""Description of a Model"""
313346

347+
api_model_provider_key: Optional[ModelProviderKey] = FieldInfo(alias="model_provider_key", default=None)
348+
314349
name: Optional[str] = None
315350
"""Agent name"""
316351

@@ -372,6 +407,11 @@ class APIAgent(BaseModel):
372407
version_hash: Optional[str] = None
373408
"""The latest version of the agent"""
374409

410+
vpc_egress_ips: Optional[List[str]] = None
411+
"""VPC Egress IPs"""
412+
413+
vpc_uuid: Optional[str] = None
414+
375415
workspace: Optional["APIWorkspace"] = None
376416

377417

src/gradient/types/knowledge_base_create_params.py

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
from .knowledge_bases.api_file_upload_data_source_param import APIFileUploadDataSourceParam
1212
from .knowledge_bases.api_web_crawler_data_source_param import APIWebCrawlerDataSourceParam
1313

14-
__all__ = ["KnowledgeBaseCreateParams", "Datasource", "DatasourceDropboxDataSource"]
14+
__all__ = ["KnowledgeBaseCreateParams", "Datasource", "DatasourceDropboxDataSource", "DatasourceGoogleDriveDataSource"]
1515

1616

1717
class KnowledgeBaseCreateParams(TypedDict, total=False):
@@ -63,6 +63,17 @@ class DatasourceDropboxDataSource(TypedDict, total=False):
6363
"""
6464

6565

66+
class DatasourceGoogleDriveDataSource(TypedDict, total=False):
67+
folder_id: str
68+
69+
refresh_token: str
70+
"""Refresh token.
71+
72+
you can obrain a refresh token by following the oauth2 flow. see
73+
/v2/gen-ai/oauth2/google/tokens for reference.
74+
"""
75+
76+
6677
class Datasource(TypedDict, total=False):
6778
aws_data_source: AwsDataSourceParam
6879
"""AWS S3 Data Source"""
@@ -79,6 +90,9 @@ class Datasource(TypedDict, total=False):
7990
file_upload_data_source: APIFileUploadDataSourceParam
8091
"""File to upload as data source for knowledge base."""
8192

93+
google_drive_data_source: DatasourceGoogleDriveDataSource
94+
"""Google Drive Data Source"""
95+
8296
item_path: str
8397

8498
spaces_data_source: APISpacesDataSourceParam

src/gradient/types/knowledge_bases/api_indexed_data_source.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ class APIIndexedDataSource(BaseModel):
4848
"DATA_SOURCE_STATUS_PARTIALLY_UPDATED",
4949
"DATA_SOURCE_STATUS_NOT_UPDATED",
5050
"DATA_SOURCE_STATUS_FAILED",
51+
"DATA_SOURCE_STATUS_CANCELLED",
5152
]
5253
] = None
5354

0 commit comments

Comments
 (0)