opik 1.9.26__py3-none-any.whl → 1.9.41__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.
- opik/__init__.py +10 -3
- opik/api_objects/dataset/rest_operations.py +2 -0
- opik/api_objects/experiment/experiment.py +31 -5
- opik/api_objects/experiment/helpers.py +34 -10
- opik/api_objects/local_recording.py +8 -3
- opik/api_objects/opik_client.py +218 -46
- opik/api_objects/opik_query_language.py +9 -0
- opik/api_objects/prompt/__init__.py +11 -3
- opik/api_objects/prompt/base_prompt.py +69 -0
- opik/api_objects/prompt/base_prompt_template.py +29 -0
- opik/api_objects/prompt/chat/__init__.py +1 -0
- opik/api_objects/prompt/chat/chat_prompt.py +193 -0
- opik/api_objects/prompt/chat/chat_prompt_template.py +350 -0
- opik/api_objects/prompt/{chat_content_renderer_registry.py → chat/content_renderer_registry.py} +31 -34
- opik/api_objects/prompt/client.py +101 -30
- opik/api_objects/prompt/text/__init__.py +1 -0
- opik/api_objects/prompt/{prompt.py → text/prompt.py} +55 -32
- opik/api_objects/prompt/{prompt_template.py → text/prompt_template.py} +8 -5
- opik/cli/export.py +6 -2
- opik/config.py +0 -5
- opik/decorator/base_track_decorator.py +37 -40
- opik/evaluation/__init__.py +13 -2
- opik/evaluation/engine/engine.py +195 -223
- opik/evaluation/engine/helpers.py +8 -7
- opik/evaluation/engine/metrics_evaluator.py +237 -0
- opik/evaluation/evaluation_result.py +35 -1
- opik/evaluation/evaluator.py +309 -23
- opik/evaluation/models/litellm/util.py +78 -6
- opik/evaluation/report.py +14 -2
- opik/evaluation/rest_operations.py +6 -9
- opik/evaluation/test_case.py +2 -2
- opik/evaluation/types.py +9 -1
- opik/exceptions.py +17 -0
- opik/id_helpers.py +18 -0
- opik/integrations/adk/helpers.py +16 -7
- opik/integrations/adk/legacy_opik_tracer.py +7 -4
- opik/integrations/adk/opik_tracer.py +3 -1
- opik/integrations/adk/patchers/adk_otel_tracer/opik_adk_otel_tracer.py +7 -3
- opik/integrations/dspy/callback.py +1 -4
- opik/integrations/haystack/opik_connector.py +2 -2
- opik/integrations/haystack/opik_tracer.py +2 -4
- opik/integrations/langchain/opik_tracer.py +1 -4
- opik/integrations/llama_index/callback.py +2 -4
- opik/integrations/openai/agents/opik_tracing_processor.py +1 -2
- opik/integrations/openai/opik_tracker.py +1 -1
- opik/opik_context.py +7 -7
- opik/rest_api/__init__.py +127 -11
- opik/rest_api/dashboards/client.py +65 -2
- opik/rest_api/dashboards/raw_client.py +82 -0
- opik/rest_api/datasets/client.py +538 -2
- opik/rest_api/datasets/raw_client.py +1347 -441
- opik/rest_api/experiments/client.py +30 -2
- opik/rest_api/experiments/raw_client.py +26 -0
- opik/rest_api/optimizations/client.py +302 -0
- opik/rest_api/optimizations/raw_client.py +463 -0
- opik/rest_api/optimizations/types/optimization_update_status.py +3 -1
- opik/rest_api/prompts/__init__.py +2 -2
- opik/rest_api/prompts/client.py +34 -4
- opik/rest_api/prompts/raw_client.py +32 -2
- opik/rest_api/prompts/types/__init__.py +3 -1
- opik/rest_api/prompts/types/create_prompt_version_detail_template_structure.py +5 -0
- opik/rest_api/prompts/types/prompt_write_template_structure.py +5 -0
- opik/rest_api/traces/client.py +6 -6
- opik/rest_api/traces/raw_client.py +4 -4
- opik/rest_api/types/__init__.py +125 -11
- opik/rest_api/types/aggregation_data.py +1 -0
- opik/rest_api/types/automation_rule_evaluator.py +23 -1
- opik/rest_api/types/automation_rule_evaluator_llm_as_judge.py +2 -0
- opik/rest_api/types/automation_rule_evaluator_llm_as_judge_public.py +2 -0
- opik/rest_api/types/automation_rule_evaluator_llm_as_judge_write.py +2 -0
- opik/rest_api/types/{automation_rule_evaluator_object_public.py → automation_rule_evaluator_object_object_public.py} +32 -10
- opik/rest_api/types/automation_rule_evaluator_page_public.py +2 -2
- opik/rest_api/types/automation_rule_evaluator_public.py +23 -1
- opik/rest_api/types/automation_rule_evaluator_span_llm_as_judge.py +22 -0
- opik/rest_api/types/automation_rule_evaluator_span_llm_as_judge_public.py +22 -0
- opik/rest_api/types/automation_rule_evaluator_span_llm_as_judge_write.py +22 -0
- opik/rest_api/types/automation_rule_evaluator_trace_thread_llm_as_judge.py +2 -0
- opik/rest_api/types/automation_rule_evaluator_trace_thread_llm_as_judge_public.py +2 -0
- opik/rest_api/types/automation_rule_evaluator_trace_thread_llm_as_judge_write.py +2 -0
- opik/rest_api/types/automation_rule_evaluator_trace_thread_user_defined_metric_python.py +2 -0
- opik/rest_api/types/automation_rule_evaluator_trace_thread_user_defined_metric_python_public.py +2 -0
- opik/rest_api/types/automation_rule_evaluator_trace_thread_user_defined_metric_python_write.py +2 -0
- opik/rest_api/types/automation_rule_evaluator_update.py +23 -1
- opik/rest_api/types/automation_rule_evaluator_update_llm_as_judge.py +2 -0
- opik/rest_api/types/automation_rule_evaluator_update_span_llm_as_judge.py +22 -0
- opik/rest_api/types/automation_rule_evaluator_update_trace_thread_llm_as_judge.py +2 -0
- opik/rest_api/types/automation_rule_evaluator_update_trace_thread_user_defined_metric_python.py +2 -0
- opik/rest_api/types/automation_rule_evaluator_update_user_defined_metric_python.py +2 -0
- opik/rest_api/types/automation_rule_evaluator_user_defined_metric_python.py +2 -0
- opik/rest_api/types/automation_rule_evaluator_user_defined_metric_python_public.py +2 -0
- opik/rest_api/types/automation_rule_evaluator_user_defined_metric_python_write.py +2 -0
- opik/rest_api/types/automation_rule_evaluator_write.py +23 -1
- opik/rest_api/types/dashboard_page_public.py +1 -0
- opik/rest_api/types/dataset.py +4 -0
- opik/rest_api/types/dataset_item.py +1 -0
- opik/rest_api/types/dataset_item_compare.py +1 -0
- opik/rest_api/types/dataset_item_page_compare.py +1 -0
- opik/rest_api/types/dataset_item_page_public.py +1 -0
- opik/rest_api/types/dataset_item_public.py +1 -0
- opik/rest_api/types/dataset_public.py +4 -0
- opik/rest_api/types/dataset_public_status.py +5 -0
- opik/rest_api/types/dataset_status.py +5 -0
- opik/rest_api/types/dataset_version_diff.py +22 -0
- opik/rest_api/types/dataset_version_diff_stats.py +24 -0
- opik/rest_api/types/dataset_version_page_public.py +23 -0
- opik/rest_api/types/dataset_version_public.py +54 -0
- opik/rest_api/types/dataset_version_summary.py +41 -0
- opik/rest_api/types/dataset_version_summary_public.py +41 -0
- opik/rest_api/types/experiment.py +2 -0
- opik/rest_api/types/experiment_public.py +2 -0
- opik/rest_api/types/experiment_score.py +20 -0
- opik/rest_api/types/experiment_score_public.py +20 -0
- opik/rest_api/types/experiment_score_write.py +20 -0
- opik/rest_api/types/feedback_score_public.py +4 -0
- opik/rest_api/types/group_content_with_aggregations.py +1 -0
- opik/rest_api/types/optimization.py +2 -0
- opik/rest_api/types/optimization_public.py +2 -0
- opik/rest_api/types/optimization_public_status.py +3 -1
- opik/rest_api/types/optimization_status.py +3 -1
- opik/rest_api/types/optimization_studio_config.py +27 -0
- opik/rest_api/types/optimization_studio_config_public.py +27 -0
- opik/rest_api/types/optimization_studio_config_write.py +27 -0
- opik/rest_api/types/optimization_studio_log.py +22 -0
- opik/rest_api/types/optimization_write.py +2 -0
- opik/rest_api/types/optimization_write_status.py +3 -1
- opik/rest_api/types/prompt.py +6 -0
- opik/rest_api/types/prompt_detail.py +6 -0
- opik/rest_api/types/prompt_detail_template_structure.py +5 -0
- opik/rest_api/types/prompt_public.py +6 -0
- opik/rest_api/types/prompt_public_template_structure.py +5 -0
- opik/rest_api/types/prompt_template_structure.py +5 -0
- opik/rest_api/types/prompt_version.py +2 -0
- opik/rest_api/types/prompt_version_detail.py +2 -0
- opik/rest_api/types/prompt_version_detail_template_structure.py +5 -0
- opik/rest_api/types/prompt_version_public.py +2 -0
- opik/rest_api/types/prompt_version_public_template_structure.py +5 -0
- opik/rest_api/types/prompt_version_template_structure.py +5 -0
- opik/rest_api/types/score_name.py +1 -0
- opik/rest_api/types/service_toggles_config.py +5 -0
- opik/rest_api/types/span_filter.py +23 -0
- opik/rest_api/types/span_filter_operator.py +21 -0
- opik/rest_api/types/span_filter_write.py +23 -0
- opik/rest_api/types/span_filter_write_operator.py +21 -0
- opik/rest_api/types/span_llm_as_judge_code.py +27 -0
- opik/rest_api/types/span_llm_as_judge_code_public.py +27 -0
- opik/rest_api/types/span_llm_as_judge_code_write.py +27 -0
- opik/rest_api/types/studio_evaluation.py +20 -0
- opik/rest_api/types/studio_evaluation_public.py +20 -0
- opik/rest_api/types/studio_evaluation_write.py +20 -0
- opik/rest_api/types/studio_llm_model.py +21 -0
- opik/rest_api/types/studio_llm_model_public.py +21 -0
- opik/rest_api/types/studio_llm_model_write.py +21 -0
- opik/rest_api/types/studio_message.py +20 -0
- opik/rest_api/types/studio_message_public.py +20 -0
- opik/rest_api/types/studio_message_write.py +20 -0
- opik/rest_api/types/studio_metric.py +21 -0
- opik/rest_api/types/studio_metric_public.py +21 -0
- opik/rest_api/types/studio_metric_write.py +21 -0
- opik/rest_api/types/studio_optimizer.py +21 -0
- opik/rest_api/types/studio_optimizer_public.py +21 -0
- opik/rest_api/types/studio_optimizer_write.py +21 -0
- opik/rest_api/types/studio_prompt.py +20 -0
- opik/rest_api/types/studio_prompt_public.py +20 -0
- opik/rest_api/types/studio_prompt_write.py +20 -0
- opik/rest_api/types/trace.py +6 -0
- opik/rest_api/types/trace_public.py +6 -0
- opik/rest_api/types/trace_thread_filter_write.py +23 -0
- opik/rest_api/types/trace_thread_filter_write_operator.py +21 -0
- opik/rest_api/types/value_entry.py +2 -0
- opik/rest_api/types/value_entry_compare.py +2 -0
- opik/rest_api/types/value_entry_experiment_item_bulk_write_view.py +2 -0
- opik/rest_api/types/value_entry_public.py +2 -0
- opik/synchronization.py +5 -6
- opik/{decorator/tracing_runtime_config.py → tracing_runtime_config.py} +6 -7
- {opik-1.9.26.dist-info → opik-1.9.41.dist-info}/METADATA +4 -3
- {opik-1.9.26.dist-info → opik-1.9.41.dist-info}/RECORD +180 -120
- opik/api_objects/prompt/chat_prompt_template.py +0 -200
- {opik-1.9.26.dist-info → opik-1.9.41.dist-info}/WHEEL +0 -0
- {opik-1.9.26.dist-info → opik-1.9.41.dist-info}/entry_points.txt +0 -0
- {opik-1.9.26.dist-info → opik-1.9.41.dist-info}/licenses/LICENSE +0 -0
- {opik-1.9.26.dist-info → opik-1.9.41.dist-info}/top_level.txt +0 -0
|
@@ -13,9 +13,12 @@ from ..core.request_options import RequestOptions
|
|
|
13
13
|
from ..core.serialization import convert_and_respect_annotation_metadata
|
|
14
14
|
from ..errors.bad_request_error import BadRequestError
|
|
15
15
|
from ..errors.not_found_error import NotFoundError
|
|
16
|
+
from ..errors.not_implemented_error import NotImplementedError
|
|
16
17
|
from ..types.json_list_string_write import JsonListStringWrite
|
|
17
18
|
from ..types.optimization_page_public import OptimizationPagePublic
|
|
18
19
|
from ..types.optimization_public import OptimizationPublic
|
|
20
|
+
from ..types.optimization_studio_config_write import OptimizationStudioConfigWrite
|
|
21
|
+
from ..types.optimization_studio_log import OptimizationStudioLog
|
|
19
22
|
from ..types.optimization_write_status import OptimizationWriteStatus
|
|
20
23
|
from .types.optimization_update_status import OptimizationUpdateStatus
|
|
21
24
|
|
|
@@ -27,6 +30,47 @@ class RawOptimizationsClient:
|
|
|
27
30
|
def __init__(self, *, client_wrapper: SyncClientWrapper):
|
|
28
31
|
self._client_wrapper = client_wrapper
|
|
29
32
|
|
|
33
|
+
def cancel_studio_optimizations(
|
|
34
|
+
self, id: str, *, request_options: typing.Optional[RequestOptions] = None
|
|
35
|
+
) -> HttpResponse[None]:
|
|
36
|
+
"""
|
|
37
|
+
Cancel Studio optimizations by id
|
|
38
|
+
|
|
39
|
+
Parameters
|
|
40
|
+
----------
|
|
41
|
+
id : str
|
|
42
|
+
|
|
43
|
+
request_options : typing.Optional[RequestOptions]
|
|
44
|
+
Request-specific configuration.
|
|
45
|
+
|
|
46
|
+
Returns
|
|
47
|
+
-------
|
|
48
|
+
HttpResponse[None]
|
|
49
|
+
"""
|
|
50
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
51
|
+
f"v1/private/optimizations/studio/{jsonable_encoder(id)}/cancel",
|
|
52
|
+
method="GET",
|
|
53
|
+
request_options=request_options,
|
|
54
|
+
)
|
|
55
|
+
try:
|
|
56
|
+
if 200 <= _response.status_code < 300:
|
|
57
|
+
return HttpResponse(response=_response, data=None)
|
|
58
|
+
if _response.status_code == 501:
|
|
59
|
+
raise NotImplementedError(
|
|
60
|
+
headers=dict(_response.headers),
|
|
61
|
+
body=typing.cast(
|
|
62
|
+
typing.Optional[typing.Any],
|
|
63
|
+
parse_obj_as(
|
|
64
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
65
|
+
object_=_response.json(),
|
|
66
|
+
),
|
|
67
|
+
),
|
|
68
|
+
)
|
|
69
|
+
_response_json = _response.json()
|
|
70
|
+
except JSONDecodeError:
|
|
71
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
72
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
73
|
+
|
|
30
74
|
def find_optimizations(
|
|
31
75
|
self,
|
|
32
76
|
*,
|
|
@@ -35,6 +79,7 @@ class RawOptimizationsClient:
|
|
|
35
79
|
dataset_id: typing.Optional[str] = None,
|
|
36
80
|
name: typing.Optional[str] = None,
|
|
37
81
|
dataset_deleted: typing.Optional[bool] = None,
|
|
82
|
+
filters: typing.Optional[str] = None,
|
|
38
83
|
request_options: typing.Optional[RequestOptions] = None,
|
|
39
84
|
) -> HttpResponse[OptimizationPagePublic]:
|
|
40
85
|
"""
|
|
@@ -52,6 +97,8 @@ class RawOptimizationsClient:
|
|
|
52
97
|
|
|
53
98
|
dataset_deleted : typing.Optional[bool]
|
|
54
99
|
|
|
100
|
+
filters : typing.Optional[str]
|
|
101
|
+
|
|
55
102
|
request_options : typing.Optional[RequestOptions]
|
|
56
103
|
Request-specific configuration.
|
|
57
104
|
|
|
@@ -69,6 +116,7 @@ class RawOptimizationsClient:
|
|
|
69
116
|
"dataset_id": dataset_id,
|
|
70
117
|
"name": name,
|
|
71
118
|
"dataset_deleted": dataset_deleted,
|
|
119
|
+
"filters": filters,
|
|
72
120
|
},
|
|
73
121
|
request_options=request_options,
|
|
74
122
|
)
|
|
@@ -107,6 +155,7 @@ class RawOptimizationsClient:
|
|
|
107
155
|
id: typing.Optional[str] = OMIT,
|
|
108
156
|
name: typing.Optional[str] = OMIT,
|
|
109
157
|
metadata: typing.Optional[JsonListStringWrite] = OMIT,
|
|
158
|
+
studio_config: typing.Optional[OptimizationStudioConfigWrite] = OMIT,
|
|
110
159
|
last_updated_at: typing.Optional[dt.datetime] = OMIT,
|
|
111
160
|
request_options: typing.Optional[RequestOptions] = None,
|
|
112
161
|
) -> HttpResponse[None]:
|
|
@@ -127,6 +176,8 @@ class RawOptimizationsClient:
|
|
|
127
176
|
|
|
128
177
|
metadata : typing.Optional[JsonListStringWrite]
|
|
129
178
|
|
|
179
|
+
studio_config : typing.Optional[OptimizationStudioConfigWrite]
|
|
180
|
+
|
|
130
181
|
last_updated_at : typing.Optional[dt.datetime]
|
|
131
182
|
|
|
132
183
|
request_options : typing.Optional[RequestOptions]
|
|
@@ -148,6 +199,9 @@ class RawOptimizationsClient:
|
|
|
148
199
|
"metadata": convert_and_respect_annotation_metadata(
|
|
149
200
|
object_=metadata, annotation=JsonListStringWrite, direction="write"
|
|
150
201
|
),
|
|
202
|
+
"studio_config": convert_and_respect_annotation_metadata(
|
|
203
|
+
object_=studio_config, annotation=OptimizationStudioConfigWrite, direction="write"
|
|
204
|
+
),
|
|
151
205
|
"last_updated_at": last_updated_at,
|
|
152
206
|
},
|
|
153
207
|
headers={
|
|
@@ -173,6 +227,7 @@ class RawOptimizationsClient:
|
|
|
173
227
|
id: typing.Optional[str] = OMIT,
|
|
174
228
|
name: typing.Optional[str] = OMIT,
|
|
175
229
|
metadata: typing.Optional[JsonListStringWrite] = OMIT,
|
|
230
|
+
studio_config: typing.Optional[OptimizationStudioConfigWrite] = OMIT,
|
|
176
231
|
last_updated_at: typing.Optional[dt.datetime] = OMIT,
|
|
177
232
|
request_options: typing.Optional[RequestOptions] = None,
|
|
178
233
|
) -> HttpResponse[None]:
|
|
@@ -193,6 +248,8 @@ class RawOptimizationsClient:
|
|
|
193
248
|
|
|
194
249
|
metadata : typing.Optional[JsonListStringWrite]
|
|
195
250
|
|
|
251
|
+
studio_config : typing.Optional[OptimizationStudioConfigWrite]
|
|
252
|
+
|
|
196
253
|
last_updated_at : typing.Optional[dt.datetime]
|
|
197
254
|
|
|
198
255
|
request_options : typing.Optional[RequestOptions]
|
|
@@ -214,6 +271,9 @@ class RawOptimizationsClient:
|
|
|
214
271
|
"metadata": convert_and_respect_annotation_metadata(
|
|
215
272
|
object_=metadata, annotation=JsonListStringWrite, direction="write"
|
|
216
273
|
),
|
|
274
|
+
"studio_config": convert_and_respect_annotation_metadata(
|
|
275
|
+
object_=studio_config, annotation=OptimizationStudioConfigWrite, direction="write"
|
|
276
|
+
),
|
|
217
277
|
"last_updated_at": last_updated_at,
|
|
218
278
|
},
|
|
219
279
|
headers={
|
|
@@ -267,6 +327,81 @@ class RawOptimizationsClient:
|
|
|
267
327
|
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
268
328
|
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
269
329
|
|
|
330
|
+
def find_studio_optimizations(
|
|
331
|
+
self,
|
|
332
|
+
*,
|
|
333
|
+
page: typing.Optional[int] = None,
|
|
334
|
+
size: typing.Optional[int] = None,
|
|
335
|
+
dataset_id: typing.Optional[str] = None,
|
|
336
|
+
name: typing.Optional[str] = None,
|
|
337
|
+
dataset_deleted: typing.Optional[bool] = None,
|
|
338
|
+
filters: typing.Optional[str] = None,
|
|
339
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
340
|
+
) -> HttpResponse[OptimizationPagePublic]:
|
|
341
|
+
"""
|
|
342
|
+
Find Studio optimizations
|
|
343
|
+
|
|
344
|
+
Parameters
|
|
345
|
+
----------
|
|
346
|
+
page : typing.Optional[int]
|
|
347
|
+
|
|
348
|
+
size : typing.Optional[int]
|
|
349
|
+
|
|
350
|
+
dataset_id : typing.Optional[str]
|
|
351
|
+
|
|
352
|
+
name : typing.Optional[str]
|
|
353
|
+
|
|
354
|
+
dataset_deleted : typing.Optional[bool]
|
|
355
|
+
|
|
356
|
+
filters : typing.Optional[str]
|
|
357
|
+
|
|
358
|
+
request_options : typing.Optional[RequestOptions]
|
|
359
|
+
Request-specific configuration.
|
|
360
|
+
|
|
361
|
+
Returns
|
|
362
|
+
-------
|
|
363
|
+
HttpResponse[OptimizationPagePublic]
|
|
364
|
+
Studio optimizations resource
|
|
365
|
+
"""
|
|
366
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
367
|
+
"v1/private/optimizations/studio",
|
|
368
|
+
method="GET",
|
|
369
|
+
params={
|
|
370
|
+
"page": page,
|
|
371
|
+
"size": size,
|
|
372
|
+
"dataset_id": dataset_id,
|
|
373
|
+
"name": name,
|
|
374
|
+
"dataset_deleted": dataset_deleted,
|
|
375
|
+
"filters": filters,
|
|
376
|
+
},
|
|
377
|
+
request_options=request_options,
|
|
378
|
+
)
|
|
379
|
+
try:
|
|
380
|
+
if 200 <= _response.status_code < 300:
|
|
381
|
+
_data = typing.cast(
|
|
382
|
+
OptimizationPagePublic,
|
|
383
|
+
parse_obj_as(
|
|
384
|
+
type_=OptimizationPagePublic, # type: ignore
|
|
385
|
+
object_=_response.json(),
|
|
386
|
+
),
|
|
387
|
+
)
|
|
388
|
+
return HttpResponse(response=_response, data=_data)
|
|
389
|
+
if _response.status_code == 400:
|
|
390
|
+
raise BadRequestError(
|
|
391
|
+
headers=dict(_response.headers),
|
|
392
|
+
body=typing.cast(
|
|
393
|
+
typing.Optional[typing.Any],
|
|
394
|
+
parse_obj_as(
|
|
395
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
396
|
+
object_=_response.json(),
|
|
397
|
+
),
|
|
398
|
+
),
|
|
399
|
+
)
|
|
400
|
+
_response_json = _response.json()
|
|
401
|
+
except JSONDecodeError:
|
|
402
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
403
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
404
|
+
|
|
270
405
|
def get_optimization_by_id(
|
|
271
406
|
self, id: str, *, request_options: typing.Optional[RequestOptions] = None
|
|
272
407
|
) -> HttpResponse[OptimizationPublic]:
|
|
@@ -363,11 +498,150 @@ class RawOptimizationsClient:
|
|
|
363
498
|
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
364
499
|
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
365
500
|
|
|
501
|
+
def get_studio_optimization_by_id(
|
|
502
|
+
self, id: str, *, request_options: typing.Optional[RequestOptions] = None
|
|
503
|
+
) -> HttpResponse[OptimizationPublic]:
|
|
504
|
+
"""
|
|
505
|
+
Get Studio optimization with config included
|
|
506
|
+
|
|
507
|
+
Parameters
|
|
508
|
+
----------
|
|
509
|
+
id : str
|
|
510
|
+
|
|
511
|
+
request_options : typing.Optional[RequestOptions]
|
|
512
|
+
Request-specific configuration.
|
|
513
|
+
|
|
514
|
+
Returns
|
|
515
|
+
-------
|
|
516
|
+
HttpResponse[OptimizationPublic]
|
|
517
|
+
Studio optimization resource
|
|
518
|
+
"""
|
|
519
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
520
|
+
f"v1/private/optimizations/studio/{jsonable_encoder(id)}",
|
|
521
|
+
method="GET",
|
|
522
|
+
request_options=request_options,
|
|
523
|
+
)
|
|
524
|
+
try:
|
|
525
|
+
if 200 <= _response.status_code < 300:
|
|
526
|
+
_data = typing.cast(
|
|
527
|
+
OptimizationPublic,
|
|
528
|
+
parse_obj_as(
|
|
529
|
+
type_=OptimizationPublic, # type: ignore
|
|
530
|
+
object_=_response.json(),
|
|
531
|
+
),
|
|
532
|
+
)
|
|
533
|
+
return HttpResponse(response=_response, data=_data)
|
|
534
|
+
if _response.status_code == 404:
|
|
535
|
+
raise NotFoundError(
|
|
536
|
+
headers=dict(_response.headers),
|
|
537
|
+
body=typing.cast(
|
|
538
|
+
typing.Optional[typing.Any],
|
|
539
|
+
parse_obj_as(
|
|
540
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
541
|
+
object_=_response.json(),
|
|
542
|
+
),
|
|
543
|
+
),
|
|
544
|
+
)
|
|
545
|
+
_response_json = _response.json()
|
|
546
|
+
except JSONDecodeError:
|
|
547
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
548
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
549
|
+
|
|
550
|
+
def get_studio_optimization_logs(
|
|
551
|
+
self, id: str, *, request_options: typing.Optional[RequestOptions] = None
|
|
552
|
+
) -> HttpResponse[OptimizationStudioLog]:
|
|
553
|
+
"""
|
|
554
|
+
Get presigned S3 URL for downloading optimization logs
|
|
555
|
+
|
|
556
|
+
Parameters
|
|
557
|
+
----------
|
|
558
|
+
id : str
|
|
559
|
+
|
|
560
|
+
request_options : typing.Optional[RequestOptions]
|
|
561
|
+
Request-specific configuration.
|
|
562
|
+
|
|
563
|
+
Returns
|
|
564
|
+
-------
|
|
565
|
+
HttpResponse[OptimizationStudioLog]
|
|
566
|
+
Logs response
|
|
567
|
+
"""
|
|
568
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
569
|
+
f"v1/private/optimizations/studio/{jsonable_encoder(id)}/logs",
|
|
570
|
+
method="GET",
|
|
571
|
+
request_options=request_options,
|
|
572
|
+
)
|
|
573
|
+
try:
|
|
574
|
+
if 200 <= _response.status_code < 300:
|
|
575
|
+
_data = typing.cast(
|
|
576
|
+
OptimizationStudioLog,
|
|
577
|
+
parse_obj_as(
|
|
578
|
+
type_=OptimizationStudioLog, # type: ignore
|
|
579
|
+
object_=_response.json(),
|
|
580
|
+
),
|
|
581
|
+
)
|
|
582
|
+
return HttpResponse(response=_response, data=_data)
|
|
583
|
+
if _response.status_code == 404:
|
|
584
|
+
raise NotFoundError(
|
|
585
|
+
headers=dict(_response.headers),
|
|
586
|
+
body=typing.cast(
|
|
587
|
+
typing.Optional[typing.Any],
|
|
588
|
+
parse_obj_as(
|
|
589
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
590
|
+
object_=_response.json(),
|
|
591
|
+
),
|
|
592
|
+
),
|
|
593
|
+
)
|
|
594
|
+
_response_json = _response.json()
|
|
595
|
+
except JSONDecodeError:
|
|
596
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
597
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
598
|
+
|
|
366
599
|
|
|
367
600
|
class AsyncRawOptimizationsClient:
|
|
368
601
|
def __init__(self, *, client_wrapper: AsyncClientWrapper):
|
|
369
602
|
self._client_wrapper = client_wrapper
|
|
370
603
|
|
|
604
|
+
async def cancel_studio_optimizations(
|
|
605
|
+
self, id: str, *, request_options: typing.Optional[RequestOptions] = None
|
|
606
|
+
) -> AsyncHttpResponse[None]:
|
|
607
|
+
"""
|
|
608
|
+
Cancel Studio optimizations by id
|
|
609
|
+
|
|
610
|
+
Parameters
|
|
611
|
+
----------
|
|
612
|
+
id : str
|
|
613
|
+
|
|
614
|
+
request_options : typing.Optional[RequestOptions]
|
|
615
|
+
Request-specific configuration.
|
|
616
|
+
|
|
617
|
+
Returns
|
|
618
|
+
-------
|
|
619
|
+
AsyncHttpResponse[None]
|
|
620
|
+
"""
|
|
621
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
622
|
+
f"v1/private/optimizations/studio/{jsonable_encoder(id)}/cancel",
|
|
623
|
+
method="GET",
|
|
624
|
+
request_options=request_options,
|
|
625
|
+
)
|
|
626
|
+
try:
|
|
627
|
+
if 200 <= _response.status_code < 300:
|
|
628
|
+
return AsyncHttpResponse(response=_response, data=None)
|
|
629
|
+
if _response.status_code == 501:
|
|
630
|
+
raise NotImplementedError(
|
|
631
|
+
headers=dict(_response.headers),
|
|
632
|
+
body=typing.cast(
|
|
633
|
+
typing.Optional[typing.Any],
|
|
634
|
+
parse_obj_as(
|
|
635
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
636
|
+
object_=_response.json(),
|
|
637
|
+
),
|
|
638
|
+
),
|
|
639
|
+
)
|
|
640
|
+
_response_json = _response.json()
|
|
641
|
+
except JSONDecodeError:
|
|
642
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
643
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
644
|
+
|
|
371
645
|
async def find_optimizations(
|
|
372
646
|
self,
|
|
373
647
|
*,
|
|
@@ -376,6 +650,7 @@ class AsyncRawOptimizationsClient:
|
|
|
376
650
|
dataset_id: typing.Optional[str] = None,
|
|
377
651
|
name: typing.Optional[str] = None,
|
|
378
652
|
dataset_deleted: typing.Optional[bool] = None,
|
|
653
|
+
filters: typing.Optional[str] = None,
|
|
379
654
|
request_options: typing.Optional[RequestOptions] = None,
|
|
380
655
|
) -> AsyncHttpResponse[OptimizationPagePublic]:
|
|
381
656
|
"""
|
|
@@ -393,6 +668,8 @@ class AsyncRawOptimizationsClient:
|
|
|
393
668
|
|
|
394
669
|
dataset_deleted : typing.Optional[bool]
|
|
395
670
|
|
|
671
|
+
filters : typing.Optional[str]
|
|
672
|
+
|
|
396
673
|
request_options : typing.Optional[RequestOptions]
|
|
397
674
|
Request-specific configuration.
|
|
398
675
|
|
|
@@ -410,6 +687,7 @@ class AsyncRawOptimizationsClient:
|
|
|
410
687
|
"dataset_id": dataset_id,
|
|
411
688
|
"name": name,
|
|
412
689
|
"dataset_deleted": dataset_deleted,
|
|
690
|
+
"filters": filters,
|
|
413
691
|
},
|
|
414
692
|
request_options=request_options,
|
|
415
693
|
)
|
|
@@ -448,6 +726,7 @@ class AsyncRawOptimizationsClient:
|
|
|
448
726
|
id: typing.Optional[str] = OMIT,
|
|
449
727
|
name: typing.Optional[str] = OMIT,
|
|
450
728
|
metadata: typing.Optional[JsonListStringWrite] = OMIT,
|
|
729
|
+
studio_config: typing.Optional[OptimizationStudioConfigWrite] = OMIT,
|
|
451
730
|
last_updated_at: typing.Optional[dt.datetime] = OMIT,
|
|
452
731
|
request_options: typing.Optional[RequestOptions] = None,
|
|
453
732
|
) -> AsyncHttpResponse[None]:
|
|
@@ -468,6 +747,8 @@ class AsyncRawOptimizationsClient:
|
|
|
468
747
|
|
|
469
748
|
metadata : typing.Optional[JsonListStringWrite]
|
|
470
749
|
|
|
750
|
+
studio_config : typing.Optional[OptimizationStudioConfigWrite]
|
|
751
|
+
|
|
471
752
|
last_updated_at : typing.Optional[dt.datetime]
|
|
472
753
|
|
|
473
754
|
request_options : typing.Optional[RequestOptions]
|
|
@@ -489,6 +770,9 @@ class AsyncRawOptimizationsClient:
|
|
|
489
770
|
"metadata": convert_and_respect_annotation_metadata(
|
|
490
771
|
object_=metadata, annotation=JsonListStringWrite, direction="write"
|
|
491
772
|
),
|
|
773
|
+
"studio_config": convert_and_respect_annotation_metadata(
|
|
774
|
+
object_=studio_config, annotation=OptimizationStudioConfigWrite, direction="write"
|
|
775
|
+
),
|
|
492
776
|
"last_updated_at": last_updated_at,
|
|
493
777
|
},
|
|
494
778
|
headers={
|
|
@@ -514,6 +798,7 @@ class AsyncRawOptimizationsClient:
|
|
|
514
798
|
id: typing.Optional[str] = OMIT,
|
|
515
799
|
name: typing.Optional[str] = OMIT,
|
|
516
800
|
metadata: typing.Optional[JsonListStringWrite] = OMIT,
|
|
801
|
+
studio_config: typing.Optional[OptimizationStudioConfigWrite] = OMIT,
|
|
517
802
|
last_updated_at: typing.Optional[dt.datetime] = OMIT,
|
|
518
803
|
request_options: typing.Optional[RequestOptions] = None,
|
|
519
804
|
) -> AsyncHttpResponse[None]:
|
|
@@ -534,6 +819,8 @@ class AsyncRawOptimizationsClient:
|
|
|
534
819
|
|
|
535
820
|
metadata : typing.Optional[JsonListStringWrite]
|
|
536
821
|
|
|
822
|
+
studio_config : typing.Optional[OptimizationStudioConfigWrite]
|
|
823
|
+
|
|
537
824
|
last_updated_at : typing.Optional[dt.datetime]
|
|
538
825
|
|
|
539
826
|
request_options : typing.Optional[RequestOptions]
|
|
@@ -555,6 +842,9 @@ class AsyncRawOptimizationsClient:
|
|
|
555
842
|
"metadata": convert_and_respect_annotation_metadata(
|
|
556
843
|
object_=metadata, annotation=JsonListStringWrite, direction="write"
|
|
557
844
|
),
|
|
845
|
+
"studio_config": convert_and_respect_annotation_metadata(
|
|
846
|
+
object_=studio_config, annotation=OptimizationStudioConfigWrite, direction="write"
|
|
847
|
+
),
|
|
558
848
|
"last_updated_at": last_updated_at,
|
|
559
849
|
},
|
|
560
850
|
headers={
|
|
@@ -608,6 +898,81 @@ class AsyncRawOptimizationsClient:
|
|
|
608
898
|
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
609
899
|
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
610
900
|
|
|
901
|
+
async def find_studio_optimizations(
|
|
902
|
+
self,
|
|
903
|
+
*,
|
|
904
|
+
page: typing.Optional[int] = None,
|
|
905
|
+
size: typing.Optional[int] = None,
|
|
906
|
+
dataset_id: typing.Optional[str] = None,
|
|
907
|
+
name: typing.Optional[str] = None,
|
|
908
|
+
dataset_deleted: typing.Optional[bool] = None,
|
|
909
|
+
filters: typing.Optional[str] = None,
|
|
910
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
911
|
+
) -> AsyncHttpResponse[OptimizationPagePublic]:
|
|
912
|
+
"""
|
|
913
|
+
Find Studio optimizations
|
|
914
|
+
|
|
915
|
+
Parameters
|
|
916
|
+
----------
|
|
917
|
+
page : typing.Optional[int]
|
|
918
|
+
|
|
919
|
+
size : typing.Optional[int]
|
|
920
|
+
|
|
921
|
+
dataset_id : typing.Optional[str]
|
|
922
|
+
|
|
923
|
+
name : typing.Optional[str]
|
|
924
|
+
|
|
925
|
+
dataset_deleted : typing.Optional[bool]
|
|
926
|
+
|
|
927
|
+
filters : typing.Optional[str]
|
|
928
|
+
|
|
929
|
+
request_options : typing.Optional[RequestOptions]
|
|
930
|
+
Request-specific configuration.
|
|
931
|
+
|
|
932
|
+
Returns
|
|
933
|
+
-------
|
|
934
|
+
AsyncHttpResponse[OptimizationPagePublic]
|
|
935
|
+
Studio optimizations resource
|
|
936
|
+
"""
|
|
937
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
938
|
+
"v1/private/optimizations/studio",
|
|
939
|
+
method="GET",
|
|
940
|
+
params={
|
|
941
|
+
"page": page,
|
|
942
|
+
"size": size,
|
|
943
|
+
"dataset_id": dataset_id,
|
|
944
|
+
"name": name,
|
|
945
|
+
"dataset_deleted": dataset_deleted,
|
|
946
|
+
"filters": filters,
|
|
947
|
+
},
|
|
948
|
+
request_options=request_options,
|
|
949
|
+
)
|
|
950
|
+
try:
|
|
951
|
+
if 200 <= _response.status_code < 300:
|
|
952
|
+
_data = typing.cast(
|
|
953
|
+
OptimizationPagePublic,
|
|
954
|
+
parse_obj_as(
|
|
955
|
+
type_=OptimizationPagePublic, # type: ignore
|
|
956
|
+
object_=_response.json(),
|
|
957
|
+
),
|
|
958
|
+
)
|
|
959
|
+
return AsyncHttpResponse(response=_response, data=_data)
|
|
960
|
+
if _response.status_code == 400:
|
|
961
|
+
raise BadRequestError(
|
|
962
|
+
headers=dict(_response.headers),
|
|
963
|
+
body=typing.cast(
|
|
964
|
+
typing.Optional[typing.Any],
|
|
965
|
+
parse_obj_as(
|
|
966
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
967
|
+
object_=_response.json(),
|
|
968
|
+
),
|
|
969
|
+
),
|
|
970
|
+
)
|
|
971
|
+
_response_json = _response.json()
|
|
972
|
+
except JSONDecodeError:
|
|
973
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
974
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
975
|
+
|
|
611
976
|
async def get_optimization_by_id(
|
|
612
977
|
self, id: str, *, request_options: typing.Optional[RequestOptions] = None
|
|
613
978
|
) -> AsyncHttpResponse[OptimizationPublic]:
|
|
@@ -703,3 +1068,101 @@ class AsyncRawOptimizationsClient:
|
|
|
703
1068
|
except JSONDecodeError:
|
|
704
1069
|
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
705
1070
|
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
1071
|
+
|
|
1072
|
+
async def get_studio_optimization_by_id(
|
|
1073
|
+
self, id: str, *, request_options: typing.Optional[RequestOptions] = None
|
|
1074
|
+
) -> AsyncHttpResponse[OptimizationPublic]:
|
|
1075
|
+
"""
|
|
1076
|
+
Get Studio optimization with config included
|
|
1077
|
+
|
|
1078
|
+
Parameters
|
|
1079
|
+
----------
|
|
1080
|
+
id : str
|
|
1081
|
+
|
|
1082
|
+
request_options : typing.Optional[RequestOptions]
|
|
1083
|
+
Request-specific configuration.
|
|
1084
|
+
|
|
1085
|
+
Returns
|
|
1086
|
+
-------
|
|
1087
|
+
AsyncHttpResponse[OptimizationPublic]
|
|
1088
|
+
Studio optimization resource
|
|
1089
|
+
"""
|
|
1090
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
1091
|
+
f"v1/private/optimizations/studio/{jsonable_encoder(id)}",
|
|
1092
|
+
method="GET",
|
|
1093
|
+
request_options=request_options,
|
|
1094
|
+
)
|
|
1095
|
+
try:
|
|
1096
|
+
if 200 <= _response.status_code < 300:
|
|
1097
|
+
_data = typing.cast(
|
|
1098
|
+
OptimizationPublic,
|
|
1099
|
+
parse_obj_as(
|
|
1100
|
+
type_=OptimizationPublic, # type: ignore
|
|
1101
|
+
object_=_response.json(),
|
|
1102
|
+
),
|
|
1103
|
+
)
|
|
1104
|
+
return AsyncHttpResponse(response=_response, data=_data)
|
|
1105
|
+
if _response.status_code == 404:
|
|
1106
|
+
raise NotFoundError(
|
|
1107
|
+
headers=dict(_response.headers),
|
|
1108
|
+
body=typing.cast(
|
|
1109
|
+
typing.Optional[typing.Any],
|
|
1110
|
+
parse_obj_as(
|
|
1111
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
1112
|
+
object_=_response.json(),
|
|
1113
|
+
),
|
|
1114
|
+
),
|
|
1115
|
+
)
|
|
1116
|
+
_response_json = _response.json()
|
|
1117
|
+
except JSONDecodeError:
|
|
1118
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
1119
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
1120
|
+
|
|
1121
|
+
async def get_studio_optimization_logs(
|
|
1122
|
+
self, id: str, *, request_options: typing.Optional[RequestOptions] = None
|
|
1123
|
+
) -> AsyncHttpResponse[OptimizationStudioLog]:
|
|
1124
|
+
"""
|
|
1125
|
+
Get presigned S3 URL for downloading optimization logs
|
|
1126
|
+
|
|
1127
|
+
Parameters
|
|
1128
|
+
----------
|
|
1129
|
+
id : str
|
|
1130
|
+
|
|
1131
|
+
request_options : typing.Optional[RequestOptions]
|
|
1132
|
+
Request-specific configuration.
|
|
1133
|
+
|
|
1134
|
+
Returns
|
|
1135
|
+
-------
|
|
1136
|
+
AsyncHttpResponse[OptimizationStudioLog]
|
|
1137
|
+
Logs response
|
|
1138
|
+
"""
|
|
1139
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
1140
|
+
f"v1/private/optimizations/studio/{jsonable_encoder(id)}/logs",
|
|
1141
|
+
method="GET",
|
|
1142
|
+
request_options=request_options,
|
|
1143
|
+
)
|
|
1144
|
+
try:
|
|
1145
|
+
if 200 <= _response.status_code < 300:
|
|
1146
|
+
_data = typing.cast(
|
|
1147
|
+
OptimizationStudioLog,
|
|
1148
|
+
parse_obj_as(
|
|
1149
|
+
type_=OptimizationStudioLog, # type: ignore
|
|
1150
|
+
object_=_response.json(),
|
|
1151
|
+
),
|
|
1152
|
+
)
|
|
1153
|
+
return AsyncHttpResponse(response=_response, data=_data)
|
|
1154
|
+
if _response.status_code == 404:
|
|
1155
|
+
raise NotFoundError(
|
|
1156
|
+
headers=dict(_response.headers),
|
|
1157
|
+
body=typing.cast(
|
|
1158
|
+
typing.Optional[typing.Any],
|
|
1159
|
+
parse_obj_as(
|
|
1160
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
1161
|
+
object_=_response.json(),
|
|
1162
|
+
),
|
|
1163
|
+
),
|
|
1164
|
+
)
|
|
1165
|
+
_response_json = _response.json()
|
|
1166
|
+
except JSONDecodeError:
|
|
1167
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
1168
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
# isort: skip_file
|
|
4
4
|
|
|
5
|
-
from .types import PromptWriteType
|
|
5
|
+
from .types import CreatePromptVersionDetailTemplateStructure, PromptWriteTemplateStructure, PromptWriteType
|
|
6
6
|
|
|
7
|
-
__all__ = ["PromptWriteType"]
|
|
7
|
+
__all__ = ["CreatePromptVersionDetailTemplateStructure", "PromptWriteTemplateStructure", "PromptWriteType"]
|