c63a5cfe-b235-4fbe-8bbb-82a9e02a482a-python 0.1.0a4__py3-none-any.whl → 0.1.0a6__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.0a4.dist-info → c63a5cfe_b235_4fbe_8bbb_82a9e02a482a_python-0.1.0a6.dist-info}/METADATA +41 -16
- c63a5cfe_b235_4fbe_8bbb_82a9e02a482a_python-0.1.0a6.dist-info/RECORD +230 -0
- gradientai/_client.py +73 -71
- gradientai/_version.py +1 -1
- gradientai/resources/__init__.py +14 -28
- gradientai/resources/agents/__init__.py +69 -13
- gradientai/resources/agents/agents.py +148 -20
- gradientai/resources/{regions → agents}/evaluation_datasets.py +3 -3
- gradientai/resources/agents/evaluation_metrics/__init__.py +33 -0
- gradientai/resources/agents/evaluation_metrics/evaluation_metrics.py +177 -0
- gradientai/resources/agents/evaluation_metrics/workspaces/__init__.py +33 -0
- gradientai/resources/agents/evaluation_metrics/workspaces/agents.py +324 -0
- gradientai/resources/agents/evaluation_metrics/workspaces/workspaces.py +654 -0
- gradientai/resources/{regions/evaluation_runs → agents}/evaluation_runs.py +197 -47
- gradientai/resources/{regions → agents}/evaluation_test_cases.py +30 -9
- gradientai/resources/agents/{child_agents.py → routes.py} +64 -64
- gradientai/resources/chat/completions.py +20 -2
- gradientai/resources/inference/__init__.py +0 -14
- gradientai/resources/inference/inference.py +0 -32
- gradientai/resources/knowledge_bases/__init__.py +14 -0
- gradientai/resources/{indexing_jobs.py → knowledge_bases/indexing_jobs.py} +16 -12
- gradientai/resources/knowledge_bases/knowledge_bases.py +32 -0
- gradientai/resources/{providers → model_providers}/__init__.py +13 -13
- gradientai/resources/{providers → model_providers}/anthropic/keys.py +12 -7
- gradientai/resources/{providers/providers.py → model_providers/model_providers.py} +31 -31
- gradientai/resources/{providers → model_providers}/openai/keys.py +12 -7
- gradientai/resources/models.py +77 -105
- gradientai/resources/regions.py +195 -0
- gradientai/types/__init__.py +2 -17
- gradientai/types/agent_list_response.py +2 -2
- gradientai/types/agents/__init__.py +44 -8
- gradientai/types/{api_evaluation_metric.py → agents/api_evaluation_metric.py} +1 -1
- gradientai/types/{regions/evaluation_runs → agents}/api_evaluation_metric_result.py +1 -1
- gradientai/types/{regions/evaluation_runs/api_prompt.py → agents/api_evaluation_prompt.py} +3 -3
- gradientai/types/{regions/evaluation_runs → agents}/api_evaluation_run.py +13 -1
- gradientai/types/{regions → agents}/api_evaluation_test_case.py +1 -1
- gradientai/types/agents/api_key_list_response.py +2 -2
- gradientai/types/{region_list_evaluation_metrics_response.py → agents/evaluation_metric_list_response.py} +3 -3
- gradientai/types/agents/evaluation_metrics/__init__.py +14 -0
- gradientai/types/agents/evaluation_metrics/workspace_create_params.py +16 -0
- gradientai/types/agents/evaluation_metrics/workspace_create_response.py +16 -0
- gradientai/types/agents/evaluation_metrics/workspace_delete_response.py +11 -0
- gradientai/types/agents/evaluation_metrics/workspace_list_evaluation_test_cases_response.py +12 -0
- gradientai/types/agents/evaluation_metrics/workspace_list_response.py +16 -0
- gradientai/types/agents/evaluation_metrics/workspace_retrieve_response.py +16 -0
- gradientai/types/agents/evaluation_metrics/workspace_update_params.py +18 -0
- gradientai/types/agents/evaluation_metrics/workspace_update_response.py +16 -0
- gradientai/types/agents/evaluation_metrics/workspaces/__init__.py +8 -0
- gradientai/types/agents/evaluation_metrics/workspaces/agent_list_params.py +26 -0
- gradientai/types/agents/evaluation_metrics/workspaces/agent_list_response.py +22 -0
- gradientai/types/agents/evaluation_metrics/workspaces/agent_move_params.py +16 -0
- gradientai/types/agents/evaluation_metrics/workspaces/agent_move_response.py +16 -0
- gradientai/types/{regions → agents}/evaluation_run_create_params.py +3 -2
- gradientai/types/{regions → agents}/evaluation_run_create_response.py +2 -2
- gradientai/types/{regions/evaluation_runs/result_retrieve_response.py → agents/evaluation_run_list_results_response.py} +5 -5
- gradientai/types/{regions → agents}/evaluation_run_retrieve_response.py +1 -1
- gradientai/types/agents/evaluation_run_retrieve_results_response.py +12 -0
- gradientai/types/{regions → agents}/evaluation_test_case_list_evaluation_runs_response.py +1 -1
- gradientai/types/agents/evaluation_test_case_retrieve_params.py +12 -0
- gradientai/types/agents/{child_agent_add_params.py → route_add_params.py} +2 -2
- gradientai/types/agents/{child_agent_add_response.py → route_add_response.py} +2 -2
- gradientai/types/agents/{child_agent_delete_response.py → route_delete_response.py} +2 -2
- gradientai/types/agents/{child_agent_update_params.py → route_update_params.py} +2 -2
- gradientai/types/agents/{child_agent_update_response.py → route_update_response.py} +2 -2
- gradientai/types/agents/{child_agent_view_response.py → route_view_response.py} +2 -2
- gradientai/types/agents/version_list_response.py +2 -2
- gradientai/types/api_knowledge_base.py +1 -1
- gradientai/types/api_workspace.py +1 -1
- gradientai/types/inference/__init__.py +0 -2
- gradientai/types/inference/api_key_list_response.py +2 -2
- gradientai/types/knowledge_base_list_response.py +2 -2
- gradientai/types/knowledge_bases/__init__.py +12 -0
- gradientai/types/{indexing_job_retrieve_data_sources_response.py → knowledge_bases/api_indexed_data_source.py} +4 -8
- gradientai/types/{api_indexing_job.py → knowledge_bases/api_indexing_job.py} +13 -1
- gradientai/types/knowledge_bases/api_knowledge_base_data_source.py +4 -1
- gradientai/types/knowledge_bases/data_source_list_response.py +2 -2
- gradientai/types/{indexing_job_create_response.py → knowledge_bases/indexing_job_create_response.py} +1 -1
- gradientai/types/{indexing_job_list_response.py → knowledge_bases/indexing_job_list_response.py} +3 -3
- gradientai/types/knowledge_bases/indexing_job_retrieve_data_sources_response.py +12 -0
- gradientai/types/{indexing_job_retrieve_response.py → knowledge_bases/indexing_job_retrieve_response.py} +1 -1
- gradientai/types/{indexing_job_update_cancel_params.py → knowledge_bases/indexing_job_update_cancel_params.py} +1 -1
- gradientai/types/{indexing_job_update_cancel_response.py → knowledge_bases/indexing_job_update_cancel_response.py} +1 -1
- gradientai/types/{inference/model.py → model.py} +1 -1
- gradientai/types/model_list_response.py +5 -8
- gradientai/types/{providers → model_providers}/anthropic/key_list_agents_response.py +2 -2
- gradientai/types/{providers → model_providers}/anthropic/key_list_response.py +2 -2
- gradientai/types/{providers → model_providers}/openai/key_list_response.py +2 -2
- gradientai/types/{providers → model_providers}/openai/key_retrieve_agents_response.py +2 -2
- gradientai/types/shared/__init__.py +4 -0
- c63a5cfe_b235_4fbe_8bbb_82a9e02a482a_python-0.1.0a4.dist-info/RECORD +0 -217
- gradientai/resources/inference/models.py +0 -226
- gradientai/resources/regions/__init__.py +0 -61
- gradientai/resources/regions/evaluation_runs/__init__.py +0 -33
- gradientai/resources/regions/evaluation_runs/results.py +0 -264
- gradientai/resources/regions/regions.py +0 -352
- gradientai/types/api_model.py +0 -32
- gradientai/types/inference/model_list_response.py +0 -15
- gradientai/types/model_list_params.py +0 -42
- gradientai/types/regions/__init__.py +0 -32
- gradientai/types/regions/evaluation_runs/__init__.py +0 -9
- gradientai/types/regions/evaluation_runs/result_retrieve_prompt_response.py +0 -12
- {c63a5cfe_b235_4fbe_8bbb_82a9e02a482a_python-0.1.0a4.dist-info → c63a5cfe_b235_4fbe_8bbb_82a9e02a482a_python-0.1.0a6.dist-info}/WHEEL +0 -0
- {c63a5cfe_b235_4fbe_8bbb_82a9e02a482a_python-0.1.0a4.dist-info → c63a5cfe_b235_4fbe_8bbb_82a9e02a482a_python-0.1.0a6.dist-info}/licenses/LICENSE +0 -0
- /gradientai/resources/{providers → model_providers}/anthropic/__init__.py +0 -0
- /gradientai/resources/{providers → model_providers}/anthropic/anthropic.py +0 -0
- /gradientai/resources/{providers → model_providers}/openai/__init__.py +0 -0
- /gradientai/resources/{providers → model_providers}/openai/openai.py +0 -0
- /gradientai/types/{regions → agents}/api_star_metric.py +0 -0
- /gradientai/types/{regions → agents}/api_star_metric_param.py +0 -0
- /gradientai/types/{regions → agents}/evaluation_dataset_create_file_upload_presigned_urls_params.py +0 -0
- /gradientai/types/{regions → agents}/evaluation_dataset_create_file_upload_presigned_urls_response.py +0 -0
- /gradientai/types/{regions → agents}/evaluation_dataset_create_params.py +0 -0
- /gradientai/types/{regions → agents}/evaluation_dataset_create_response.py +0 -0
- /gradientai/types/{regions → agents}/evaluation_test_case_create_params.py +0 -0
- /gradientai/types/{regions → agents}/evaluation_test_case_create_response.py +0 -0
- /gradientai/types/{regions → agents}/evaluation_test_case_list_evaluation_runs_params.py +0 -0
- /gradientai/types/{regions → agents}/evaluation_test_case_list_response.py +0 -0
- /gradientai/types/{regions → agents}/evaluation_test_case_retrieve_response.py +0 -0
- /gradientai/types/{regions → agents}/evaluation_test_case_update_params.py +0 -0
- /gradientai/types/{regions → agents}/evaluation_test_case_update_response.py +0 -0
- /gradientai/types/{indexing_job_create_params.py → knowledge_bases/indexing_job_create_params.py} +0 -0
- /gradientai/types/{indexing_job_list_params.py → knowledge_bases/indexing_job_list_params.py} +0 -0
- /gradientai/types/{providers → model_providers}/__init__.py +0 -0
- /gradientai/types/{providers → model_providers}/anthropic/__init__.py +0 -0
- /gradientai/types/{providers → model_providers}/anthropic/key_create_params.py +0 -0
- /gradientai/types/{providers → model_providers}/anthropic/key_create_response.py +0 -0
- /gradientai/types/{providers → model_providers}/anthropic/key_delete_response.py +0 -0
- /gradientai/types/{providers → model_providers}/anthropic/key_list_agents_params.py +0 -0
- /gradientai/types/{providers → model_providers}/anthropic/key_list_params.py +0 -0
- /gradientai/types/{providers → model_providers}/anthropic/key_retrieve_response.py +0 -0
- /gradientai/types/{providers → model_providers}/anthropic/key_update_params.py +0 -0
- /gradientai/types/{providers → model_providers}/anthropic/key_update_response.py +0 -0
- /gradientai/types/{providers → model_providers}/openai/__init__.py +0 -0
- /gradientai/types/{providers → model_providers}/openai/key_create_params.py +0 -0
- /gradientai/types/{providers → model_providers}/openai/key_create_response.py +0 -0
- /gradientai/types/{providers → model_providers}/openai/key_delete_response.py +0 -0
- /gradientai/types/{providers → model_providers}/openai/key_list_params.py +0 -0
- /gradientai/types/{providers → model_providers}/openai/key_retrieve_agents_params.py +0 -0
- /gradientai/types/{providers → model_providers}/openai/key_retrieve_response.py +0 -0
- /gradientai/types/{providers → model_providers}/openai/key_update_params.py +0 -0
- /gradientai/types/{providers → model_providers}/openai/key_update_response.py +0 -0
- /gradientai/types/{agents → shared}/api_links.py +0 -0
- /gradientai/types/{agents → shared}/api_meta.py +0 -0
@@ -2,39 +2,31 @@
|
|
2
2
|
|
3
3
|
from __future__ import annotations
|
4
4
|
|
5
|
+
from typing import List
|
6
|
+
|
5
7
|
import httpx
|
6
8
|
|
7
|
-
from
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
ResultsResourceWithStreamingResponse,
|
13
|
-
AsyncResultsResourceWithStreamingResponse,
|
14
|
-
)
|
15
|
-
from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven
|
16
|
-
from ...._utils import maybe_transform, async_maybe_transform
|
17
|
-
from ...._compat import cached_property
|
18
|
-
from ...._resource import SyncAPIResource, AsyncAPIResource
|
19
|
-
from ...._response import (
|
9
|
+
from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven
|
10
|
+
from ..._utils import maybe_transform, async_maybe_transform
|
11
|
+
from ..._compat import cached_property
|
12
|
+
from ..._resource import SyncAPIResource, AsyncAPIResource
|
13
|
+
from ..._response import (
|
20
14
|
to_raw_response_wrapper,
|
21
15
|
to_streamed_response_wrapper,
|
22
16
|
async_to_raw_response_wrapper,
|
23
17
|
async_to_streamed_response_wrapper,
|
24
18
|
)
|
25
|
-
from
|
26
|
-
from
|
27
|
-
from
|
28
|
-
from
|
19
|
+
from ..._base_client import make_request_options
|
20
|
+
from ...types.agents import evaluation_run_create_params
|
21
|
+
from ...types.agents.evaluation_run_create_response import EvaluationRunCreateResponse
|
22
|
+
from ...types.agents.evaluation_run_retrieve_response import EvaluationRunRetrieveResponse
|
23
|
+
from ...types.agents.evaluation_run_list_results_response import EvaluationRunListResultsResponse
|
24
|
+
from ...types.agents.evaluation_run_retrieve_results_response import EvaluationRunRetrieveResultsResponse
|
29
25
|
|
30
26
|
__all__ = ["EvaluationRunsResource", "AsyncEvaluationRunsResource"]
|
31
27
|
|
32
28
|
|
33
29
|
class EvaluationRunsResource(SyncAPIResource):
|
34
|
-
@cached_property
|
35
|
-
def results(self) -> ResultsResource:
|
36
|
-
return ResultsResource(self._client)
|
37
|
-
|
38
30
|
@cached_property
|
39
31
|
def with_raw_response(self) -> EvaluationRunsResourceWithRawResponse:
|
40
32
|
"""
|
@@ -57,7 +49,7 @@ class EvaluationRunsResource(SyncAPIResource):
|
|
57
49
|
def create(
|
58
50
|
self,
|
59
51
|
*,
|
60
|
-
|
52
|
+
agent_uuids: List[str] | NotGiven = NOT_GIVEN,
|
61
53
|
run_name: str | NotGiven = NOT_GIVEN,
|
62
54
|
test_case_uuid: str | NotGiven = NOT_GIVEN,
|
63
55
|
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
@@ -72,7 +64,7 @@ class EvaluationRunsResource(SyncAPIResource):
|
|
72
64
|
`/v2/gen-ai/evaluation_runs`.
|
73
65
|
|
74
66
|
Args:
|
75
|
-
|
67
|
+
agent_uuids: Agent UUIDs to run the test case against.
|
76
68
|
|
77
69
|
run_name: The name of the run.
|
78
70
|
|
@@ -90,7 +82,7 @@ class EvaluationRunsResource(SyncAPIResource):
|
|
90
82
|
else "https://api.digitalocean.com/v2/gen-ai/evaluation_runs",
|
91
83
|
body=maybe_transform(
|
92
84
|
{
|
93
|
-
"
|
85
|
+
"agent_uuids": agent_uuids,
|
94
86
|
"run_name": run_name,
|
95
87
|
"test_case_uuid": test_case_uuid,
|
96
88
|
},
|
@@ -140,12 +132,85 @@ class EvaluationRunsResource(SyncAPIResource):
|
|
140
132
|
cast_to=EvaluationRunRetrieveResponse,
|
141
133
|
)
|
142
134
|
|
135
|
+
def list_results(
|
136
|
+
self,
|
137
|
+
evaluation_run_uuid: str,
|
138
|
+
*,
|
139
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
140
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
141
|
+
extra_headers: Headers | None = None,
|
142
|
+
extra_query: Query | None = None,
|
143
|
+
extra_body: Body | None = None,
|
144
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
145
|
+
) -> EvaluationRunListResultsResponse:
|
146
|
+
"""
|
147
|
+
To retrieve results of an evaluation run, send a GET request to
|
148
|
+
`/v2/gen-ai/evaluation_runs/{evaluation_run_uuid}/results`.
|
143
149
|
|
144
|
-
|
145
|
-
|
146
|
-
def results(self) -> AsyncResultsResource:
|
147
|
-
return AsyncResultsResource(self._client)
|
150
|
+
Args:
|
151
|
+
extra_headers: Send extra headers
|
148
152
|
|
153
|
+
extra_query: Add additional query parameters to the request
|
154
|
+
|
155
|
+
extra_body: Add additional JSON properties to the request
|
156
|
+
|
157
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
158
|
+
"""
|
159
|
+
if not evaluation_run_uuid:
|
160
|
+
raise ValueError(
|
161
|
+
f"Expected a non-empty value for `evaluation_run_uuid` but received {evaluation_run_uuid!r}"
|
162
|
+
)
|
163
|
+
return self._get(
|
164
|
+
f"/v2/gen-ai/evaluation_runs/{evaluation_run_uuid}/results"
|
165
|
+
if self._client._base_url_overridden
|
166
|
+
else f"https://api.digitalocean.com/v2/gen-ai/evaluation_runs/{evaluation_run_uuid}/results",
|
167
|
+
options=make_request_options(
|
168
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
169
|
+
),
|
170
|
+
cast_to=EvaluationRunListResultsResponse,
|
171
|
+
)
|
172
|
+
|
173
|
+
def retrieve_results(
|
174
|
+
self,
|
175
|
+
prompt_id: int,
|
176
|
+
*,
|
177
|
+
evaluation_run_uuid: str,
|
178
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
179
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
180
|
+
extra_headers: Headers | None = None,
|
181
|
+
extra_query: Query | None = None,
|
182
|
+
extra_body: Body | None = None,
|
183
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
184
|
+
) -> EvaluationRunRetrieveResultsResponse:
|
185
|
+
"""
|
186
|
+
To retrieve results of an evaluation run, send a GET request to
|
187
|
+
`/v2/gen-ai/evaluation_runs/{evaluation_run_uuid}/results/{prompt_id}`.
|
188
|
+
|
189
|
+
Args:
|
190
|
+
extra_headers: Send extra headers
|
191
|
+
|
192
|
+
extra_query: Add additional query parameters to the request
|
193
|
+
|
194
|
+
extra_body: Add additional JSON properties to the request
|
195
|
+
|
196
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
197
|
+
"""
|
198
|
+
if not evaluation_run_uuid:
|
199
|
+
raise ValueError(
|
200
|
+
f"Expected a non-empty value for `evaluation_run_uuid` but received {evaluation_run_uuid!r}"
|
201
|
+
)
|
202
|
+
return self._get(
|
203
|
+
f"/v2/gen-ai/evaluation_runs/{evaluation_run_uuid}/results/{prompt_id}"
|
204
|
+
if self._client._base_url_overridden
|
205
|
+
else f"https://api.digitalocean.com/v2/gen-ai/evaluation_runs/{evaluation_run_uuid}/results/{prompt_id}",
|
206
|
+
options=make_request_options(
|
207
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
208
|
+
),
|
209
|
+
cast_to=EvaluationRunRetrieveResultsResponse,
|
210
|
+
)
|
211
|
+
|
212
|
+
|
213
|
+
class AsyncEvaluationRunsResource(AsyncAPIResource):
|
149
214
|
@cached_property
|
150
215
|
def with_raw_response(self) -> AsyncEvaluationRunsResourceWithRawResponse:
|
151
216
|
"""
|
@@ -168,7 +233,7 @@ class AsyncEvaluationRunsResource(AsyncAPIResource):
|
|
168
233
|
async def create(
|
169
234
|
self,
|
170
235
|
*,
|
171
|
-
|
236
|
+
agent_uuids: List[str] | NotGiven = NOT_GIVEN,
|
172
237
|
run_name: str | NotGiven = NOT_GIVEN,
|
173
238
|
test_case_uuid: str | NotGiven = NOT_GIVEN,
|
174
239
|
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
@@ -183,7 +248,7 @@ class AsyncEvaluationRunsResource(AsyncAPIResource):
|
|
183
248
|
`/v2/gen-ai/evaluation_runs`.
|
184
249
|
|
185
250
|
Args:
|
186
|
-
|
251
|
+
agent_uuids: Agent UUIDs to run the test case against.
|
187
252
|
|
188
253
|
run_name: The name of the run.
|
189
254
|
|
@@ -201,7 +266,7 @@ class AsyncEvaluationRunsResource(AsyncAPIResource):
|
|
201
266
|
else "https://api.digitalocean.com/v2/gen-ai/evaluation_runs",
|
202
267
|
body=await async_maybe_transform(
|
203
268
|
{
|
204
|
-
"
|
269
|
+
"agent_uuids": agent_uuids,
|
205
270
|
"run_name": run_name,
|
206
271
|
"test_case_uuid": test_case_uuid,
|
207
272
|
},
|
@@ -251,6 +316,83 @@ class AsyncEvaluationRunsResource(AsyncAPIResource):
|
|
251
316
|
cast_to=EvaluationRunRetrieveResponse,
|
252
317
|
)
|
253
318
|
|
319
|
+
async def list_results(
|
320
|
+
self,
|
321
|
+
evaluation_run_uuid: str,
|
322
|
+
*,
|
323
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
324
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
325
|
+
extra_headers: Headers | None = None,
|
326
|
+
extra_query: Query | None = None,
|
327
|
+
extra_body: Body | None = None,
|
328
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
329
|
+
) -> EvaluationRunListResultsResponse:
|
330
|
+
"""
|
331
|
+
To retrieve results of an evaluation run, send a GET request to
|
332
|
+
`/v2/gen-ai/evaluation_runs/{evaluation_run_uuid}/results`.
|
333
|
+
|
334
|
+
Args:
|
335
|
+
extra_headers: Send extra headers
|
336
|
+
|
337
|
+
extra_query: Add additional query parameters to the request
|
338
|
+
|
339
|
+
extra_body: Add additional JSON properties to the request
|
340
|
+
|
341
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
342
|
+
"""
|
343
|
+
if not evaluation_run_uuid:
|
344
|
+
raise ValueError(
|
345
|
+
f"Expected a non-empty value for `evaluation_run_uuid` but received {evaluation_run_uuid!r}"
|
346
|
+
)
|
347
|
+
return await self._get(
|
348
|
+
f"/v2/gen-ai/evaluation_runs/{evaluation_run_uuid}/results"
|
349
|
+
if self._client._base_url_overridden
|
350
|
+
else f"https://api.digitalocean.com/v2/gen-ai/evaluation_runs/{evaluation_run_uuid}/results",
|
351
|
+
options=make_request_options(
|
352
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
353
|
+
),
|
354
|
+
cast_to=EvaluationRunListResultsResponse,
|
355
|
+
)
|
356
|
+
|
357
|
+
async def retrieve_results(
|
358
|
+
self,
|
359
|
+
prompt_id: int,
|
360
|
+
*,
|
361
|
+
evaluation_run_uuid: str,
|
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
|
+
) -> EvaluationRunRetrieveResultsResponse:
|
369
|
+
"""
|
370
|
+
To retrieve results of an evaluation run, send a GET request to
|
371
|
+
`/v2/gen-ai/evaluation_runs/{evaluation_run_uuid}/results/{prompt_id}`.
|
372
|
+
|
373
|
+
Args:
|
374
|
+
extra_headers: Send extra headers
|
375
|
+
|
376
|
+
extra_query: Add additional query parameters to the request
|
377
|
+
|
378
|
+
extra_body: Add additional JSON properties to the request
|
379
|
+
|
380
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
381
|
+
"""
|
382
|
+
if not evaluation_run_uuid:
|
383
|
+
raise ValueError(
|
384
|
+
f"Expected a non-empty value for `evaluation_run_uuid` but received {evaluation_run_uuid!r}"
|
385
|
+
)
|
386
|
+
return await self._get(
|
387
|
+
f"/v2/gen-ai/evaluation_runs/{evaluation_run_uuid}/results/{prompt_id}"
|
388
|
+
if self._client._base_url_overridden
|
389
|
+
else f"https://api.digitalocean.com/v2/gen-ai/evaluation_runs/{evaluation_run_uuid}/results/{prompt_id}",
|
390
|
+
options=make_request_options(
|
391
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
392
|
+
),
|
393
|
+
cast_to=EvaluationRunRetrieveResultsResponse,
|
394
|
+
)
|
395
|
+
|
254
396
|
|
255
397
|
class EvaluationRunsResourceWithRawResponse:
|
256
398
|
def __init__(self, evaluation_runs: EvaluationRunsResource) -> None:
|
@@ -262,10 +404,12 @@ class EvaluationRunsResourceWithRawResponse:
|
|
262
404
|
self.retrieve = to_raw_response_wrapper(
|
263
405
|
evaluation_runs.retrieve,
|
264
406
|
)
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
407
|
+
self.list_results = to_raw_response_wrapper(
|
408
|
+
evaluation_runs.list_results,
|
409
|
+
)
|
410
|
+
self.retrieve_results = to_raw_response_wrapper(
|
411
|
+
evaluation_runs.retrieve_results,
|
412
|
+
)
|
269
413
|
|
270
414
|
|
271
415
|
class AsyncEvaluationRunsResourceWithRawResponse:
|
@@ -278,10 +422,12 @@ class AsyncEvaluationRunsResourceWithRawResponse:
|
|
278
422
|
self.retrieve = async_to_raw_response_wrapper(
|
279
423
|
evaluation_runs.retrieve,
|
280
424
|
)
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
425
|
+
self.list_results = async_to_raw_response_wrapper(
|
426
|
+
evaluation_runs.list_results,
|
427
|
+
)
|
428
|
+
self.retrieve_results = async_to_raw_response_wrapper(
|
429
|
+
evaluation_runs.retrieve_results,
|
430
|
+
)
|
285
431
|
|
286
432
|
|
287
433
|
class EvaluationRunsResourceWithStreamingResponse:
|
@@ -294,10 +440,12 @@ class EvaluationRunsResourceWithStreamingResponse:
|
|
294
440
|
self.retrieve = to_streamed_response_wrapper(
|
295
441
|
evaluation_runs.retrieve,
|
296
442
|
)
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
|
443
|
+
self.list_results = to_streamed_response_wrapper(
|
444
|
+
evaluation_runs.list_results,
|
445
|
+
)
|
446
|
+
self.retrieve_results = to_streamed_response_wrapper(
|
447
|
+
evaluation_runs.retrieve_results,
|
448
|
+
)
|
301
449
|
|
302
450
|
|
303
451
|
class AsyncEvaluationRunsResourceWithStreamingResponse:
|
@@ -310,7 +458,9 @@ class AsyncEvaluationRunsResourceWithStreamingResponse:
|
|
310
458
|
self.retrieve = async_to_streamed_response_wrapper(
|
311
459
|
evaluation_runs.retrieve,
|
312
460
|
)
|
313
|
-
|
314
|
-
|
315
|
-
|
316
|
-
|
461
|
+
self.list_results = async_to_streamed_response_wrapper(
|
462
|
+
evaluation_runs.list_results,
|
463
|
+
)
|
464
|
+
self.retrieve_results = async_to_streamed_response_wrapper(
|
465
|
+
evaluation_runs.retrieve_results,
|
466
|
+
)
|
@@ -17,17 +17,18 @@ from ..._response import (
|
|
17
17
|
async_to_streamed_response_wrapper,
|
18
18
|
)
|
19
19
|
from ..._base_client import make_request_options
|
20
|
-
from ...types.
|
20
|
+
from ...types.agents import (
|
21
21
|
evaluation_test_case_create_params,
|
22
22
|
evaluation_test_case_update_params,
|
23
|
+
evaluation_test_case_retrieve_params,
|
23
24
|
evaluation_test_case_list_evaluation_runs_params,
|
24
25
|
)
|
25
|
-
from ...types.
|
26
|
-
from ...types.
|
27
|
-
from ...types.
|
28
|
-
from ...types.
|
29
|
-
from ...types.
|
30
|
-
from ...types.
|
26
|
+
from ...types.agents.api_star_metric_param import APIStarMetricParam
|
27
|
+
from ...types.agents.evaluation_test_case_list_response import EvaluationTestCaseListResponse
|
28
|
+
from ...types.agents.evaluation_test_case_create_response import EvaluationTestCaseCreateResponse
|
29
|
+
from ...types.agents.evaluation_test_case_update_response import EvaluationTestCaseUpdateResponse
|
30
|
+
from ...types.agents.evaluation_test_case_retrieve_response import EvaluationTestCaseRetrieveResponse
|
31
|
+
from ...types.agents.evaluation_test_case_list_evaluation_runs_response import (
|
31
32
|
EvaluationTestCaseListEvaluationRunsResponse,
|
32
33
|
)
|
33
34
|
|
@@ -118,6 +119,7 @@ class EvaluationTestCasesResource(SyncAPIResource):
|
|
118
119
|
self,
|
119
120
|
test_case_uuid: str,
|
120
121
|
*,
|
122
|
+
evaluation_test_case_version: int | NotGiven = NOT_GIVEN,
|
121
123
|
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
122
124
|
# The extra values given here take precedence over values defined on the client or passed to this method.
|
123
125
|
extra_headers: Headers | None = None,
|
@@ -130,6 +132,8 @@ class EvaluationTestCasesResource(SyncAPIResource):
|
|
130
132
|
request to `/v2/gen-ai/evaluation_test_case/{test_case_uuid}`.
|
131
133
|
|
132
134
|
Args:
|
135
|
+
evaluation_test_case_version: Version of the test case.
|
136
|
+
|
133
137
|
extra_headers: Send extra headers
|
134
138
|
|
135
139
|
extra_query: Add additional query parameters to the request
|
@@ -145,7 +149,14 @@ class EvaluationTestCasesResource(SyncAPIResource):
|
|
145
149
|
if self._client._base_url_overridden
|
146
150
|
else f"https://api.digitalocean.com/v2/gen-ai/evaluation_test_cases/{test_case_uuid}",
|
147
151
|
options=make_request_options(
|
148
|
-
extra_headers=extra_headers,
|
152
|
+
extra_headers=extra_headers,
|
153
|
+
extra_query=extra_query,
|
154
|
+
extra_body=extra_body,
|
155
|
+
timeout=timeout,
|
156
|
+
query=maybe_transform(
|
157
|
+
{"evaluation_test_case_version": evaluation_test_case_version},
|
158
|
+
evaluation_test_case_retrieve_params.EvaluationTestCaseRetrieveParams,
|
159
|
+
),
|
149
160
|
),
|
150
161
|
cast_to=EvaluationTestCaseRetrieveResponse,
|
151
162
|
)
|
@@ -368,6 +379,7 @@ class AsyncEvaluationTestCasesResource(AsyncAPIResource):
|
|
368
379
|
self,
|
369
380
|
test_case_uuid: str,
|
370
381
|
*,
|
382
|
+
evaluation_test_case_version: int | NotGiven = NOT_GIVEN,
|
371
383
|
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
372
384
|
# The extra values given here take precedence over values defined on the client or passed to this method.
|
373
385
|
extra_headers: Headers | None = None,
|
@@ -380,6 +392,8 @@ class AsyncEvaluationTestCasesResource(AsyncAPIResource):
|
|
380
392
|
request to `/v2/gen-ai/evaluation_test_case/{test_case_uuid}`.
|
381
393
|
|
382
394
|
Args:
|
395
|
+
evaluation_test_case_version: Version of the test case.
|
396
|
+
|
383
397
|
extra_headers: Send extra headers
|
384
398
|
|
385
399
|
extra_query: Add additional query parameters to the request
|
@@ -395,7 +409,14 @@ class AsyncEvaluationTestCasesResource(AsyncAPIResource):
|
|
395
409
|
if self._client._base_url_overridden
|
396
410
|
else f"https://api.digitalocean.com/v2/gen-ai/evaluation_test_cases/{test_case_uuid}",
|
397
411
|
options=make_request_options(
|
398
|
-
extra_headers=extra_headers,
|
412
|
+
extra_headers=extra_headers,
|
413
|
+
extra_query=extra_query,
|
414
|
+
extra_body=extra_body,
|
415
|
+
timeout=timeout,
|
416
|
+
query=await async_maybe_transform(
|
417
|
+
{"evaluation_test_case_version": evaluation_test_case_version},
|
418
|
+
evaluation_test_case_retrieve_params.EvaluationTestCaseRetrieveParams,
|
419
|
+
),
|
399
420
|
),
|
400
421
|
cast_to=EvaluationTestCaseRetrieveResponse,
|
401
422
|
)
|