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
|
@@ -28,6 +28,8 @@ from ..types.project_stats_public import ProjectStatsPublic
|
|
|
28
28
|
from ..types.span_filter_public import SpanFilterPublic
|
|
29
29
|
from ..types.span_page_public import SpanPagePublic
|
|
30
30
|
from ..types.span_public import SpanPublic
|
|
31
|
+
from ..types.span_update import SpanUpdate
|
|
32
|
+
from ..types.span_update_type import SpanUpdateType
|
|
31
33
|
from ..types.span_write import SpanWrite
|
|
32
34
|
from ..types.span_write_type import SpanWriteType
|
|
33
35
|
from ..types.value_entry import ValueEntry
|
|
@@ -35,7 +37,6 @@ from .types.find_feedback_score_names_1_request_type import FindFeedbackScoreNam
|
|
|
35
37
|
from .types.get_span_stats_request_type import GetSpanStatsRequestType
|
|
36
38
|
from .types.get_spans_by_project_request_type import GetSpansByProjectRequestType
|
|
37
39
|
from .types.span_search_stream_request_public_type import SpanSearchStreamRequestPublicType
|
|
38
|
-
from .types.span_update_type import SpanUpdateType
|
|
39
40
|
|
|
40
41
|
# this is used as the default value for optional parameters
|
|
41
42
|
OMIT = typing.cast(typing.Any, ...)
|
|
@@ -189,6 +190,108 @@ class RawSpansClient:
|
|
|
189
190
|
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
190
191
|
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
191
192
|
|
|
193
|
+
def create_spans(
|
|
194
|
+
self, *, spans: typing.Sequence[SpanWrite], request_options: typing.Optional[RequestOptions] = None
|
|
195
|
+
) -> HttpResponse[None]:
|
|
196
|
+
"""
|
|
197
|
+
Create spans
|
|
198
|
+
|
|
199
|
+
Parameters
|
|
200
|
+
----------
|
|
201
|
+
spans : typing.Sequence[SpanWrite]
|
|
202
|
+
|
|
203
|
+
request_options : typing.Optional[RequestOptions]
|
|
204
|
+
Request-specific configuration.
|
|
205
|
+
|
|
206
|
+
Returns
|
|
207
|
+
-------
|
|
208
|
+
HttpResponse[None]
|
|
209
|
+
"""
|
|
210
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
211
|
+
"v1/private/spans/batch",
|
|
212
|
+
method="POST",
|
|
213
|
+
json={
|
|
214
|
+
"spans": convert_and_respect_annotation_metadata(
|
|
215
|
+
object_=spans, annotation=typing.Sequence[SpanWrite], direction="write"
|
|
216
|
+
),
|
|
217
|
+
},
|
|
218
|
+
headers={
|
|
219
|
+
"content-type": "application/json",
|
|
220
|
+
},
|
|
221
|
+
request_options=request_options,
|
|
222
|
+
omit=OMIT,
|
|
223
|
+
)
|
|
224
|
+
try:
|
|
225
|
+
if 200 <= _response.status_code < 300:
|
|
226
|
+
return HttpResponse(response=_response, data=None)
|
|
227
|
+
_response_json = _response.json()
|
|
228
|
+
except JSONDecodeError:
|
|
229
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
230
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
231
|
+
|
|
232
|
+
def batch_update_spans(
|
|
233
|
+
self,
|
|
234
|
+
*,
|
|
235
|
+
ids: typing.Sequence[str],
|
|
236
|
+
update: SpanUpdate,
|
|
237
|
+
merge_tags: typing.Optional[bool] = OMIT,
|
|
238
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
239
|
+
) -> HttpResponse[None]:
|
|
240
|
+
"""
|
|
241
|
+
Update multiple spans
|
|
242
|
+
|
|
243
|
+
Parameters
|
|
244
|
+
----------
|
|
245
|
+
ids : typing.Sequence[str]
|
|
246
|
+
List of span IDs to update (max 1000)
|
|
247
|
+
|
|
248
|
+
update : SpanUpdate
|
|
249
|
+
|
|
250
|
+
merge_tags : typing.Optional[bool]
|
|
251
|
+
If true, merge tags with existing tags instead of replacing them. Default: false
|
|
252
|
+
|
|
253
|
+
request_options : typing.Optional[RequestOptions]
|
|
254
|
+
Request-specific configuration.
|
|
255
|
+
|
|
256
|
+
Returns
|
|
257
|
+
-------
|
|
258
|
+
HttpResponse[None]
|
|
259
|
+
"""
|
|
260
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
261
|
+
"v1/private/spans/batch",
|
|
262
|
+
method="PATCH",
|
|
263
|
+
json={
|
|
264
|
+
"ids": ids,
|
|
265
|
+
"update": convert_and_respect_annotation_metadata(
|
|
266
|
+
object_=update, annotation=SpanUpdate, direction="write"
|
|
267
|
+
),
|
|
268
|
+
"merge_tags": merge_tags,
|
|
269
|
+
},
|
|
270
|
+
headers={
|
|
271
|
+
"content-type": "application/json",
|
|
272
|
+
},
|
|
273
|
+
request_options=request_options,
|
|
274
|
+
omit=OMIT,
|
|
275
|
+
)
|
|
276
|
+
try:
|
|
277
|
+
if 200 <= _response.status_code < 300:
|
|
278
|
+
return HttpResponse(response=_response, data=None)
|
|
279
|
+
if _response.status_code == 400:
|
|
280
|
+
raise BadRequestError(
|
|
281
|
+
headers=dict(_response.headers),
|
|
282
|
+
body=typing.cast(
|
|
283
|
+
typing.Optional[typing.Any],
|
|
284
|
+
parse_obj_as(
|
|
285
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
286
|
+
object_=_response.json(),
|
|
287
|
+
),
|
|
288
|
+
),
|
|
289
|
+
)
|
|
290
|
+
_response_json = _response.json()
|
|
291
|
+
except JSONDecodeError:
|
|
292
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
293
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
294
|
+
|
|
192
295
|
def get_spans_by_project(
|
|
193
296
|
self,
|
|
194
297
|
*,
|
|
@@ -413,45 +516,6 @@ class RawSpansClient:
|
|
|
413
516
|
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
414
517
|
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
415
518
|
|
|
416
|
-
def create_spans(
|
|
417
|
-
self, *, spans: typing.Sequence[SpanWrite], request_options: typing.Optional[RequestOptions] = None
|
|
418
|
-
) -> HttpResponse[None]:
|
|
419
|
-
"""
|
|
420
|
-
Create spans
|
|
421
|
-
|
|
422
|
-
Parameters
|
|
423
|
-
----------
|
|
424
|
-
spans : typing.Sequence[SpanWrite]
|
|
425
|
-
|
|
426
|
-
request_options : typing.Optional[RequestOptions]
|
|
427
|
-
Request-specific configuration.
|
|
428
|
-
|
|
429
|
-
Returns
|
|
430
|
-
-------
|
|
431
|
-
HttpResponse[None]
|
|
432
|
-
"""
|
|
433
|
-
_response = self._client_wrapper.httpx_client.request(
|
|
434
|
-
"v1/private/spans/batch",
|
|
435
|
-
method="POST",
|
|
436
|
-
json={
|
|
437
|
-
"spans": convert_and_respect_annotation_metadata(
|
|
438
|
-
object_=spans, annotation=typing.Sequence[SpanWrite], direction="write"
|
|
439
|
-
),
|
|
440
|
-
},
|
|
441
|
-
headers={
|
|
442
|
-
"content-type": "application/json",
|
|
443
|
-
},
|
|
444
|
-
request_options=request_options,
|
|
445
|
-
omit=OMIT,
|
|
446
|
-
)
|
|
447
|
-
try:
|
|
448
|
-
if 200 <= _response.status_code < 300:
|
|
449
|
-
return HttpResponse(response=_response, data=None)
|
|
450
|
-
_response_json = _response.json()
|
|
451
|
-
except JSONDecodeError:
|
|
452
|
-
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
453
|
-
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
454
|
-
|
|
455
519
|
def get_span_by_id(
|
|
456
520
|
self,
|
|
457
521
|
id: str,
|
|
@@ -1008,10 +1072,10 @@ class RawSpansClient:
|
|
|
1008
1072
|
Truncate image included in either input, output or metadata
|
|
1009
1073
|
|
|
1010
1074
|
from_time : typing.Optional[dt.datetime]
|
|
1011
|
-
Filter spans created from this time (ISO-8601 format).
|
|
1075
|
+
Filter spans created from this time (ISO-8601 format).
|
|
1012
1076
|
|
|
1013
1077
|
to_time : typing.Optional[dt.datetime]
|
|
1014
|
-
Filter spans created up to this time (ISO-8601 format).
|
|
1078
|
+
Filter spans created up to this time (ISO-8601 format). If not provided, defaults to current time. Must be after 'from_time'.
|
|
1015
1079
|
|
|
1016
1080
|
request_options : typing.Optional[RequestOptions]
|
|
1017
1081
|
Request-specific configuration. You can pass in configuration such as `chunk_size`, and more to customize the request and response.
|
|
@@ -1296,6 +1360,108 @@ class AsyncRawSpansClient:
|
|
|
1296
1360
|
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
1297
1361
|
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
1298
1362
|
|
|
1363
|
+
async def create_spans(
|
|
1364
|
+
self, *, spans: typing.Sequence[SpanWrite], request_options: typing.Optional[RequestOptions] = None
|
|
1365
|
+
) -> AsyncHttpResponse[None]:
|
|
1366
|
+
"""
|
|
1367
|
+
Create spans
|
|
1368
|
+
|
|
1369
|
+
Parameters
|
|
1370
|
+
----------
|
|
1371
|
+
spans : typing.Sequence[SpanWrite]
|
|
1372
|
+
|
|
1373
|
+
request_options : typing.Optional[RequestOptions]
|
|
1374
|
+
Request-specific configuration.
|
|
1375
|
+
|
|
1376
|
+
Returns
|
|
1377
|
+
-------
|
|
1378
|
+
AsyncHttpResponse[None]
|
|
1379
|
+
"""
|
|
1380
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
1381
|
+
"v1/private/spans/batch",
|
|
1382
|
+
method="POST",
|
|
1383
|
+
json={
|
|
1384
|
+
"spans": convert_and_respect_annotation_metadata(
|
|
1385
|
+
object_=spans, annotation=typing.Sequence[SpanWrite], direction="write"
|
|
1386
|
+
),
|
|
1387
|
+
},
|
|
1388
|
+
headers={
|
|
1389
|
+
"content-type": "application/json",
|
|
1390
|
+
},
|
|
1391
|
+
request_options=request_options,
|
|
1392
|
+
omit=OMIT,
|
|
1393
|
+
)
|
|
1394
|
+
try:
|
|
1395
|
+
if 200 <= _response.status_code < 300:
|
|
1396
|
+
return AsyncHttpResponse(response=_response, data=None)
|
|
1397
|
+
_response_json = _response.json()
|
|
1398
|
+
except JSONDecodeError:
|
|
1399
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
1400
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
1401
|
+
|
|
1402
|
+
async def batch_update_spans(
|
|
1403
|
+
self,
|
|
1404
|
+
*,
|
|
1405
|
+
ids: typing.Sequence[str],
|
|
1406
|
+
update: SpanUpdate,
|
|
1407
|
+
merge_tags: typing.Optional[bool] = OMIT,
|
|
1408
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
1409
|
+
) -> AsyncHttpResponse[None]:
|
|
1410
|
+
"""
|
|
1411
|
+
Update multiple spans
|
|
1412
|
+
|
|
1413
|
+
Parameters
|
|
1414
|
+
----------
|
|
1415
|
+
ids : typing.Sequence[str]
|
|
1416
|
+
List of span IDs to update (max 1000)
|
|
1417
|
+
|
|
1418
|
+
update : SpanUpdate
|
|
1419
|
+
|
|
1420
|
+
merge_tags : typing.Optional[bool]
|
|
1421
|
+
If true, merge tags with existing tags instead of replacing them. Default: false
|
|
1422
|
+
|
|
1423
|
+
request_options : typing.Optional[RequestOptions]
|
|
1424
|
+
Request-specific configuration.
|
|
1425
|
+
|
|
1426
|
+
Returns
|
|
1427
|
+
-------
|
|
1428
|
+
AsyncHttpResponse[None]
|
|
1429
|
+
"""
|
|
1430
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
1431
|
+
"v1/private/spans/batch",
|
|
1432
|
+
method="PATCH",
|
|
1433
|
+
json={
|
|
1434
|
+
"ids": ids,
|
|
1435
|
+
"update": convert_and_respect_annotation_metadata(
|
|
1436
|
+
object_=update, annotation=SpanUpdate, direction="write"
|
|
1437
|
+
),
|
|
1438
|
+
"merge_tags": merge_tags,
|
|
1439
|
+
},
|
|
1440
|
+
headers={
|
|
1441
|
+
"content-type": "application/json",
|
|
1442
|
+
},
|
|
1443
|
+
request_options=request_options,
|
|
1444
|
+
omit=OMIT,
|
|
1445
|
+
)
|
|
1446
|
+
try:
|
|
1447
|
+
if 200 <= _response.status_code < 300:
|
|
1448
|
+
return AsyncHttpResponse(response=_response, data=None)
|
|
1449
|
+
if _response.status_code == 400:
|
|
1450
|
+
raise BadRequestError(
|
|
1451
|
+
headers=dict(_response.headers),
|
|
1452
|
+
body=typing.cast(
|
|
1453
|
+
typing.Optional[typing.Any],
|
|
1454
|
+
parse_obj_as(
|
|
1455
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
1456
|
+
object_=_response.json(),
|
|
1457
|
+
),
|
|
1458
|
+
),
|
|
1459
|
+
)
|
|
1460
|
+
_response_json = _response.json()
|
|
1461
|
+
except JSONDecodeError:
|
|
1462
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
1463
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
1464
|
+
|
|
1299
1465
|
async def get_spans_by_project(
|
|
1300
1466
|
self,
|
|
1301
1467
|
*,
|
|
@@ -1520,45 +1686,6 @@ class AsyncRawSpansClient:
|
|
|
1520
1686
|
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
1521
1687
|
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
1522
1688
|
|
|
1523
|
-
async def create_spans(
|
|
1524
|
-
self, *, spans: typing.Sequence[SpanWrite], request_options: typing.Optional[RequestOptions] = None
|
|
1525
|
-
) -> AsyncHttpResponse[None]:
|
|
1526
|
-
"""
|
|
1527
|
-
Create spans
|
|
1528
|
-
|
|
1529
|
-
Parameters
|
|
1530
|
-
----------
|
|
1531
|
-
spans : typing.Sequence[SpanWrite]
|
|
1532
|
-
|
|
1533
|
-
request_options : typing.Optional[RequestOptions]
|
|
1534
|
-
Request-specific configuration.
|
|
1535
|
-
|
|
1536
|
-
Returns
|
|
1537
|
-
-------
|
|
1538
|
-
AsyncHttpResponse[None]
|
|
1539
|
-
"""
|
|
1540
|
-
_response = await self._client_wrapper.httpx_client.request(
|
|
1541
|
-
"v1/private/spans/batch",
|
|
1542
|
-
method="POST",
|
|
1543
|
-
json={
|
|
1544
|
-
"spans": convert_and_respect_annotation_metadata(
|
|
1545
|
-
object_=spans, annotation=typing.Sequence[SpanWrite], direction="write"
|
|
1546
|
-
),
|
|
1547
|
-
},
|
|
1548
|
-
headers={
|
|
1549
|
-
"content-type": "application/json",
|
|
1550
|
-
},
|
|
1551
|
-
request_options=request_options,
|
|
1552
|
-
omit=OMIT,
|
|
1553
|
-
)
|
|
1554
|
-
try:
|
|
1555
|
-
if 200 <= _response.status_code < 300:
|
|
1556
|
-
return AsyncHttpResponse(response=_response, data=None)
|
|
1557
|
-
_response_json = _response.json()
|
|
1558
|
-
except JSONDecodeError:
|
|
1559
|
-
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
1560
|
-
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
1561
|
-
|
|
1562
1689
|
async def get_span_by_id(
|
|
1563
1690
|
self,
|
|
1564
1691
|
id: str,
|
|
@@ -2115,10 +2242,10 @@ class AsyncRawSpansClient:
|
|
|
2115
2242
|
Truncate image included in either input, output or metadata
|
|
2116
2243
|
|
|
2117
2244
|
from_time : typing.Optional[dt.datetime]
|
|
2118
|
-
Filter spans created from this time (ISO-8601 format).
|
|
2245
|
+
Filter spans created from this time (ISO-8601 format).
|
|
2119
2246
|
|
|
2120
2247
|
to_time : typing.Optional[dt.datetime]
|
|
2121
|
-
Filter spans created up to this time (ISO-8601 format).
|
|
2248
|
+
Filter spans created up to this time (ISO-8601 format). If not provided, defaults to current time. Must be after 'from_time'.
|
|
2122
2249
|
|
|
2123
2250
|
request_options : typing.Optional[RequestOptions]
|
|
2124
2251
|
Request-specific configuration. You can pass in configuration such as `chunk_size`, and more to customize the request and response.
|
|
@@ -6,12 +6,10 @@ from .find_feedback_score_names_1_request_type import FindFeedbackScoreNames1Req
|
|
|
6
6
|
from .get_span_stats_request_type import GetSpanStatsRequestType
|
|
7
7
|
from .get_spans_by_project_request_type import GetSpansByProjectRequestType
|
|
8
8
|
from .span_search_stream_request_public_type import SpanSearchStreamRequestPublicType
|
|
9
|
-
from .span_update_type import SpanUpdateType
|
|
10
9
|
|
|
11
10
|
__all__ = [
|
|
12
11
|
"FindFeedbackScoreNames1RequestType",
|
|
13
12
|
"GetSpanStatsRequestType",
|
|
14
13
|
"GetSpansByProjectRequestType",
|
|
15
14
|
"SpanSearchStreamRequestPublicType",
|
|
16
|
-
"SpanUpdateType",
|
|
17
15
|
]
|