c63a5cfe-b235-4fbe-8bbb-82a9e02a482a-python 0.1.0a3__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- c63a5cfe_b235_4fbe_8bbb_82a9e02a482a_python-0.1.0a3.dist-info/METADATA +396 -0
- c63a5cfe_b235_4fbe_8bbb_82a9e02a482a_python-0.1.0a3.dist-info/RECORD +190 -0
- c63a5cfe_b235_4fbe_8bbb_82a9e02a482a_python-0.1.0a3.dist-info/WHEEL +4 -0
- c63a5cfe_b235_4fbe_8bbb_82a9e02a482a_python-0.1.0a3.dist-info/licenses/LICENSE +201 -0
- digitalocean_genai_sdk/__init__.py +99 -0
- digitalocean_genai_sdk/_base_client.py +1949 -0
- digitalocean_genai_sdk/_client.py +795 -0
- digitalocean_genai_sdk/_compat.py +219 -0
- digitalocean_genai_sdk/_constants.py +14 -0
- digitalocean_genai_sdk/_exceptions.py +108 -0
- digitalocean_genai_sdk/_files.py +123 -0
- digitalocean_genai_sdk/_models.py +805 -0
- digitalocean_genai_sdk/_qs.py +150 -0
- digitalocean_genai_sdk/_resource.py +43 -0
- digitalocean_genai_sdk/_response.py +832 -0
- digitalocean_genai_sdk/_streaming.py +333 -0
- digitalocean_genai_sdk/_types.py +219 -0
- digitalocean_genai_sdk/_utils/__init__.py +57 -0
- digitalocean_genai_sdk/_utils/_logs.py +25 -0
- digitalocean_genai_sdk/_utils/_proxy.py +65 -0
- digitalocean_genai_sdk/_utils/_reflection.py +42 -0
- digitalocean_genai_sdk/_utils/_resources_proxy.py +24 -0
- digitalocean_genai_sdk/_utils/_streams.py +12 -0
- digitalocean_genai_sdk/_utils/_sync.py +86 -0
- digitalocean_genai_sdk/_utils/_transform.py +447 -0
- digitalocean_genai_sdk/_utils/_typing.py +151 -0
- digitalocean_genai_sdk/_utils/_utils.py +422 -0
- digitalocean_genai_sdk/_version.py +4 -0
- digitalocean_genai_sdk/lib/.keep +4 -0
- digitalocean_genai_sdk/py.typed +0 -0
- digitalocean_genai_sdk/resources/__init__.py +145 -0
- digitalocean_genai_sdk/resources/agents/__init__.py +89 -0
- digitalocean_genai_sdk/resources/agents/agents.py +965 -0
- digitalocean_genai_sdk/resources/agents/api_keys.py +581 -0
- digitalocean_genai_sdk/resources/agents/child_agents.py +508 -0
- digitalocean_genai_sdk/resources/agents/functions.py +421 -0
- digitalocean_genai_sdk/resources/agents/knowledge_bases.py +346 -0
- digitalocean_genai_sdk/resources/agents/versions.py +298 -0
- digitalocean_genai_sdk/resources/api_keys/__init__.py +19 -0
- digitalocean_genai_sdk/resources/api_keys/api_keys.py +275 -0
- digitalocean_genai_sdk/resources/api_keys/api_keys_.py +529 -0
- digitalocean_genai_sdk/resources/auth/__init__.py +33 -0
- digitalocean_genai_sdk/resources/auth/agents/__init__.py +33 -0
- digitalocean_genai_sdk/resources/auth/agents/agents.py +102 -0
- digitalocean_genai_sdk/resources/auth/agents/token.py +173 -0
- digitalocean_genai_sdk/resources/auth/auth.py +102 -0
- digitalocean_genai_sdk/resources/chat.py +381 -0
- digitalocean_genai_sdk/resources/embeddings.py +201 -0
- digitalocean_genai_sdk/resources/indexing_jobs.py +543 -0
- digitalocean_genai_sdk/resources/knowledge_bases/__init__.py +33 -0
- digitalocean_genai_sdk/resources/knowledge_bases/data_sources.py +410 -0
- digitalocean_genai_sdk/resources/knowledge_bases/knowledge_bases.py +667 -0
- digitalocean_genai_sdk/resources/models.py +222 -0
- digitalocean_genai_sdk/resources/providers/__init__.py +47 -0
- digitalocean_genai_sdk/resources/providers/anthropic/__init__.py +33 -0
- digitalocean_genai_sdk/resources/providers/anthropic/anthropic.py +102 -0
- digitalocean_genai_sdk/resources/providers/anthropic/keys.py +662 -0
- digitalocean_genai_sdk/resources/providers/openai/__init__.py +33 -0
- digitalocean_genai_sdk/resources/providers/openai/keys.py +658 -0
- digitalocean_genai_sdk/resources/providers/openai/openai.py +102 -0
- digitalocean_genai_sdk/resources/providers/providers.py +134 -0
- digitalocean_genai_sdk/resources/regions.py +191 -0
- digitalocean_genai_sdk/types/__init__.py +57 -0
- digitalocean_genai_sdk/types/agent_create_params.py +39 -0
- digitalocean_genai_sdk/types/agent_create_response.py +16 -0
- digitalocean_genai_sdk/types/agent_delete_response.py +16 -0
- digitalocean_genai_sdk/types/agent_list_params.py +18 -0
- digitalocean_genai_sdk/types/agent_list_response.py +198 -0
- digitalocean_genai_sdk/types/agent_retrieve_response.py +16 -0
- digitalocean_genai_sdk/types/agent_update_params.py +65 -0
- digitalocean_genai_sdk/types/agent_update_response.py +16 -0
- digitalocean_genai_sdk/types/agent_update_status_params.py +16 -0
- digitalocean_genai_sdk/types/agent_update_status_response.py +16 -0
- digitalocean_genai_sdk/types/agents/__init__.py +31 -0
- digitalocean_genai_sdk/types/agents/api_key_create_params.py +15 -0
- digitalocean_genai_sdk/types/agents/api_key_create_response.py +12 -0
- digitalocean_genai_sdk/types/agents/api_key_delete_response.py +12 -0
- digitalocean_genai_sdk/types/agents/api_key_list_params.py +15 -0
- digitalocean_genai_sdk/types/agents/api_key_list_response.py +18 -0
- digitalocean_genai_sdk/types/agents/api_key_regenerate_response.py +12 -0
- digitalocean_genai_sdk/types/agents/api_key_update_params.py +19 -0
- digitalocean_genai_sdk/types/agents/api_key_update_response.py +12 -0
- digitalocean_genai_sdk/types/agents/api_link_knowledge_base_output.py +16 -0
- digitalocean_genai_sdk/types/agents/api_links.py +21 -0
- digitalocean_genai_sdk/types/agents/api_meta.py +15 -0
- digitalocean_genai_sdk/types/agents/child_agent_add_params.py +22 -0
- digitalocean_genai_sdk/types/agents/child_agent_add_response.py +14 -0
- digitalocean_genai_sdk/types/agents/child_agent_delete_response.py +13 -0
- digitalocean_genai_sdk/types/agents/child_agent_update_params.py +24 -0
- digitalocean_genai_sdk/types/agents/child_agent_update_response.py +18 -0
- digitalocean_genai_sdk/types/agents/child_agent_view_response.py +16 -0
- digitalocean_genai_sdk/types/agents/function_create_params.py +25 -0
- digitalocean_genai_sdk/types/agents/function_create_response.py +16 -0
- digitalocean_genai_sdk/types/agents/function_delete_response.py +16 -0
- digitalocean_genai_sdk/types/agents/function_update_params.py +29 -0
- digitalocean_genai_sdk/types/agents/function_update_response.py +16 -0
- digitalocean_genai_sdk/types/agents/knowledge_base_detach_response.py +16 -0
- digitalocean_genai_sdk/types/agents/version_list_params.py +15 -0
- digitalocean_genai_sdk/types/agents/version_list_response.py +118 -0
- digitalocean_genai_sdk/types/agents/version_update_params.py +15 -0
- digitalocean_genai_sdk/types/agents/version_update_response.py +30 -0
- digitalocean_genai_sdk/types/api_agent.py +263 -0
- digitalocean_genai_sdk/types/api_agent_api_key_info.py +22 -0
- digitalocean_genai_sdk/types/api_agreement.py +17 -0
- digitalocean_genai_sdk/types/api_anthropic_api_key_info.py +22 -0
- digitalocean_genai_sdk/types/api_deployment_visibility.py +9 -0
- digitalocean_genai_sdk/types/api_indexing_job.py +43 -0
- digitalocean_genai_sdk/types/api_key_list_params.py +42 -0
- digitalocean_genai_sdk/types/api_key_list_response.py +42 -0
- digitalocean_genai_sdk/types/api_keys/__init__.py +13 -0
- digitalocean_genai_sdk/types/api_keys/api_key_create_params.py +11 -0
- digitalocean_genai_sdk/types/api_keys/api_key_create_response.py +12 -0
- digitalocean_genai_sdk/types/api_keys/api_key_delete_response.py +12 -0
- digitalocean_genai_sdk/types/api_keys/api_key_list_params.py +15 -0
- digitalocean_genai_sdk/types/api_keys/api_key_list_response.py +18 -0
- digitalocean_genai_sdk/types/api_keys/api_key_update_params.py +15 -0
- digitalocean_genai_sdk/types/api_keys/api_key_update_regenerate_response.py +12 -0
- digitalocean_genai_sdk/types/api_keys/api_key_update_response.py +12 -0
- digitalocean_genai_sdk/types/api_keys/api_model_api_key_info.py +22 -0
- digitalocean_genai_sdk/types/api_knowledge_base.py +37 -0
- digitalocean_genai_sdk/types/api_model.py +57 -0
- digitalocean_genai_sdk/types/api_model_version.py +15 -0
- digitalocean_genai_sdk/types/api_openai_api_key_info.py +25 -0
- digitalocean_genai_sdk/types/api_retrieval_method.py +13 -0
- digitalocean_genai_sdk/types/auth/__init__.py +3 -0
- digitalocean_genai_sdk/types/auth/agents/__init__.py +6 -0
- digitalocean_genai_sdk/types/auth/agents/token_create_params.py +13 -0
- digitalocean_genai_sdk/types/auth/agents/token_create_response.py +13 -0
- digitalocean_genai_sdk/types/chat_completion_request_message_content_part_text_param.py +15 -0
- digitalocean_genai_sdk/types/chat_completion_token_logprob.py +57 -0
- digitalocean_genai_sdk/types/chat_create_completion_params.py +208 -0
- digitalocean_genai_sdk/types/chat_create_completion_response.py +81 -0
- digitalocean_genai_sdk/types/embedding_create_params.py +28 -0
- digitalocean_genai_sdk/types/embedding_create_response.py +41 -0
- digitalocean_genai_sdk/types/indexing_job_create_params.py +14 -0
- digitalocean_genai_sdk/types/indexing_job_create_response.py +12 -0
- digitalocean_genai_sdk/types/indexing_job_list_params.py +15 -0
- digitalocean_genai_sdk/types/indexing_job_list_response.py +18 -0
- digitalocean_genai_sdk/types/indexing_job_retrieve_data_sources_response.py +52 -0
- digitalocean_genai_sdk/types/indexing_job_retrieve_response.py +12 -0
- digitalocean_genai_sdk/types/indexing_job_update_cancel_params.py +14 -0
- digitalocean_genai_sdk/types/indexing_job_update_cancel_response.py +12 -0
- digitalocean_genai_sdk/types/knowledge_base_create_params.py +64 -0
- digitalocean_genai_sdk/types/knowledge_base_create_response.py +12 -0
- digitalocean_genai_sdk/types/knowledge_base_delete_response.py +11 -0
- digitalocean_genai_sdk/types/knowledge_base_list_params.py +15 -0
- digitalocean_genai_sdk/types/knowledge_base_list_response.py +18 -0
- digitalocean_genai_sdk/types/knowledge_base_retrieve_response.py +30 -0
- digitalocean_genai_sdk/types/knowledge_base_update_params.py +27 -0
- digitalocean_genai_sdk/types/knowledge_base_update_response.py +12 -0
- digitalocean_genai_sdk/types/knowledge_bases/__init__.py +16 -0
- digitalocean_genai_sdk/types/knowledge_bases/api_file_upload_data_source.py +15 -0
- digitalocean_genai_sdk/types/knowledge_bases/api_file_upload_data_source_param.py +15 -0
- digitalocean_genai_sdk/types/knowledge_bases/api_knowledge_base_data_source.py +35 -0
- digitalocean_genai_sdk/types/knowledge_bases/api_spaces_data_source.py +15 -0
- digitalocean_genai_sdk/types/knowledge_bases/api_spaces_data_source_param.py +15 -0
- digitalocean_genai_sdk/types/knowledge_bases/api_web_crawler_data_source.py +26 -0
- digitalocean_genai_sdk/types/knowledge_bases/api_web_crawler_data_source_param.py +25 -0
- digitalocean_genai_sdk/types/knowledge_bases/data_source_create_params.py +33 -0
- digitalocean_genai_sdk/types/knowledge_bases/data_source_create_response.py +12 -0
- digitalocean_genai_sdk/types/knowledge_bases/data_source_delete_response.py +13 -0
- digitalocean_genai_sdk/types/knowledge_bases/data_source_list_params.py +15 -0
- digitalocean_genai_sdk/types/knowledge_bases/data_source_list_response.py +18 -0
- digitalocean_genai_sdk/types/model.py +21 -0
- digitalocean_genai_sdk/types/model_list_response.py +15 -0
- digitalocean_genai_sdk/types/providers/__init__.py +3 -0
- digitalocean_genai_sdk/types/providers/anthropic/__init__.py +14 -0
- digitalocean_genai_sdk/types/providers/anthropic/key_create_params.py +13 -0
- digitalocean_genai_sdk/types/providers/anthropic/key_create_response.py +12 -0
- digitalocean_genai_sdk/types/providers/anthropic/key_delete_response.py +12 -0
- digitalocean_genai_sdk/types/providers/anthropic/key_list_agents_params.py +15 -0
- digitalocean_genai_sdk/types/providers/anthropic/key_list_agents_response.py +22 -0
- digitalocean_genai_sdk/types/providers/anthropic/key_list_params.py +15 -0
- digitalocean_genai_sdk/types/providers/anthropic/key_list_response.py +18 -0
- digitalocean_genai_sdk/types/providers/anthropic/key_retrieve_response.py +12 -0
- digitalocean_genai_sdk/types/providers/anthropic/key_update_params.py +17 -0
- digitalocean_genai_sdk/types/providers/anthropic/key_update_response.py +12 -0
- digitalocean_genai_sdk/types/providers/openai/__init__.py +14 -0
- digitalocean_genai_sdk/types/providers/openai/key_create_params.py +13 -0
- digitalocean_genai_sdk/types/providers/openai/key_create_response.py +12 -0
- digitalocean_genai_sdk/types/providers/openai/key_delete_response.py +12 -0
- digitalocean_genai_sdk/types/providers/openai/key_list_params.py +15 -0
- digitalocean_genai_sdk/types/providers/openai/key_list_response.py +18 -0
- digitalocean_genai_sdk/types/providers/openai/key_retrieve_agents_params.py +15 -0
- digitalocean_genai_sdk/types/providers/openai/key_retrieve_agents_response.py +22 -0
- digitalocean_genai_sdk/types/providers/openai/key_retrieve_response.py +12 -0
- digitalocean_genai_sdk/types/providers/openai/key_update_params.py +17 -0
- digitalocean_genai_sdk/types/providers/openai/key_update_response.py +12 -0
- digitalocean_genai_sdk/types/region_list_params.py +15 -0
- digitalocean_genai_sdk/types/region_list_response.py +23 -0
@@ -0,0 +1,965 @@
|
|
1
|
+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
2
|
+
|
3
|
+
from __future__ import annotations
|
4
|
+
|
5
|
+
from typing import List
|
6
|
+
|
7
|
+
import httpx
|
8
|
+
|
9
|
+
from ...types import (
|
10
|
+
APIRetrievalMethod,
|
11
|
+
APIDeploymentVisibility,
|
12
|
+
agent_list_params,
|
13
|
+
agent_create_params,
|
14
|
+
agent_update_params,
|
15
|
+
agent_update_status_params,
|
16
|
+
)
|
17
|
+
from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven
|
18
|
+
from ..._utils import maybe_transform, async_maybe_transform
|
19
|
+
from .api_keys import (
|
20
|
+
APIKeysResource,
|
21
|
+
AsyncAPIKeysResource,
|
22
|
+
APIKeysResourceWithRawResponse,
|
23
|
+
AsyncAPIKeysResourceWithRawResponse,
|
24
|
+
APIKeysResourceWithStreamingResponse,
|
25
|
+
AsyncAPIKeysResourceWithStreamingResponse,
|
26
|
+
)
|
27
|
+
from .versions import (
|
28
|
+
VersionsResource,
|
29
|
+
AsyncVersionsResource,
|
30
|
+
VersionsResourceWithRawResponse,
|
31
|
+
AsyncVersionsResourceWithRawResponse,
|
32
|
+
VersionsResourceWithStreamingResponse,
|
33
|
+
AsyncVersionsResourceWithStreamingResponse,
|
34
|
+
)
|
35
|
+
from ..._compat import cached_property
|
36
|
+
from .functions import (
|
37
|
+
FunctionsResource,
|
38
|
+
AsyncFunctionsResource,
|
39
|
+
FunctionsResourceWithRawResponse,
|
40
|
+
AsyncFunctionsResourceWithRawResponse,
|
41
|
+
FunctionsResourceWithStreamingResponse,
|
42
|
+
AsyncFunctionsResourceWithStreamingResponse,
|
43
|
+
)
|
44
|
+
from ..._resource import SyncAPIResource, AsyncAPIResource
|
45
|
+
from ..._response import (
|
46
|
+
to_raw_response_wrapper,
|
47
|
+
to_streamed_response_wrapper,
|
48
|
+
async_to_raw_response_wrapper,
|
49
|
+
async_to_streamed_response_wrapper,
|
50
|
+
)
|
51
|
+
from .child_agents import (
|
52
|
+
ChildAgentsResource,
|
53
|
+
AsyncChildAgentsResource,
|
54
|
+
ChildAgentsResourceWithRawResponse,
|
55
|
+
AsyncChildAgentsResourceWithRawResponse,
|
56
|
+
ChildAgentsResourceWithStreamingResponse,
|
57
|
+
AsyncChildAgentsResourceWithStreamingResponse,
|
58
|
+
)
|
59
|
+
from ..._base_client import make_request_options
|
60
|
+
from .knowledge_bases import (
|
61
|
+
KnowledgeBasesResource,
|
62
|
+
AsyncKnowledgeBasesResource,
|
63
|
+
KnowledgeBasesResourceWithRawResponse,
|
64
|
+
AsyncKnowledgeBasesResourceWithRawResponse,
|
65
|
+
KnowledgeBasesResourceWithStreamingResponse,
|
66
|
+
AsyncKnowledgeBasesResourceWithStreamingResponse,
|
67
|
+
)
|
68
|
+
from ...types.agent_list_response import AgentListResponse
|
69
|
+
from ...types.api_retrieval_method import APIRetrievalMethod
|
70
|
+
from ...types.agent_create_response import AgentCreateResponse
|
71
|
+
from ...types.agent_delete_response import AgentDeleteResponse
|
72
|
+
from ...types.agent_update_response import AgentUpdateResponse
|
73
|
+
from ...types.agent_retrieve_response import AgentRetrieveResponse
|
74
|
+
from ...types.api_deployment_visibility import APIDeploymentVisibility
|
75
|
+
from ...types.agent_update_status_response import AgentUpdateStatusResponse
|
76
|
+
|
77
|
+
__all__ = ["AgentsResource", "AsyncAgentsResource"]
|
78
|
+
|
79
|
+
|
80
|
+
class AgentsResource(SyncAPIResource):
|
81
|
+
@cached_property
|
82
|
+
def api_keys(self) -> APIKeysResource:
|
83
|
+
return APIKeysResource(self._client)
|
84
|
+
|
85
|
+
@cached_property
|
86
|
+
def functions(self) -> FunctionsResource:
|
87
|
+
return FunctionsResource(self._client)
|
88
|
+
|
89
|
+
@cached_property
|
90
|
+
def versions(self) -> VersionsResource:
|
91
|
+
return VersionsResource(self._client)
|
92
|
+
|
93
|
+
@cached_property
|
94
|
+
def knowledge_bases(self) -> KnowledgeBasesResource:
|
95
|
+
return KnowledgeBasesResource(self._client)
|
96
|
+
|
97
|
+
@cached_property
|
98
|
+
def child_agents(self) -> ChildAgentsResource:
|
99
|
+
return ChildAgentsResource(self._client)
|
100
|
+
|
101
|
+
@cached_property
|
102
|
+
def with_raw_response(self) -> AgentsResourceWithRawResponse:
|
103
|
+
"""
|
104
|
+
This property can be used as a prefix for any HTTP method call to return
|
105
|
+
the raw response object instead of the parsed content.
|
106
|
+
|
107
|
+
For more information, see https://www.github.com/digitalocean/genai-python#accessing-raw-response-data-eg-headers
|
108
|
+
"""
|
109
|
+
return AgentsResourceWithRawResponse(self)
|
110
|
+
|
111
|
+
@cached_property
|
112
|
+
def with_streaming_response(self) -> AgentsResourceWithStreamingResponse:
|
113
|
+
"""
|
114
|
+
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
|
115
|
+
|
116
|
+
For more information, see https://www.github.com/digitalocean/genai-python#with_streaming_response
|
117
|
+
"""
|
118
|
+
return AgentsResourceWithStreamingResponse(self)
|
119
|
+
|
120
|
+
def create(
|
121
|
+
self,
|
122
|
+
*,
|
123
|
+
anthropic_key_uuid: str | NotGiven = NOT_GIVEN,
|
124
|
+
description: str | NotGiven = NOT_GIVEN,
|
125
|
+
instruction: str | NotGiven = NOT_GIVEN,
|
126
|
+
knowledge_base_uuid: List[str] | NotGiven = NOT_GIVEN,
|
127
|
+
model_uuid: str | NotGiven = NOT_GIVEN,
|
128
|
+
name: str | NotGiven = NOT_GIVEN,
|
129
|
+
openai_key_uuid: str | NotGiven = NOT_GIVEN,
|
130
|
+
project_id: str | NotGiven = NOT_GIVEN,
|
131
|
+
region: str | NotGiven = NOT_GIVEN,
|
132
|
+
tags: List[str] | NotGiven = NOT_GIVEN,
|
133
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
134
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
135
|
+
extra_headers: Headers | None = None,
|
136
|
+
extra_query: Query | None = None,
|
137
|
+
extra_body: Body | None = None,
|
138
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
139
|
+
) -> AgentCreateResponse:
|
140
|
+
"""To create a new agent, send a POST request to `/v2/gen-ai/agents`.
|
141
|
+
|
142
|
+
The response
|
143
|
+
body contains a JSON object with the newly created agent object.
|
144
|
+
|
145
|
+
Args:
|
146
|
+
instruction: Agent instruction. Instructions help your agent to perform its job effectively.
|
147
|
+
See
|
148
|
+
[Write Effective Agent Instructions](https://docs.digitalocean.com/products/genai-platform/concepts/best-practices/#agent-instructions)
|
149
|
+
for best practices.
|
150
|
+
|
151
|
+
model_uuid: Identifier for the foundation model.
|
152
|
+
|
153
|
+
extra_headers: Send extra headers
|
154
|
+
|
155
|
+
extra_query: Add additional query parameters to the request
|
156
|
+
|
157
|
+
extra_body: Add additional JSON properties to the request
|
158
|
+
|
159
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
160
|
+
"""
|
161
|
+
return self._post(
|
162
|
+
"/v2/genai/agents",
|
163
|
+
body=maybe_transform(
|
164
|
+
{
|
165
|
+
"anthropic_key_uuid": anthropic_key_uuid,
|
166
|
+
"description": description,
|
167
|
+
"instruction": instruction,
|
168
|
+
"knowledge_base_uuid": knowledge_base_uuid,
|
169
|
+
"model_uuid": model_uuid,
|
170
|
+
"name": name,
|
171
|
+
"openai_key_uuid": openai_key_uuid,
|
172
|
+
"project_id": project_id,
|
173
|
+
"region": region,
|
174
|
+
"tags": tags,
|
175
|
+
},
|
176
|
+
agent_create_params.AgentCreateParams,
|
177
|
+
),
|
178
|
+
options=make_request_options(
|
179
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
180
|
+
),
|
181
|
+
cast_to=AgentCreateResponse,
|
182
|
+
)
|
183
|
+
|
184
|
+
def retrieve(
|
185
|
+
self,
|
186
|
+
uuid: str,
|
187
|
+
*,
|
188
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
189
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
190
|
+
extra_headers: Headers | None = None,
|
191
|
+
extra_query: Query | None = None,
|
192
|
+
extra_body: Body | None = None,
|
193
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
194
|
+
) -> AgentRetrieveResponse:
|
195
|
+
"""To retrieve details of an agent, GET request to `/v2/gen-ai/agents/{uuid}`.
|
196
|
+
|
197
|
+
The
|
198
|
+
response body is a JSON object containing the agent.
|
199
|
+
|
200
|
+
Args:
|
201
|
+
extra_headers: Send extra headers
|
202
|
+
|
203
|
+
extra_query: Add additional query parameters to the request
|
204
|
+
|
205
|
+
extra_body: Add additional JSON properties to the request
|
206
|
+
|
207
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
208
|
+
"""
|
209
|
+
if not uuid:
|
210
|
+
raise ValueError(f"Expected a non-empty value for `uuid` but received {uuid!r}")
|
211
|
+
return self._get(
|
212
|
+
f"/v2/genai/agents/{uuid}",
|
213
|
+
options=make_request_options(
|
214
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
215
|
+
),
|
216
|
+
cast_to=AgentRetrieveResponse,
|
217
|
+
)
|
218
|
+
|
219
|
+
def update(
|
220
|
+
self,
|
221
|
+
path_uuid: str,
|
222
|
+
*,
|
223
|
+
anthropic_key_uuid: str | NotGiven = NOT_GIVEN,
|
224
|
+
description: str | NotGiven = NOT_GIVEN,
|
225
|
+
instruction: str | NotGiven = NOT_GIVEN,
|
226
|
+
k: int | NotGiven = NOT_GIVEN,
|
227
|
+
max_tokens: int | NotGiven = NOT_GIVEN,
|
228
|
+
model_uuid: str | NotGiven = NOT_GIVEN,
|
229
|
+
name: str | NotGiven = NOT_GIVEN,
|
230
|
+
openai_key_uuid: str | NotGiven = NOT_GIVEN,
|
231
|
+
project_id: str | NotGiven = NOT_GIVEN,
|
232
|
+
provide_citations: bool | NotGiven = NOT_GIVEN,
|
233
|
+
retrieval_method: APIRetrievalMethod | NotGiven = NOT_GIVEN,
|
234
|
+
tags: List[str] | NotGiven = NOT_GIVEN,
|
235
|
+
temperature: float | NotGiven = NOT_GIVEN,
|
236
|
+
top_p: float | NotGiven = NOT_GIVEN,
|
237
|
+
body_uuid: str | NotGiven = NOT_GIVEN,
|
238
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
239
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
240
|
+
extra_headers: Headers | None = None,
|
241
|
+
extra_query: Query | None = None,
|
242
|
+
extra_body: Body | None = None,
|
243
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
244
|
+
) -> AgentUpdateResponse:
|
245
|
+
"""To update an agent, send a PUT request to `/v2/gen-ai/agents/{uuid}`.
|
246
|
+
|
247
|
+
The
|
248
|
+
response body is a JSON object containing the agent.
|
249
|
+
|
250
|
+
Args:
|
251
|
+
instruction: Agent instruction. Instructions help your agent to perform its job effectively.
|
252
|
+
See
|
253
|
+
[Write Effective Agent Instructions](https://docs.digitalocean.com/products/genai-platform/concepts/best-practices/#agent-instructions)
|
254
|
+
for best practices.
|
255
|
+
|
256
|
+
max_tokens: Specifies the maximum number of tokens the model can process in a single input
|
257
|
+
or output, set as a number between 1 and 512. This determines the length of each
|
258
|
+
response.
|
259
|
+
|
260
|
+
model_uuid: Identifier for the foundation model.
|
261
|
+
|
262
|
+
temperature: Controls the model’s creativity, specified as a number between 0 and 1. Lower
|
263
|
+
values produce more predictable and conservative responses, while higher values
|
264
|
+
encourage creativity and variation.
|
265
|
+
|
266
|
+
top_p: Defines the cumulative probability threshold for word selection, specified as a
|
267
|
+
number between 0 and 1. Higher values allow for more diverse outputs, while
|
268
|
+
lower values ensure focused and coherent responses.
|
269
|
+
|
270
|
+
extra_headers: Send extra headers
|
271
|
+
|
272
|
+
extra_query: Add additional query parameters to the request
|
273
|
+
|
274
|
+
extra_body: Add additional JSON properties to the request
|
275
|
+
|
276
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
277
|
+
"""
|
278
|
+
if not path_uuid:
|
279
|
+
raise ValueError(f"Expected a non-empty value for `path_uuid` but received {path_uuid!r}")
|
280
|
+
return self._put(
|
281
|
+
f"/v2/genai/agents/{path_uuid}",
|
282
|
+
body=maybe_transform(
|
283
|
+
{
|
284
|
+
"anthropic_key_uuid": anthropic_key_uuid,
|
285
|
+
"description": description,
|
286
|
+
"instruction": instruction,
|
287
|
+
"k": k,
|
288
|
+
"max_tokens": max_tokens,
|
289
|
+
"model_uuid": model_uuid,
|
290
|
+
"name": name,
|
291
|
+
"openai_key_uuid": openai_key_uuid,
|
292
|
+
"project_id": project_id,
|
293
|
+
"provide_citations": provide_citations,
|
294
|
+
"retrieval_method": retrieval_method,
|
295
|
+
"tags": tags,
|
296
|
+
"temperature": temperature,
|
297
|
+
"top_p": top_p,
|
298
|
+
"body_uuid": body_uuid,
|
299
|
+
},
|
300
|
+
agent_update_params.AgentUpdateParams,
|
301
|
+
),
|
302
|
+
options=make_request_options(
|
303
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
304
|
+
),
|
305
|
+
cast_to=AgentUpdateResponse,
|
306
|
+
)
|
307
|
+
|
308
|
+
def list(
|
309
|
+
self,
|
310
|
+
*,
|
311
|
+
only_deployed: bool | NotGiven = NOT_GIVEN,
|
312
|
+
page: int | NotGiven = NOT_GIVEN,
|
313
|
+
per_page: int | NotGiven = NOT_GIVEN,
|
314
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
315
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
316
|
+
extra_headers: Headers | None = None,
|
317
|
+
extra_query: Query | None = None,
|
318
|
+
extra_body: Body | None = None,
|
319
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
320
|
+
) -> AgentListResponse:
|
321
|
+
"""
|
322
|
+
To list all agents, send a GET request to `/v2/gen-ai/agents`.
|
323
|
+
|
324
|
+
Args:
|
325
|
+
only_deployed: only list agents that are deployed.
|
326
|
+
|
327
|
+
page: page number.
|
328
|
+
|
329
|
+
per_page: items per page.
|
330
|
+
|
331
|
+
extra_headers: Send extra headers
|
332
|
+
|
333
|
+
extra_query: Add additional query parameters to the request
|
334
|
+
|
335
|
+
extra_body: Add additional JSON properties to the request
|
336
|
+
|
337
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
338
|
+
"""
|
339
|
+
return self._get(
|
340
|
+
"/v2/genai/agents",
|
341
|
+
options=make_request_options(
|
342
|
+
extra_headers=extra_headers,
|
343
|
+
extra_query=extra_query,
|
344
|
+
extra_body=extra_body,
|
345
|
+
timeout=timeout,
|
346
|
+
query=maybe_transform(
|
347
|
+
{
|
348
|
+
"only_deployed": only_deployed,
|
349
|
+
"page": page,
|
350
|
+
"per_page": per_page,
|
351
|
+
},
|
352
|
+
agent_list_params.AgentListParams,
|
353
|
+
),
|
354
|
+
),
|
355
|
+
cast_to=AgentListResponse,
|
356
|
+
)
|
357
|
+
|
358
|
+
def delete(
|
359
|
+
self,
|
360
|
+
uuid: str,
|
361
|
+
*,
|
362
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
363
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
364
|
+
extra_headers: Headers | None = None,
|
365
|
+
extra_query: Query | None = None,
|
366
|
+
extra_body: Body | None = None,
|
367
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
368
|
+
) -> AgentDeleteResponse:
|
369
|
+
"""
|
370
|
+
To delete an agent, send a DELETE request to `/v2/gen-ai/agents/{uuid}`.
|
371
|
+
|
372
|
+
Args:
|
373
|
+
extra_headers: Send extra headers
|
374
|
+
|
375
|
+
extra_query: Add additional query parameters to the request
|
376
|
+
|
377
|
+
extra_body: Add additional JSON properties to the request
|
378
|
+
|
379
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
380
|
+
"""
|
381
|
+
if not uuid:
|
382
|
+
raise ValueError(f"Expected a non-empty value for `uuid` but received {uuid!r}")
|
383
|
+
return self._delete(
|
384
|
+
f"/v2/genai/agents/{uuid}",
|
385
|
+
options=make_request_options(
|
386
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
387
|
+
),
|
388
|
+
cast_to=AgentDeleteResponse,
|
389
|
+
)
|
390
|
+
|
391
|
+
def update_status(
|
392
|
+
self,
|
393
|
+
path_uuid: str,
|
394
|
+
*,
|
395
|
+
body_uuid: str | NotGiven = NOT_GIVEN,
|
396
|
+
visibility: APIDeploymentVisibility | NotGiven = NOT_GIVEN,
|
397
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
398
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
399
|
+
extra_headers: Headers | None = None,
|
400
|
+
extra_query: Query | None = None,
|
401
|
+
extra_body: Body | None = None,
|
402
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
403
|
+
) -> AgentUpdateStatusResponse:
|
404
|
+
"""Check whether an agent is public or private.
|
405
|
+
|
406
|
+
To update the agent status, send a
|
407
|
+
PUT request to `/v2/gen-ai/agents/{uuid}/deployment_visibility`.
|
408
|
+
|
409
|
+
Args:
|
410
|
+
extra_headers: Send extra headers
|
411
|
+
|
412
|
+
extra_query: Add additional query parameters to the request
|
413
|
+
|
414
|
+
extra_body: Add additional JSON properties to the request
|
415
|
+
|
416
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
417
|
+
"""
|
418
|
+
if not path_uuid:
|
419
|
+
raise ValueError(f"Expected a non-empty value for `path_uuid` but received {path_uuid!r}")
|
420
|
+
return self._put(
|
421
|
+
f"/v2/genai/agents/{path_uuid}/deployment_visibility",
|
422
|
+
body=maybe_transform(
|
423
|
+
{
|
424
|
+
"body_uuid": body_uuid,
|
425
|
+
"visibility": visibility,
|
426
|
+
},
|
427
|
+
agent_update_status_params.AgentUpdateStatusParams,
|
428
|
+
),
|
429
|
+
options=make_request_options(
|
430
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
431
|
+
),
|
432
|
+
cast_to=AgentUpdateStatusResponse,
|
433
|
+
)
|
434
|
+
|
435
|
+
|
436
|
+
class AsyncAgentsResource(AsyncAPIResource):
|
437
|
+
@cached_property
|
438
|
+
def api_keys(self) -> AsyncAPIKeysResource:
|
439
|
+
return AsyncAPIKeysResource(self._client)
|
440
|
+
|
441
|
+
@cached_property
|
442
|
+
def functions(self) -> AsyncFunctionsResource:
|
443
|
+
return AsyncFunctionsResource(self._client)
|
444
|
+
|
445
|
+
@cached_property
|
446
|
+
def versions(self) -> AsyncVersionsResource:
|
447
|
+
return AsyncVersionsResource(self._client)
|
448
|
+
|
449
|
+
@cached_property
|
450
|
+
def knowledge_bases(self) -> AsyncKnowledgeBasesResource:
|
451
|
+
return AsyncKnowledgeBasesResource(self._client)
|
452
|
+
|
453
|
+
@cached_property
|
454
|
+
def child_agents(self) -> AsyncChildAgentsResource:
|
455
|
+
return AsyncChildAgentsResource(self._client)
|
456
|
+
|
457
|
+
@cached_property
|
458
|
+
def with_raw_response(self) -> AsyncAgentsResourceWithRawResponse:
|
459
|
+
"""
|
460
|
+
This property can be used as a prefix for any HTTP method call to return
|
461
|
+
the raw response object instead of the parsed content.
|
462
|
+
|
463
|
+
For more information, see https://www.github.com/digitalocean/genai-python#accessing-raw-response-data-eg-headers
|
464
|
+
"""
|
465
|
+
return AsyncAgentsResourceWithRawResponse(self)
|
466
|
+
|
467
|
+
@cached_property
|
468
|
+
def with_streaming_response(self) -> AsyncAgentsResourceWithStreamingResponse:
|
469
|
+
"""
|
470
|
+
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
|
471
|
+
|
472
|
+
For more information, see https://www.github.com/digitalocean/genai-python#with_streaming_response
|
473
|
+
"""
|
474
|
+
return AsyncAgentsResourceWithStreamingResponse(self)
|
475
|
+
|
476
|
+
async def create(
|
477
|
+
self,
|
478
|
+
*,
|
479
|
+
anthropic_key_uuid: str | NotGiven = NOT_GIVEN,
|
480
|
+
description: str | NotGiven = NOT_GIVEN,
|
481
|
+
instruction: str | NotGiven = NOT_GIVEN,
|
482
|
+
knowledge_base_uuid: List[str] | NotGiven = NOT_GIVEN,
|
483
|
+
model_uuid: str | NotGiven = NOT_GIVEN,
|
484
|
+
name: str | NotGiven = NOT_GIVEN,
|
485
|
+
openai_key_uuid: str | NotGiven = NOT_GIVEN,
|
486
|
+
project_id: str | NotGiven = NOT_GIVEN,
|
487
|
+
region: str | NotGiven = NOT_GIVEN,
|
488
|
+
tags: List[str] | NotGiven = NOT_GIVEN,
|
489
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
490
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
491
|
+
extra_headers: Headers | None = None,
|
492
|
+
extra_query: Query | None = None,
|
493
|
+
extra_body: Body | None = None,
|
494
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
495
|
+
) -> AgentCreateResponse:
|
496
|
+
"""To create a new agent, send a POST request to `/v2/gen-ai/agents`.
|
497
|
+
|
498
|
+
The response
|
499
|
+
body contains a JSON object with the newly created agent object.
|
500
|
+
|
501
|
+
Args:
|
502
|
+
instruction: Agent instruction. Instructions help your agent to perform its job effectively.
|
503
|
+
See
|
504
|
+
[Write Effective Agent Instructions](https://docs.digitalocean.com/products/genai-platform/concepts/best-practices/#agent-instructions)
|
505
|
+
for best practices.
|
506
|
+
|
507
|
+
model_uuid: Identifier for the foundation model.
|
508
|
+
|
509
|
+
extra_headers: Send extra headers
|
510
|
+
|
511
|
+
extra_query: Add additional query parameters to the request
|
512
|
+
|
513
|
+
extra_body: Add additional JSON properties to the request
|
514
|
+
|
515
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
516
|
+
"""
|
517
|
+
return await self._post(
|
518
|
+
"/v2/genai/agents",
|
519
|
+
body=await async_maybe_transform(
|
520
|
+
{
|
521
|
+
"anthropic_key_uuid": anthropic_key_uuid,
|
522
|
+
"description": description,
|
523
|
+
"instruction": instruction,
|
524
|
+
"knowledge_base_uuid": knowledge_base_uuid,
|
525
|
+
"model_uuid": model_uuid,
|
526
|
+
"name": name,
|
527
|
+
"openai_key_uuid": openai_key_uuid,
|
528
|
+
"project_id": project_id,
|
529
|
+
"region": region,
|
530
|
+
"tags": tags,
|
531
|
+
},
|
532
|
+
agent_create_params.AgentCreateParams,
|
533
|
+
),
|
534
|
+
options=make_request_options(
|
535
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
536
|
+
),
|
537
|
+
cast_to=AgentCreateResponse,
|
538
|
+
)
|
539
|
+
|
540
|
+
async def retrieve(
|
541
|
+
self,
|
542
|
+
uuid: str,
|
543
|
+
*,
|
544
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
545
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
546
|
+
extra_headers: Headers | None = None,
|
547
|
+
extra_query: Query | None = None,
|
548
|
+
extra_body: Body | None = None,
|
549
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
550
|
+
) -> AgentRetrieveResponse:
|
551
|
+
"""To retrieve details of an agent, GET request to `/v2/gen-ai/agents/{uuid}`.
|
552
|
+
|
553
|
+
The
|
554
|
+
response body is a JSON object containing the agent.
|
555
|
+
|
556
|
+
Args:
|
557
|
+
extra_headers: Send extra headers
|
558
|
+
|
559
|
+
extra_query: Add additional query parameters to the request
|
560
|
+
|
561
|
+
extra_body: Add additional JSON properties to the request
|
562
|
+
|
563
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
564
|
+
"""
|
565
|
+
if not uuid:
|
566
|
+
raise ValueError(f"Expected a non-empty value for `uuid` but received {uuid!r}")
|
567
|
+
return await self._get(
|
568
|
+
f"/v2/genai/agents/{uuid}",
|
569
|
+
options=make_request_options(
|
570
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
571
|
+
),
|
572
|
+
cast_to=AgentRetrieveResponse,
|
573
|
+
)
|
574
|
+
|
575
|
+
async def update(
|
576
|
+
self,
|
577
|
+
path_uuid: str,
|
578
|
+
*,
|
579
|
+
anthropic_key_uuid: str | NotGiven = NOT_GIVEN,
|
580
|
+
description: str | NotGiven = NOT_GIVEN,
|
581
|
+
instruction: str | NotGiven = NOT_GIVEN,
|
582
|
+
k: int | NotGiven = NOT_GIVEN,
|
583
|
+
max_tokens: int | NotGiven = NOT_GIVEN,
|
584
|
+
model_uuid: str | NotGiven = NOT_GIVEN,
|
585
|
+
name: str | NotGiven = NOT_GIVEN,
|
586
|
+
openai_key_uuid: str | NotGiven = NOT_GIVEN,
|
587
|
+
project_id: str | NotGiven = NOT_GIVEN,
|
588
|
+
provide_citations: bool | NotGiven = NOT_GIVEN,
|
589
|
+
retrieval_method: APIRetrievalMethod | NotGiven = NOT_GIVEN,
|
590
|
+
tags: List[str] | NotGiven = NOT_GIVEN,
|
591
|
+
temperature: float | NotGiven = NOT_GIVEN,
|
592
|
+
top_p: float | NotGiven = NOT_GIVEN,
|
593
|
+
body_uuid: str | NotGiven = NOT_GIVEN,
|
594
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
595
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
596
|
+
extra_headers: Headers | None = None,
|
597
|
+
extra_query: Query | None = None,
|
598
|
+
extra_body: Body | None = None,
|
599
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
600
|
+
) -> AgentUpdateResponse:
|
601
|
+
"""To update an agent, send a PUT request to `/v2/gen-ai/agents/{uuid}`.
|
602
|
+
|
603
|
+
The
|
604
|
+
response body is a JSON object containing the agent.
|
605
|
+
|
606
|
+
Args:
|
607
|
+
instruction: Agent instruction. Instructions help your agent to perform its job effectively.
|
608
|
+
See
|
609
|
+
[Write Effective Agent Instructions](https://docs.digitalocean.com/products/genai-platform/concepts/best-practices/#agent-instructions)
|
610
|
+
for best practices.
|
611
|
+
|
612
|
+
max_tokens: Specifies the maximum number of tokens the model can process in a single input
|
613
|
+
or output, set as a number between 1 and 512. This determines the length of each
|
614
|
+
response.
|
615
|
+
|
616
|
+
model_uuid: Identifier for the foundation model.
|
617
|
+
|
618
|
+
temperature: Controls the model’s creativity, specified as a number between 0 and 1. Lower
|
619
|
+
values produce more predictable and conservative responses, while higher values
|
620
|
+
encourage creativity and variation.
|
621
|
+
|
622
|
+
top_p: Defines the cumulative probability threshold for word selection, specified as a
|
623
|
+
number between 0 and 1. Higher values allow for more diverse outputs, while
|
624
|
+
lower values ensure focused and coherent responses.
|
625
|
+
|
626
|
+
extra_headers: Send extra headers
|
627
|
+
|
628
|
+
extra_query: Add additional query parameters to the request
|
629
|
+
|
630
|
+
extra_body: Add additional JSON properties to the request
|
631
|
+
|
632
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
633
|
+
"""
|
634
|
+
if not path_uuid:
|
635
|
+
raise ValueError(f"Expected a non-empty value for `path_uuid` but received {path_uuid!r}")
|
636
|
+
return await self._put(
|
637
|
+
f"/v2/genai/agents/{path_uuid}",
|
638
|
+
body=await async_maybe_transform(
|
639
|
+
{
|
640
|
+
"anthropic_key_uuid": anthropic_key_uuid,
|
641
|
+
"description": description,
|
642
|
+
"instruction": instruction,
|
643
|
+
"k": k,
|
644
|
+
"max_tokens": max_tokens,
|
645
|
+
"model_uuid": model_uuid,
|
646
|
+
"name": name,
|
647
|
+
"openai_key_uuid": openai_key_uuid,
|
648
|
+
"project_id": project_id,
|
649
|
+
"provide_citations": provide_citations,
|
650
|
+
"retrieval_method": retrieval_method,
|
651
|
+
"tags": tags,
|
652
|
+
"temperature": temperature,
|
653
|
+
"top_p": top_p,
|
654
|
+
"body_uuid": body_uuid,
|
655
|
+
},
|
656
|
+
agent_update_params.AgentUpdateParams,
|
657
|
+
),
|
658
|
+
options=make_request_options(
|
659
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
660
|
+
),
|
661
|
+
cast_to=AgentUpdateResponse,
|
662
|
+
)
|
663
|
+
|
664
|
+
async def list(
|
665
|
+
self,
|
666
|
+
*,
|
667
|
+
only_deployed: bool | NotGiven = NOT_GIVEN,
|
668
|
+
page: int | NotGiven = NOT_GIVEN,
|
669
|
+
per_page: int | NotGiven = NOT_GIVEN,
|
670
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
671
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
672
|
+
extra_headers: Headers | None = None,
|
673
|
+
extra_query: Query | None = None,
|
674
|
+
extra_body: Body | None = None,
|
675
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
676
|
+
) -> AgentListResponse:
|
677
|
+
"""
|
678
|
+
To list all agents, send a GET request to `/v2/gen-ai/agents`.
|
679
|
+
|
680
|
+
Args:
|
681
|
+
only_deployed: only list agents that are deployed.
|
682
|
+
|
683
|
+
page: page number.
|
684
|
+
|
685
|
+
per_page: items per page.
|
686
|
+
|
687
|
+
extra_headers: Send extra headers
|
688
|
+
|
689
|
+
extra_query: Add additional query parameters to the request
|
690
|
+
|
691
|
+
extra_body: Add additional JSON properties to the request
|
692
|
+
|
693
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
694
|
+
"""
|
695
|
+
return await self._get(
|
696
|
+
"/v2/genai/agents",
|
697
|
+
options=make_request_options(
|
698
|
+
extra_headers=extra_headers,
|
699
|
+
extra_query=extra_query,
|
700
|
+
extra_body=extra_body,
|
701
|
+
timeout=timeout,
|
702
|
+
query=await async_maybe_transform(
|
703
|
+
{
|
704
|
+
"only_deployed": only_deployed,
|
705
|
+
"page": page,
|
706
|
+
"per_page": per_page,
|
707
|
+
},
|
708
|
+
agent_list_params.AgentListParams,
|
709
|
+
),
|
710
|
+
),
|
711
|
+
cast_to=AgentListResponse,
|
712
|
+
)
|
713
|
+
|
714
|
+
async def delete(
|
715
|
+
self,
|
716
|
+
uuid: str,
|
717
|
+
*,
|
718
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
719
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
720
|
+
extra_headers: Headers | None = None,
|
721
|
+
extra_query: Query | None = None,
|
722
|
+
extra_body: Body | None = None,
|
723
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
724
|
+
) -> AgentDeleteResponse:
|
725
|
+
"""
|
726
|
+
To delete an agent, send a DELETE request to `/v2/gen-ai/agents/{uuid}`.
|
727
|
+
|
728
|
+
Args:
|
729
|
+
extra_headers: Send extra headers
|
730
|
+
|
731
|
+
extra_query: Add additional query parameters to the request
|
732
|
+
|
733
|
+
extra_body: Add additional JSON properties to the request
|
734
|
+
|
735
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
736
|
+
"""
|
737
|
+
if not uuid:
|
738
|
+
raise ValueError(f"Expected a non-empty value for `uuid` but received {uuid!r}")
|
739
|
+
return await self._delete(
|
740
|
+
f"/v2/genai/agents/{uuid}",
|
741
|
+
options=make_request_options(
|
742
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
743
|
+
),
|
744
|
+
cast_to=AgentDeleteResponse,
|
745
|
+
)
|
746
|
+
|
747
|
+
async def update_status(
|
748
|
+
self,
|
749
|
+
path_uuid: str,
|
750
|
+
*,
|
751
|
+
body_uuid: str | NotGiven = NOT_GIVEN,
|
752
|
+
visibility: APIDeploymentVisibility | NotGiven = NOT_GIVEN,
|
753
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
754
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
755
|
+
extra_headers: Headers | None = None,
|
756
|
+
extra_query: Query | None = None,
|
757
|
+
extra_body: Body | None = None,
|
758
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
759
|
+
) -> AgentUpdateStatusResponse:
|
760
|
+
"""Check whether an agent is public or private.
|
761
|
+
|
762
|
+
To update the agent status, send a
|
763
|
+
PUT request to `/v2/gen-ai/agents/{uuid}/deployment_visibility`.
|
764
|
+
|
765
|
+
Args:
|
766
|
+
extra_headers: Send extra headers
|
767
|
+
|
768
|
+
extra_query: Add additional query parameters to the request
|
769
|
+
|
770
|
+
extra_body: Add additional JSON properties to the request
|
771
|
+
|
772
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
773
|
+
"""
|
774
|
+
if not path_uuid:
|
775
|
+
raise ValueError(f"Expected a non-empty value for `path_uuid` but received {path_uuid!r}")
|
776
|
+
return await self._put(
|
777
|
+
f"/v2/genai/agents/{path_uuid}/deployment_visibility",
|
778
|
+
body=await async_maybe_transform(
|
779
|
+
{
|
780
|
+
"body_uuid": body_uuid,
|
781
|
+
"visibility": visibility,
|
782
|
+
},
|
783
|
+
agent_update_status_params.AgentUpdateStatusParams,
|
784
|
+
),
|
785
|
+
options=make_request_options(
|
786
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
787
|
+
),
|
788
|
+
cast_to=AgentUpdateStatusResponse,
|
789
|
+
)
|
790
|
+
|
791
|
+
|
792
|
+
class AgentsResourceWithRawResponse:
|
793
|
+
def __init__(self, agents: AgentsResource) -> None:
|
794
|
+
self._agents = agents
|
795
|
+
|
796
|
+
self.create = to_raw_response_wrapper(
|
797
|
+
agents.create,
|
798
|
+
)
|
799
|
+
self.retrieve = to_raw_response_wrapper(
|
800
|
+
agents.retrieve,
|
801
|
+
)
|
802
|
+
self.update = to_raw_response_wrapper(
|
803
|
+
agents.update,
|
804
|
+
)
|
805
|
+
self.list = to_raw_response_wrapper(
|
806
|
+
agents.list,
|
807
|
+
)
|
808
|
+
self.delete = to_raw_response_wrapper(
|
809
|
+
agents.delete,
|
810
|
+
)
|
811
|
+
self.update_status = to_raw_response_wrapper(
|
812
|
+
agents.update_status,
|
813
|
+
)
|
814
|
+
|
815
|
+
@cached_property
|
816
|
+
def api_keys(self) -> APIKeysResourceWithRawResponse:
|
817
|
+
return APIKeysResourceWithRawResponse(self._agents.api_keys)
|
818
|
+
|
819
|
+
@cached_property
|
820
|
+
def functions(self) -> FunctionsResourceWithRawResponse:
|
821
|
+
return FunctionsResourceWithRawResponse(self._agents.functions)
|
822
|
+
|
823
|
+
@cached_property
|
824
|
+
def versions(self) -> VersionsResourceWithRawResponse:
|
825
|
+
return VersionsResourceWithRawResponse(self._agents.versions)
|
826
|
+
|
827
|
+
@cached_property
|
828
|
+
def knowledge_bases(self) -> KnowledgeBasesResourceWithRawResponse:
|
829
|
+
return KnowledgeBasesResourceWithRawResponse(self._agents.knowledge_bases)
|
830
|
+
|
831
|
+
@cached_property
|
832
|
+
def child_agents(self) -> ChildAgentsResourceWithRawResponse:
|
833
|
+
return ChildAgentsResourceWithRawResponse(self._agents.child_agents)
|
834
|
+
|
835
|
+
|
836
|
+
class AsyncAgentsResourceWithRawResponse:
|
837
|
+
def __init__(self, agents: AsyncAgentsResource) -> None:
|
838
|
+
self._agents = agents
|
839
|
+
|
840
|
+
self.create = async_to_raw_response_wrapper(
|
841
|
+
agents.create,
|
842
|
+
)
|
843
|
+
self.retrieve = async_to_raw_response_wrapper(
|
844
|
+
agents.retrieve,
|
845
|
+
)
|
846
|
+
self.update = async_to_raw_response_wrapper(
|
847
|
+
agents.update,
|
848
|
+
)
|
849
|
+
self.list = async_to_raw_response_wrapper(
|
850
|
+
agents.list,
|
851
|
+
)
|
852
|
+
self.delete = async_to_raw_response_wrapper(
|
853
|
+
agents.delete,
|
854
|
+
)
|
855
|
+
self.update_status = async_to_raw_response_wrapper(
|
856
|
+
agents.update_status,
|
857
|
+
)
|
858
|
+
|
859
|
+
@cached_property
|
860
|
+
def api_keys(self) -> AsyncAPIKeysResourceWithRawResponse:
|
861
|
+
return AsyncAPIKeysResourceWithRawResponse(self._agents.api_keys)
|
862
|
+
|
863
|
+
@cached_property
|
864
|
+
def functions(self) -> AsyncFunctionsResourceWithRawResponse:
|
865
|
+
return AsyncFunctionsResourceWithRawResponse(self._agents.functions)
|
866
|
+
|
867
|
+
@cached_property
|
868
|
+
def versions(self) -> AsyncVersionsResourceWithRawResponse:
|
869
|
+
return AsyncVersionsResourceWithRawResponse(self._agents.versions)
|
870
|
+
|
871
|
+
@cached_property
|
872
|
+
def knowledge_bases(self) -> AsyncKnowledgeBasesResourceWithRawResponse:
|
873
|
+
return AsyncKnowledgeBasesResourceWithRawResponse(self._agents.knowledge_bases)
|
874
|
+
|
875
|
+
@cached_property
|
876
|
+
def child_agents(self) -> AsyncChildAgentsResourceWithRawResponse:
|
877
|
+
return AsyncChildAgentsResourceWithRawResponse(self._agents.child_agents)
|
878
|
+
|
879
|
+
|
880
|
+
class AgentsResourceWithStreamingResponse:
|
881
|
+
def __init__(self, agents: AgentsResource) -> None:
|
882
|
+
self._agents = agents
|
883
|
+
|
884
|
+
self.create = to_streamed_response_wrapper(
|
885
|
+
agents.create,
|
886
|
+
)
|
887
|
+
self.retrieve = to_streamed_response_wrapper(
|
888
|
+
agents.retrieve,
|
889
|
+
)
|
890
|
+
self.update = to_streamed_response_wrapper(
|
891
|
+
agents.update,
|
892
|
+
)
|
893
|
+
self.list = to_streamed_response_wrapper(
|
894
|
+
agents.list,
|
895
|
+
)
|
896
|
+
self.delete = to_streamed_response_wrapper(
|
897
|
+
agents.delete,
|
898
|
+
)
|
899
|
+
self.update_status = to_streamed_response_wrapper(
|
900
|
+
agents.update_status,
|
901
|
+
)
|
902
|
+
|
903
|
+
@cached_property
|
904
|
+
def api_keys(self) -> APIKeysResourceWithStreamingResponse:
|
905
|
+
return APIKeysResourceWithStreamingResponse(self._agents.api_keys)
|
906
|
+
|
907
|
+
@cached_property
|
908
|
+
def functions(self) -> FunctionsResourceWithStreamingResponse:
|
909
|
+
return FunctionsResourceWithStreamingResponse(self._agents.functions)
|
910
|
+
|
911
|
+
@cached_property
|
912
|
+
def versions(self) -> VersionsResourceWithStreamingResponse:
|
913
|
+
return VersionsResourceWithStreamingResponse(self._agents.versions)
|
914
|
+
|
915
|
+
@cached_property
|
916
|
+
def knowledge_bases(self) -> KnowledgeBasesResourceWithStreamingResponse:
|
917
|
+
return KnowledgeBasesResourceWithStreamingResponse(self._agents.knowledge_bases)
|
918
|
+
|
919
|
+
@cached_property
|
920
|
+
def child_agents(self) -> ChildAgentsResourceWithStreamingResponse:
|
921
|
+
return ChildAgentsResourceWithStreamingResponse(self._agents.child_agents)
|
922
|
+
|
923
|
+
|
924
|
+
class AsyncAgentsResourceWithStreamingResponse:
|
925
|
+
def __init__(self, agents: AsyncAgentsResource) -> None:
|
926
|
+
self._agents = agents
|
927
|
+
|
928
|
+
self.create = async_to_streamed_response_wrapper(
|
929
|
+
agents.create,
|
930
|
+
)
|
931
|
+
self.retrieve = async_to_streamed_response_wrapper(
|
932
|
+
agents.retrieve,
|
933
|
+
)
|
934
|
+
self.update = async_to_streamed_response_wrapper(
|
935
|
+
agents.update,
|
936
|
+
)
|
937
|
+
self.list = async_to_streamed_response_wrapper(
|
938
|
+
agents.list,
|
939
|
+
)
|
940
|
+
self.delete = async_to_streamed_response_wrapper(
|
941
|
+
agents.delete,
|
942
|
+
)
|
943
|
+
self.update_status = async_to_streamed_response_wrapper(
|
944
|
+
agents.update_status,
|
945
|
+
)
|
946
|
+
|
947
|
+
@cached_property
|
948
|
+
def api_keys(self) -> AsyncAPIKeysResourceWithStreamingResponse:
|
949
|
+
return AsyncAPIKeysResourceWithStreamingResponse(self._agents.api_keys)
|
950
|
+
|
951
|
+
@cached_property
|
952
|
+
def functions(self) -> AsyncFunctionsResourceWithStreamingResponse:
|
953
|
+
return AsyncFunctionsResourceWithStreamingResponse(self._agents.functions)
|
954
|
+
|
955
|
+
@cached_property
|
956
|
+
def versions(self) -> AsyncVersionsResourceWithStreamingResponse:
|
957
|
+
return AsyncVersionsResourceWithStreamingResponse(self._agents.versions)
|
958
|
+
|
959
|
+
@cached_property
|
960
|
+
def knowledge_bases(self) -> AsyncKnowledgeBasesResourceWithStreamingResponse:
|
961
|
+
return AsyncKnowledgeBasesResourceWithStreamingResponse(self._agents.knowledge_bases)
|
962
|
+
|
963
|
+
@cached_property
|
964
|
+
def child_agents(self) -> AsyncChildAgentsResourceWithStreamingResponse:
|
965
|
+
return AsyncChildAgentsResourceWithStreamingResponse(self._agents.child_agents)
|