opik 1.9.5__py3-none-any.whl → 1.9.39__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/anonymizer/__init__.py +5 -0
- opik/anonymizer/anonymizer.py +12 -0
- opik/anonymizer/factory.py +80 -0
- opik/anonymizer/recursive_anonymizer.py +64 -0
- opik/anonymizer/rules.py +56 -0
- opik/anonymizer/rules_anonymizer.py +35 -0
- opik/api_objects/dataset/rest_operations.py +5 -0
- opik/api_objects/experiment/experiment.py +46 -49
- opik/api_objects/experiment/helpers.py +34 -10
- opik/api_objects/local_recording.py +8 -3
- opik/api_objects/opik_client.py +230 -48
- 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} +37 -35
- opik/api_objects/prompt/client.py +101 -30
- opik/api_objects/prompt/text/__init__.py +1 -0
- opik/api_objects/prompt/text/prompt.py +174 -0
- opik/api_objects/prompt/{prompt_template.py → text/prompt_template.py} +10 -6
- opik/api_objects/prompt/types.py +1 -1
- opik/cli/export.py +6 -2
- opik/cli/usage_report/charts.py +39 -10
- opik/cli/usage_report/cli.py +164 -45
- opik/cli/usage_report/pdf.py +14 -1
- opik/config.py +0 -5
- opik/decorator/base_track_decorator.py +37 -40
- opik/decorator/context_manager/span_context_manager.py +9 -0
- opik/decorator/context_manager/trace_context_manager.py +5 -0
- opik/dict_utils.py +3 -3
- 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 +318 -30
- opik/evaluation/models/litellm/util.py +78 -6
- opik/evaluation/models/model_capabilities.py +33 -0
- opik/evaluation/report.py +14 -2
- opik/evaluation/rest_operations.py +36 -33
- opik/evaluation/test_case.py +2 -2
- opik/evaluation/types.py +9 -1
- opik/exceptions.py +17 -0
- opik/hooks/__init__.py +17 -1
- opik/hooks/anonymizer_hook.py +36 -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/adk/recursive_callback_injector.py +1 -6
- 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 +273 -82
- opik/integrations/llama_index/callback.py +110 -108
- opik/integrations/openai/agents/opik_tracing_processor.py +1 -2
- opik/integrations/openai/opik_tracker.py +1 -1
- opik/message_processing/batching/batchers.py +11 -7
- opik/message_processing/encoder_helpers.py +79 -0
- opik/message_processing/messages.py +25 -1
- opik/message_processing/online_message_processor.py +23 -8
- opik/opik_context.py +7 -7
- opik/rest_api/__init__.py +188 -12
- opik/rest_api/client.py +3 -0
- opik/rest_api/dashboards/__init__.py +4 -0
- opik/rest_api/dashboards/client.py +462 -0
- opik/rest_api/dashboards/raw_client.py +648 -0
- opik/rest_api/datasets/client.py +893 -89
- opik/rest_api/datasets/raw_client.py +1328 -87
- opik/rest_api/experiments/client.py +30 -2
- opik/rest_api/experiments/raw_client.py +26 -0
- opik/rest_api/feedback_definitions/types/find_feedback_definitions_request_type.py +1 -1
- 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/spans/__init__.py +0 -2
- opik/rest_api/spans/client.py +148 -64
- opik/rest_api/spans/raw_client.py +210 -83
- opik/rest_api/spans/types/__init__.py +0 -2
- opik/rest_api/traces/client.py +241 -73
- opik/rest_api/traces/raw_client.py +344 -90
- opik/rest_api/types/__init__.py +200 -15
- opik/rest_api/types/aggregation_data.py +1 -0
- opik/rest_api/types/alert_trigger_config_public_type.py +6 -1
- opik/rest_api/types/alert_trigger_config_type.py +6 -1
- opik/rest_api/types/alert_trigger_config_write_type.py +6 -1
- 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/boolean_feedback_definition.py +25 -0
- opik/rest_api/types/boolean_feedback_definition_create.py +20 -0
- opik/rest_api/types/boolean_feedback_definition_public.py +25 -0
- opik/rest_api/types/boolean_feedback_definition_update.py +20 -0
- opik/rest_api/types/boolean_feedback_detail.py +29 -0
- opik/rest_api/types/boolean_feedback_detail_create.py +29 -0
- opik/rest_api/types/boolean_feedback_detail_public.py +29 -0
- opik/rest_api/types/boolean_feedback_detail_update.py +29 -0
- opik/rest_api/types/dashboard_page_public.py +24 -0
- opik/rest_api/types/dashboard_public.py +30 -0
- opik/rest_api/types/dataset.py +2 -0
- opik/rest_api/types/dataset_item.py +2 -0
- opik/rest_api/types/dataset_item_compare.py +2 -0
- opik/rest_api/types/dataset_item_filter.py +23 -0
- opik/rest_api/types/dataset_item_filter_operator.py +21 -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 +2 -0
- opik/rest_api/types/dataset_item_update.py +39 -0
- opik/rest_api/types/dataset_item_write.py +1 -0
- opik/rest_api/types/dataset_public.py +2 -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 +49 -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.py +20 -1
- opik/rest_api/types/feedback_create.py +16 -1
- opik/rest_api/types/feedback_object_public.py +22 -1
- opik/rest_api/types/feedback_public.py +20 -1
- opik/rest_api/types/feedback_score_public.py +4 -0
- opik/rest_api/types/feedback_update.py +16 -1
- opik/rest_api/types/image_url.py +20 -0
- opik/rest_api/types/image_url_public.py +20 -0
- opik/rest_api/types/image_url_write.py +20 -0
- opik/rest_api/types/llm_as_judge_message.py +5 -1
- opik/rest_api/types/llm_as_judge_message_content.py +24 -0
- opik/rest_api/types/llm_as_judge_message_content_public.py +24 -0
- opik/rest_api/types/llm_as_judge_message_content_write.py +24 -0
- opik/rest_api/types/llm_as_judge_message_public.py +5 -1
- opik/rest_api/types/llm_as_judge_message_write.py +5 -1
- opik/rest_api/types/llm_as_judge_model_parameters.py +2 -0
- opik/rest_api/types/llm_as_judge_model_parameters_public.py +2 -0
- opik/rest_api/types/llm_as_judge_model_parameters_write.py +2 -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 +6 -0
- opik/rest_api/types/span_enrichment_options.py +31 -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/span_update.py +46 -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/trace_thread_update.py +19 -0
- opik/rest_api/types/trace_update.py +39 -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/rest_api/types/video_url.py +19 -0
- opik/rest_api/types/video_url_public.py +19 -0
- opik/rest_api/types/video_url_write.py +19 -0
- opik/synchronization.py +5 -6
- opik/{decorator/tracing_runtime_config.py → tracing_runtime_config.py} +6 -7
- {opik-1.9.5.dist-info → opik-1.9.39.dist-info}/METADATA +5 -4
- {opik-1.9.5.dist-info → opik-1.9.39.dist-info}/RECORD +246 -151
- opik/api_objects/prompt/chat_prompt_template.py +0 -164
- opik/api_objects/prompt/prompt.py +0 -131
- /opik/rest_api/{spans/types → types}/span_update_type.py +0 -0
- {opik-1.9.5.dist-info → opik-1.9.39.dist-info}/WHEEL +0 -0
- {opik-1.9.5.dist-info → opik-1.9.39.dist-info}/entry_points.txt +0 -0
- {opik-1.9.5.dist-info → opik-1.9.39.dist-info}/licenses/LICENSE +0 -0
- {opik-1.9.5.dist-info → opik-1.9.39.dist-info}/top_level.txt +0 -0
|
@@ -31,6 +31,8 @@ from ..types.trace_public import TracePublic
|
|
|
31
31
|
from ..types.trace_thread import TraceThread
|
|
32
32
|
from ..types.trace_thread_filter import TraceThreadFilter
|
|
33
33
|
from ..types.trace_thread_page import TraceThreadPage
|
|
34
|
+
from ..types.trace_thread_update import TraceThreadUpdate
|
|
35
|
+
from ..types.trace_update import TraceUpdate
|
|
34
36
|
from ..types.trace_write import TraceWrite
|
|
35
37
|
from ..types.value_entry import ValueEntry
|
|
36
38
|
|
|
@@ -249,6 +251,171 @@ class RawTracesClient:
|
|
|
249
251
|
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
250
252
|
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
251
253
|
|
|
254
|
+
def create_traces(
|
|
255
|
+
self, *, traces: typing.Sequence[TraceWrite], request_options: typing.Optional[RequestOptions] = None
|
|
256
|
+
) -> HttpResponse[None]:
|
|
257
|
+
"""
|
|
258
|
+
Create traces
|
|
259
|
+
|
|
260
|
+
Parameters
|
|
261
|
+
----------
|
|
262
|
+
traces : typing.Sequence[TraceWrite]
|
|
263
|
+
|
|
264
|
+
request_options : typing.Optional[RequestOptions]
|
|
265
|
+
Request-specific configuration.
|
|
266
|
+
|
|
267
|
+
Returns
|
|
268
|
+
-------
|
|
269
|
+
HttpResponse[None]
|
|
270
|
+
"""
|
|
271
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
272
|
+
"v1/private/traces/batch",
|
|
273
|
+
method="POST",
|
|
274
|
+
json={
|
|
275
|
+
"traces": convert_and_respect_annotation_metadata(
|
|
276
|
+
object_=traces, annotation=typing.Sequence[TraceWrite], direction="write"
|
|
277
|
+
),
|
|
278
|
+
},
|
|
279
|
+
headers={
|
|
280
|
+
"content-type": "application/json",
|
|
281
|
+
},
|
|
282
|
+
request_options=request_options,
|
|
283
|
+
omit=OMIT,
|
|
284
|
+
)
|
|
285
|
+
try:
|
|
286
|
+
if 200 <= _response.status_code < 300:
|
|
287
|
+
return HttpResponse(response=_response, data=None)
|
|
288
|
+
_response_json = _response.json()
|
|
289
|
+
except JSONDecodeError:
|
|
290
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
291
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
292
|
+
|
|
293
|
+
def batch_update_traces(
|
|
294
|
+
self,
|
|
295
|
+
*,
|
|
296
|
+
ids: typing.Sequence[str],
|
|
297
|
+
update: TraceUpdate,
|
|
298
|
+
merge_tags: typing.Optional[bool] = OMIT,
|
|
299
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
300
|
+
) -> HttpResponse[None]:
|
|
301
|
+
"""
|
|
302
|
+
Update multiple traces
|
|
303
|
+
|
|
304
|
+
Parameters
|
|
305
|
+
----------
|
|
306
|
+
ids : typing.Sequence[str]
|
|
307
|
+
List of trace IDs to update (max 1000)
|
|
308
|
+
|
|
309
|
+
update : TraceUpdate
|
|
310
|
+
|
|
311
|
+
merge_tags : typing.Optional[bool]
|
|
312
|
+
If true, merge tags with existing tags instead of replacing them. Default: false
|
|
313
|
+
|
|
314
|
+
request_options : typing.Optional[RequestOptions]
|
|
315
|
+
Request-specific configuration.
|
|
316
|
+
|
|
317
|
+
Returns
|
|
318
|
+
-------
|
|
319
|
+
HttpResponse[None]
|
|
320
|
+
"""
|
|
321
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
322
|
+
"v1/private/traces/batch",
|
|
323
|
+
method="PATCH",
|
|
324
|
+
json={
|
|
325
|
+
"ids": ids,
|
|
326
|
+
"update": convert_and_respect_annotation_metadata(
|
|
327
|
+
object_=update, annotation=TraceUpdate, direction="write"
|
|
328
|
+
),
|
|
329
|
+
"merge_tags": merge_tags,
|
|
330
|
+
},
|
|
331
|
+
headers={
|
|
332
|
+
"content-type": "application/json",
|
|
333
|
+
},
|
|
334
|
+
request_options=request_options,
|
|
335
|
+
omit=OMIT,
|
|
336
|
+
)
|
|
337
|
+
try:
|
|
338
|
+
if 200 <= _response.status_code < 300:
|
|
339
|
+
return HttpResponse(response=_response, data=None)
|
|
340
|
+
if _response.status_code == 400:
|
|
341
|
+
raise BadRequestError(
|
|
342
|
+
headers=dict(_response.headers),
|
|
343
|
+
body=typing.cast(
|
|
344
|
+
typing.Optional[typing.Any],
|
|
345
|
+
parse_obj_as(
|
|
346
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
347
|
+
object_=_response.json(),
|
|
348
|
+
),
|
|
349
|
+
),
|
|
350
|
+
)
|
|
351
|
+
_response_json = _response.json()
|
|
352
|
+
except JSONDecodeError:
|
|
353
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
354
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
355
|
+
|
|
356
|
+
def batch_update_threads(
|
|
357
|
+
self,
|
|
358
|
+
*,
|
|
359
|
+
ids: typing.Sequence[str],
|
|
360
|
+
update: TraceThreadUpdate,
|
|
361
|
+
merge_tags: typing.Optional[bool] = OMIT,
|
|
362
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
363
|
+
) -> HttpResponse[None]:
|
|
364
|
+
"""
|
|
365
|
+
Update multiple threads
|
|
366
|
+
|
|
367
|
+
Parameters
|
|
368
|
+
----------
|
|
369
|
+
ids : typing.Sequence[str]
|
|
370
|
+
List of thread model IDs to update (max 1000)
|
|
371
|
+
|
|
372
|
+
update : TraceThreadUpdate
|
|
373
|
+
|
|
374
|
+
merge_tags : typing.Optional[bool]
|
|
375
|
+
If true, merge tags with existing tags instead of replacing them. Default: false
|
|
376
|
+
|
|
377
|
+
request_options : typing.Optional[RequestOptions]
|
|
378
|
+
Request-specific configuration.
|
|
379
|
+
|
|
380
|
+
Returns
|
|
381
|
+
-------
|
|
382
|
+
HttpResponse[None]
|
|
383
|
+
"""
|
|
384
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
385
|
+
"v1/private/traces/threads/batch",
|
|
386
|
+
method="PATCH",
|
|
387
|
+
json={
|
|
388
|
+
"ids": ids,
|
|
389
|
+
"update": convert_and_respect_annotation_metadata(
|
|
390
|
+
object_=update, annotation=TraceThreadUpdate, direction="write"
|
|
391
|
+
),
|
|
392
|
+
"merge_tags": merge_tags,
|
|
393
|
+
},
|
|
394
|
+
headers={
|
|
395
|
+
"content-type": "application/json",
|
|
396
|
+
},
|
|
397
|
+
request_options=request_options,
|
|
398
|
+
omit=OMIT,
|
|
399
|
+
)
|
|
400
|
+
try:
|
|
401
|
+
if 200 <= _response.status_code < 300:
|
|
402
|
+
return HttpResponse(response=_response, data=None)
|
|
403
|
+
if _response.status_code == 400:
|
|
404
|
+
raise BadRequestError(
|
|
405
|
+
headers=dict(_response.headers),
|
|
406
|
+
body=typing.cast(
|
|
407
|
+
typing.Optional[typing.Any],
|
|
408
|
+
parse_obj_as(
|
|
409
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
410
|
+
object_=_response.json(),
|
|
411
|
+
),
|
|
412
|
+
),
|
|
413
|
+
)
|
|
414
|
+
_response_json = _response.json()
|
|
415
|
+
except JSONDecodeError:
|
|
416
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
417
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
418
|
+
|
|
252
419
|
def close_trace_thread(
|
|
253
420
|
self,
|
|
254
421
|
*,
|
|
@@ -489,45 +656,6 @@ class RawTracesClient:
|
|
|
489
656
|
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
490
657
|
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
491
658
|
|
|
492
|
-
def create_traces(
|
|
493
|
-
self, *, traces: typing.Sequence[TraceWrite], request_options: typing.Optional[RequestOptions] = None
|
|
494
|
-
) -> HttpResponse[None]:
|
|
495
|
-
"""
|
|
496
|
-
Create traces
|
|
497
|
-
|
|
498
|
-
Parameters
|
|
499
|
-
----------
|
|
500
|
-
traces : typing.Sequence[TraceWrite]
|
|
501
|
-
|
|
502
|
-
request_options : typing.Optional[RequestOptions]
|
|
503
|
-
Request-specific configuration.
|
|
504
|
-
|
|
505
|
-
Returns
|
|
506
|
-
-------
|
|
507
|
-
HttpResponse[None]
|
|
508
|
-
"""
|
|
509
|
-
_response = self._client_wrapper.httpx_client.request(
|
|
510
|
-
"v1/private/traces/batch",
|
|
511
|
-
method="POST",
|
|
512
|
-
json={
|
|
513
|
-
"traces": convert_and_respect_annotation_metadata(
|
|
514
|
-
object_=traces, annotation=typing.Sequence[TraceWrite], direction="write"
|
|
515
|
-
),
|
|
516
|
-
},
|
|
517
|
-
headers={
|
|
518
|
-
"content-type": "application/json",
|
|
519
|
-
},
|
|
520
|
-
request_options=request_options,
|
|
521
|
-
omit=OMIT,
|
|
522
|
-
)
|
|
523
|
-
try:
|
|
524
|
-
if 200 <= _response.status_code < 300:
|
|
525
|
-
return HttpResponse(response=_response, data=None)
|
|
526
|
-
_response_json = _response.json()
|
|
527
|
-
except JSONDecodeError:
|
|
528
|
-
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
529
|
-
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
530
|
-
|
|
531
659
|
def get_trace_by_id(
|
|
532
660
|
self,
|
|
533
661
|
id: str,
|
|
@@ -996,14 +1124,14 @@ class RawTracesClient:
|
|
|
996
1124
|
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
997
1125
|
|
|
998
1126
|
def find_trace_threads_feedback_score_names(
|
|
999
|
-
self, *, project_id: str, request_options: typing.Optional[RequestOptions] = None
|
|
1127
|
+
self, *, project_id: typing.Optional[str] = None, request_options: typing.Optional[RequestOptions] = None
|
|
1000
1128
|
) -> HttpResponse[typing.List[str]]:
|
|
1001
1129
|
"""
|
|
1002
1130
|
Find Trace Threads Feedback Score names
|
|
1003
1131
|
|
|
1004
1132
|
Parameters
|
|
1005
1133
|
----------
|
|
1006
|
-
project_id : str
|
|
1134
|
+
project_id : typing.Optional[str]
|
|
1007
1135
|
|
|
1008
1136
|
request_options : typing.Optional[RequestOptions]
|
|
1009
1137
|
Request-specific configuration.
|
|
@@ -1523,10 +1651,10 @@ class RawTracesClient:
|
|
|
1523
1651
|
If true, returns attachment references like [file.png]; if false, downloads and reinjects stripped attachments
|
|
1524
1652
|
|
|
1525
1653
|
from_time : typing.Optional[dt.datetime]
|
|
1526
|
-
Filter trace threads created from this time (ISO-8601 format).
|
|
1654
|
+
Filter trace threads created from this time (ISO-8601 format).
|
|
1527
1655
|
|
|
1528
1656
|
to_time : typing.Optional[dt.datetime]
|
|
1529
|
-
Filter trace threads created up to this time (ISO-8601 format).
|
|
1657
|
+
Filter trace threads created up to this time (ISO-8601 format). If not provided, defaults to current time. Must be after 'from_time'.
|
|
1530
1658
|
|
|
1531
1659
|
request_options : typing.Optional[RequestOptions]
|
|
1532
1660
|
Request-specific configuration. You can pass in configuration such as `chunk_size`, and more to customize the request and response.
|
|
@@ -1625,10 +1753,10 @@ class RawTracesClient:
|
|
|
1625
1753
|
If true, returns attachment references like [file.png]; if false, downloads and reinjects stripped attachments
|
|
1626
1754
|
|
|
1627
1755
|
from_time : typing.Optional[dt.datetime]
|
|
1628
|
-
Filter traces created from this time (ISO-8601 format).
|
|
1756
|
+
Filter traces created from this time (ISO-8601 format).
|
|
1629
1757
|
|
|
1630
1758
|
to_time : typing.Optional[dt.datetime]
|
|
1631
|
-
Filter traces created up to this time (ISO-8601 format).
|
|
1759
|
+
Filter traces created up to this time (ISO-8601 format). If not provided, defaults to current time. Must be after 'from_time'.
|
|
1632
1760
|
|
|
1633
1761
|
request_options : typing.Optional[RequestOptions]
|
|
1634
1762
|
Request-specific configuration. You can pass in configuration such as `chunk_size`, and more to customize the request and response.
|
|
@@ -2114,6 +2242,171 @@ class AsyncRawTracesClient:
|
|
|
2114
2242
|
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
2115
2243
|
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
2116
2244
|
|
|
2245
|
+
async def create_traces(
|
|
2246
|
+
self, *, traces: typing.Sequence[TraceWrite], request_options: typing.Optional[RequestOptions] = None
|
|
2247
|
+
) -> AsyncHttpResponse[None]:
|
|
2248
|
+
"""
|
|
2249
|
+
Create traces
|
|
2250
|
+
|
|
2251
|
+
Parameters
|
|
2252
|
+
----------
|
|
2253
|
+
traces : typing.Sequence[TraceWrite]
|
|
2254
|
+
|
|
2255
|
+
request_options : typing.Optional[RequestOptions]
|
|
2256
|
+
Request-specific configuration.
|
|
2257
|
+
|
|
2258
|
+
Returns
|
|
2259
|
+
-------
|
|
2260
|
+
AsyncHttpResponse[None]
|
|
2261
|
+
"""
|
|
2262
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
2263
|
+
"v1/private/traces/batch",
|
|
2264
|
+
method="POST",
|
|
2265
|
+
json={
|
|
2266
|
+
"traces": convert_and_respect_annotation_metadata(
|
|
2267
|
+
object_=traces, annotation=typing.Sequence[TraceWrite], direction="write"
|
|
2268
|
+
),
|
|
2269
|
+
},
|
|
2270
|
+
headers={
|
|
2271
|
+
"content-type": "application/json",
|
|
2272
|
+
},
|
|
2273
|
+
request_options=request_options,
|
|
2274
|
+
omit=OMIT,
|
|
2275
|
+
)
|
|
2276
|
+
try:
|
|
2277
|
+
if 200 <= _response.status_code < 300:
|
|
2278
|
+
return AsyncHttpResponse(response=_response, data=None)
|
|
2279
|
+
_response_json = _response.json()
|
|
2280
|
+
except JSONDecodeError:
|
|
2281
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
2282
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
2283
|
+
|
|
2284
|
+
async def batch_update_traces(
|
|
2285
|
+
self,
|
|
2286
|
+
*,
|
|
2287
|
+
ids: typing.Sequence[str],
|
|
2288
|
+
update: TraceUpdate,
|
|
2289
|
+
merge_tags: typing.Optional[bool] = OMIT,
|
|
2290
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
2291
|
+
) -> AsyncHttpResponse[None]:
|
|
2292
|
+
"""
|
|
2293
|
+
Update multiple traces
|
|
2294
|
+
|
|
2295
|
+
Parameters
|
|
2296
|
+
----------
|
|
2297
|
+
ids : typing.Sequence[str]
|
|
2298
|
+
List of trace IDs to update (max 1000)
|
|
2299
|
+
|
|
2300
|
+
update : TraceUpdate
|
|
2301
|
+
|
|
2302
|
+
merge_tags : typing.Optional[bool]
|
|
2303
|
+
If true, merge tags with existing tags instead of replacing them. Default: false
|
|
2304
|
+
|
|
2305
|
+
request_options : typing.Optional[RequestOptions]
|
|
2306
|
+
Request-specific configuration.
|
|
2307
|
+
|
|
2308
|
+
Returns
|
|
2309
|
+
-------
|
|
2310
|
+
AsyncHttpResponse[None]
|
|
2311
|
+
"""
|
|
2312
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
2313
|
+
"v1/private/traces/batch",
|
|
2314
|
+
method="PATCH",
|
|
2315
|
+
json={
|
|
2316
|
+
"ids": ids,
|
|
2317
|
+
"update": convert_and_respect_annotation_metadata(
|
|
2318
|
+
object_=update, annotation=TraceUpdate, direction="write"
|
|
2319
|
+
),
|
|
2320
|
+
"merge_tags": merge_tags,
|
|
2321
|
+
},
|
|
2322
|
+
headers={
|
|
2323
|
+
"content-type": "application/json",
|
|
2324
|
+
},
|
|
2325
|
+
request_options=request_options,
|
|
2326
|
+
omit=OMIT,
|
|
2327
|
+
)
|
|
2328
|
+
try:
|
|
2329
|
+
if 200 <= _response.status_code < 300:
|
|
2330
|
+
return AsyncHttpResponse(response=_response, data=None)
|
|
2331
|
+
if _response.status_code == 400:
|
|
2332
|
+
raise BadRequestError(
|
|
2333
|
+
headers=dict(_response.headers),
|
|
2334
|
+
body=typing.cast(
|
|
2335
|
+
typing.Optional[typing.Any],
|
|
2336
|
+
parse_obj_as(
|
|
2337
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
2338
|
+
object_=_response.json(),
|
|
2339
|
+
),
|
|
2340
|
+
),
|
|
2341
|
+
)
|
|
2342
|
+
_response_json = _response.json()
|
|
2343
|
+
except JSONDecodeError:
|
|
2344
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
2345
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
2346
|
+
|
|
2347
|
+
async def batch_update_threads(
|
|
2348
|
+
self,
|
|
2349
|
+
*,
|
|
2350
|
+
ids: typing.Sequence[str],
|
|
2351
|
+
update: TraceThreadUpdate,
|
|
2352
|
+
merge_tags: typing.Optional[bool] = OMIT,
|
|
2353
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
2354
|
+
) -> AsyncHttpResponse[None]:
|
|
2355
|
+
"""
|
|
2356
|
+
Update multiple threads
|
|
2357
|
+
|
|
2358
|
+
Parameters
|
|
2359
|
+
----------
|
|
2360
|
+
ids : typing.Sequence[str]
|
|
2361
|
+
List of thread model IDs to update (max 1000)
|
|
2362
|
+
|
|
2363
|
+
update : TraceThreadUpdate
|
|
2364
|
+
|
|
2365
|
+
merge_tags : typing.Optional[bool]
|
|
2366
|
+
If true, merge tags with existing tags instead of replacing them. Default: false
|
|
2367
|
+
|
|
2368
|
+
request_options : typing.Optional[RequestOptions]
|
|
2369
|
+
Request-specific configuration.
|
|
2370
|
+
|
|
2371
|
+
Returns
|
|
2372
|
+
-------
|
|
2373
|
+
AsyncHttpResponse[None]
|
|
2374
|
+
"""
|
|
2375
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
2376
|
+
"v1/private/traces/threads/batch",
|
|
2377
|
+
method="PATCH",
|
|
2378
|
+
json={
|
|
2379
|
+
"ids": ids,
|
|
2380
|
+
"update": convert_and_respect_annotation_metadata(
|
|
2381
|
+
object_=update, annotation=TraceThreadUpdate, direction="write"
|
|
2382
|
+
),
|
|
2383
|
+
"merge_tags": merge_tags,
|
|
2384
|
+
},
|
|
2385
|
+
headers={
|
|
2386
|
+
"content-type": "application/json",
|
|
2387
|
+
},
|
|
2388
|
+
request_options=request_options,
|
|
2389
|
+
omit=OMIT,
|
|
2390
|
+
)
|
|
2391
|
+
try:
|
|
2392
|
+
if 200 <= _response.status_code < 300:
|
|
2393
|
+
return AsyncHttpResponse(response=_response, data=None)
|
|
2394
|
+
if _response.status_code == 400:
|
|
2395
|
+
raise BadRequestError(
|
|
2396
|
+
headers=dict(_response.headers),
|
|
2397
|
+
body=typing.cast(
|
|
2398
|
+
typing.Optional[typing.Any],
|
|
2399
|
+
parse_obj_as(
|
|
2400
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
2401
|
+
object_=_response.json(),
|
|
2402
|
+
),
|
|
2403
|
+
),
|
|
2404
|
+
)
|
|
2405
|
+
_response_json = _response.json()
|
|
2406
|
+
except JSONDecodeError:
|
|
2407
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
2408
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
2409
|
+
|
|
2117
2410
|
async def close_trace_thread(
|
|
2118
2411
|
self,
|
|
2119
2412
|
*,
|
|
@@ -2354,45 +2647,6 @@ class AsyncRawTracesClient:
|
|
|
2354
2647
|
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
2355
2648
|
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
2356
2649
|
|
|
2357
|
-
async def create_traces(
|
|
2358
|
-
self, *, traces: typing.Sequence[TraceWrite], request_options: typing.Optional[RequestOptions] = None
|
|
2359
|
-
) -> AsyncHttpResponse[None]:
|
|
2360
|
-
"""
|
|
2361
|
-
Create traces
|
|
2362
|
-
|
|
2363
|
-
Parameters
|
|
2364
|
-
----------
|
|
2365
|
-
traces : typing.Sequence[TraceWrite]
|
|
2366
|
-
|
|
2367
|
-
request_options : typing.Optional[RequestOptions]
|
|
2368
|
-
Request-specific configuration.
|
|
2369
|
-
|
|
2370
|
-
Returns
|
|
2371
|
-
-------
|
|
2372
|
-
AsyncHttpResponse[None]
|
|
2373
|
-
"""
|
|
2374
|
-
_response = await self._client_wrapper.httpx_client.request(
|
|
2375
|
-
"v1/private/traces/batch",
|
|
2376
|
-
method="POST",
|
|
2377
|
-
json={
|
|
2378
|
-
"traces": convert_and_respect_annotation_metadata(
|
|
2379
|
-
object_=traces, annotation=typing.Sequence[TraceWrite], direction="write"
|
|
2380
|
-
),
|
|
2381
|
-
},
|
|
2382
|
-
headers={
|
|
2383
|
-
"content-type": "application/json",
|
|
2384
|
-
},
|
|
2385
|
-
request_options=request_options,
|
|
2386
|
-
omit=OMIT,
|
|
2387
|
-
)
|
|
2388
|
-
try:
|
|
2389
|
-
if 200 <= _response.status_code < 300:
|
|
2390
|
-
return AsyncHttpResponse(response=_response, data=None)
|
|
2391
|
-
_response_json = _response.json()
|
|
2392
|
-
except JSONDecodeError:
|
|
2393
|
-
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
2394
|
-
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
2395
|
-
|
|
2396
2650
|
async def get_trace_by_id(
|
|
2397
2651
|
self,
|
|
2398
2652
|
id: str,
|
|
@@ -2861,14 +3115,14 @@ class AsyncRawTracesClient:
|
|
|
2861
3115
|
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
2862
3116
|
|
|
2863
3117
|
async def find_trace_threads_feedback_score_names(
|
|
2864
|
-
self, *, project_id: str, request_options: typing.Optional[RequestOptions] = None
|
|
3118
|
+
self, *, project_id: typing.Optional[str] = None, request_options: typing.Optional[RequestOptions] = None
|
|
2865
3119
|
) -> AsyncHttpResponse[typing.List[str]]:
|
|
2866
3120
|
"""
|
|
2867
3121
|
Find Trace Threads Feedback Score names
|
|
2868
3122
|
|
|
2869
3123
|
Parameters
|
|
2870
3124
|
----------
|
|
2871
|
-
project_id : str
|
|
3125
|
+
project_id : typing.Optional[str]
|
|
2872
3126
|
|
|
2873
3127
|
request_options : typing.Optional[RequestOptions]
|
|
2874
3128
|
Request-specific configuration.
|
|
@@ -3388,10 +3642,10 @@ class AsyncRawTracesClient:
|
|
|
3388
3642
|
If true, returns attachment references like [file.png]; if false, downloads and reinjects stripped attachments
|
|
3389
3643
|
|
|
3390
3644
|
from_time : typing.Optional[dt.datetime]
|
|
3391
|
-
Filter trace threads created from this time (ISO-8601 format).
|
|
3645
|
+
Filter trace threads created from this time (ISO-8601 format).
|
|
3392
3646
|
|
|
3393
3647
|
to_time : typing.Optional[dt.datetime]
|
|
3394
|
-
Filter trace threads created up to this time (ISO-8601 format).
|
|
3648
|
+
Filter trace threads created up to this time (ISO-8601 format). If not provided, defaults to current time. Must be after 'from_time'.
|
|
3395
3649
|
|
|
3396
3650
|
request_options : typing.Optional[RequestOptions]
|
|
3397
3651
|
Request-specific configuration. You can pass in configuration such as `chunk_size`, and more to customize the request and response.
|
|
@@ -3491,10 +3745,10 @@ class AsyncRawTracesClient:
|
|
|
3491
3745
|
If true, returns attachment references like [file.png]; if false, downloads and reinjects stripped attachments
|
|
3492
3746
|
|
|
3493
3747
|
from_time : typing.Optional[dt.datetime]
|
|
3494
|
-
Filter traces created from this time (ISO-8601 format).
|
|
3748
|
+
Filter traces created from this time (ISO-8601 format).
|
|
3495
3749
|
|
|
3496
3750
|
to_time : typing.Optional[dt.datetime]
|
|
3497
|
-
Filter traces created up to this time (ISO-8601 format).
|
|
3751
|
+
Filter traces created up to this time (ISO-8601 format). If not provided, defaults to current time. Must be after 'from_time'.
|
|
3498
3752
|
|
|
3499
3753
|
request_options : typing.Optional[RequestOptions]
|
|
3500
3754
|
Request-specific configuration. You can pass in configuration such as `chunk_size`, and more to customize the request and response.
|