opik 1.6.4__py3-none-any.whl → 1.9.71__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 +33 -2
- 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/attachment/__init__.py +5 -0
- opik/api_objects/attachment/attachment.py +20 -0
- opik/api_objects/attachment/attachment_context.py +36 -0
- opik/api_objects/attachment/attachments_extractor.py +153 -0
- opik/api_objects/attachment/client.py +220 -0
- opik/api_objects/attachment/converters.py +51 -0
- opik/api_objects/attachment/decoder.py +18 -0
- opik/api_objects/attachment/decoder_base64.py +83 -0
- opik/api_objects/attachment/decoder_helpers.py +137 -0
- opik/api_objects/conversation/__init__.py +0 -0
- opik/api_objects/conversation/conversation_factory.py +43 -0
- opik/api_objects/conversation/conversation_thread.py +49 -0
- opik/api_objects/data_helpers.py +79 -0
- opik/api_objects/dataset/dataset.py +107 -45
- opik/api_objects/dataset/rest_operations.py +12 -3
- opik/api_objects/experiment/experiment.py +81 -45
- opik/api_objects/experiment/experiment_item.py +2 -1
- opik/api_objects/experiment/experiments_client.py +64 -0
- opik/api_objects/experiment/helpers.py +35 -11
- opik/api_objects/experiment/rest_operations.py +88 -19
- opik/api_objects/helpers.py +104 -7
- opik/api_objects/local_recording.py +81 -0
- opik/api_objects/opik_client.py +872 -174
- opik/api_objects/opik_query_language.py +136 -18
- opik/api_objects/optimization/__init__.py +3 -0
- opik/api_objects/optimization/optimization.py +39 -0
- opik/api_objects/prompt/__init__.py +13 -1
- 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 +210 -0
- opik/api_objects/prompt/chat/chat_prompt_template.py +350 -0
- opik/api_objects/prompt/chat/content_renderer_registry.py +203 -0
- opik/api_objects/prompt/client.py +193 -41
- opik/api_objects/prompt/text/__init__.py +1 -0
- opik/api_objects/prompt/text/prompt.py +174 -0
- opik/api_objects/prompt/text/prompt_template.py +55 -0
- opik/api_objects/prompt/types.py +29 -0
- opik/api_objects/rest_stream_parser.py +98 -0
- opik/api_objects/search_helpers.py +89 -0
- opik/api_objects/span/span_client.py +165 -45
- opik/api_objects/span/span_data.py +136 -25
- opik/api_objects/threads/__init__.py +0 -0
- opik/api_objects/threads/threads_client.py +185 -0
- opik/api_objects/trace/trace_client.py +72 -36
- opik/api_objects/trace/trace_data.py +112 -26
- opik/api_objects/validation_helpers.py +3 -3
- opik/cli/__init__.py +5 -0
- opik/cli/__main__.py +6 -0
- opik/cli/configure.py +66 -0
- opik/cli/exports/__init__.py +131 -0
- opik/cli/exports/dataset.py +278 -0
- opik/cli/exports/experiment.py +784 -0
- opik/cli/exports/project.py +685 -0
- opik/cli/exports/prompt.py +578 -0
- opik/cli/exports/utils.py +406 -0
- opik/cli/harbor.py +39 -0
- opik/cli/healthcheck.py +21 -0
- opik/cli/imports/__init__.py +439 -0
- opik/cli/imports/dataset.py +143 -0
- opik/cli/imports/experiment.py +1192 -0
- opik/cli/imports/project.py +262 -0
- opik/cli/imports/prompt.py +177 -0
- opik/cli/imports/utils.py +280 -0
- opik/cli/main.py +49 -0
- opik/cli/proxy.py +93 -0
- opik/cli/usage_report/__init__.py +16 -0
- opik/cli/usage_report/charts.py +783 -0
- opik/cli/usage_report/cli.py +274 -0
- opik/cli/usage_report/constants.py +9 -0
- opik/cli/usage_report/extraction.py +749 -0
- opik/cli/usage_report/pdf.py +244 -0
- opik/cli/usage_report/statistics.py +78 -0
- opik/cli/usage_report/utils.py +235 -0
- opik/config.py +62 -4
- opik/configurator/configure.py +45 -6
- opik/configurator/opik_rest_helpers.py +4 -1
- opik/context_storage.py +164 -65
- opik/datetime_helpers.py +12 -0
- opik/decorator/arguments_helpers.py +9 -1
- opik/decorator/base_track_decorator.py +298 -146
- opik/decorator/context_manager/__init__.py +0 -0
- opik/decorator/context_manager/span_context_manager.py +123 -0
- opik/decorator/context_manager/trace_context_manager.py +84 -0
- opik/decorator/generator_wrappers.py +3 -2
- opik/decorator/inspect_helpers.py +11 -0
- opik/decorator/opik_args/__init__.py +13 -0
- opik/decorator/opik_args/api_classes.py +71 -0
- opik/decorator/opik_args/helpers.py +120 -0
- opik/decorator/span_creation_handler.py +49 -21
- opik/decorator/tracker.py +9 -1
- opik/dict_utils.py +3 -3
- opik/environment.py +13 -1
- opik/error_tracking/api.py +1 -1
- opik/error_tracking/before_send.py +6 -5
- opik/error_tracking/environment_details.py +29 -7
- opik/error_tracking/error_filtering/filter_by_response_status_code.py +42 -0
- opik/error_tracking/error_filtering/filter_chain_builder.py +14 -3
- opik/evaluation/__init__.py +14 -2
- opik/evaluation/engine/engine.py +280 -82
- opik/evaluation/engine/evaluation_tasks_executor.py +15 -10
- opik/evaluation/engine/helpers.py +34 -9
- opik/evaluation/engine/metrics_evaluator.py +237 -0
- opik/evaluation/engine/types.py +5 -4
- opik/evaluation/evaluation_result.py +169 -2
- opik/evaluation/evaluator.py +659 -58
- opik/evaluation/metrics/__init__.py +121 -6
- opik/evaluation/metrics/aggregated_metric.py +92 -0
- opik/evaluation/metrics/arguments_helpers.py +15 -21
- opik/evaluation/metrics/arguments_validator.py +38 -0
- opik/evaluation/metrics/base_metric.py +20 -10
- opik/evaluation/metrics/conversation/__init__.py +48 -0
- opik/evaluation/metrics/conversation/conversation_thread_metric.py +79 -0
- opik/evaluation/metrics/conversation/conversation_turns_factory.py +39 -0
- opik/evaluation/metrics/conversation/g_eval_wrappers.py +19 -0
- opik/evaluation/metrics/conversation/helpers.py +84 -0
- opik/evaluation/metrics/conversation/heuristics/__init__.py +14 -0
- opik/evaluation/metrics/conversation/heuristics/degeneration/__init__.py +3 -0
- opik/evaluation/metrics/conversation/heuristics/degeneration/metric.py +189 -0
- opik/evaluation/metrics/conversation/heuristics/degeneration/phrases.py +12 -0
- opik/evaluation/metrics/conversation/heuristics/knowledge_retention/__init__.py +3 -0
- opik/evaluation/metrics/conversation/heuristics/knowledge_retention/metric.py +172 -0
- opik/evaluation/metrics/conversation/llm_judges/__init__.py +32 -0
- opik/evaluation/metrics/conversation/llm_judges/conversational_coherence/__init__.py +0 -0
- opik/evaluation/metrics/conversation/llm_judges/conversational_coherence/metric.py +274 -0
- opik/evaluation/metrics/conversation/llm_judges/conversational_coherence/schema.py +16 -0
- opik/evaluation/metrics/conversation/llm_judges/conversational_coherence/templates.py +95 -0
- opik/evaluation/metrics/conversation/llm_judges/g_eval_wrappers.py +442 -0
- opik/evaluation/metrics/conversation/llm_judges/session_completeness/__init__.py +0 -0
- opik/evaluation/metrics/conversation/llm_judges/session_completeness/metric.py +295 -0
- opik/evaluation/metrics/conversation/llm_judges/session_completeness/schema.py +22 -0
- opik/evaluation/metrics/conversation/llm_judges/session_completeness/templates.py +139 -0
- opik/evaluation/metrics/conversation/llm_judges/user_frustration/__init__.py +0 -0
- opik/evaluation/metrics/conversation/llm_judges/user_frustration/metric.py +277 -0
- opik/evaluation/metrics/conversation/llm_judges/user_frustration/schema.py +16 -0
- opik/evaluation/metrics/conversation/llm_judges/user_frustration/templates.py +135 -0
- opik/evaluation/metrics/conversation/types.py +34 -0
- opik/evaluation/metrics/conversation_types.py +9 -0
- opik/evaluation/metrics/heuristics/bertscore.py +107 -0
- opik/evaluation/metrics/heuristics/bleu.py +43 -16
- opik/evaluation/metrics/heuristics/chrf.py +127 -0
- opik/evaluation/metrics/heuristics/contains.py +50 -11
- opik/evaluation/metrics/heuristics/distribution_metrics.py +331 -0
- opik/evaluation/metrics/heuristics/equals.py +4 -1
- opik/evaluation/metrics/heuristics/gleu.py +113 -0
- opik/evaluation/metrics/heuristics/is_json.py +9 -3
- opik/evaluation/metrics/heuristics/language_adherence.py +123 -0
- opik/evaluation/metrics/heuristics/levenshtein_ratio.py +6 -5
- opik/evaluation/metrics/heuristics/meteor.py +119 -0
- opik/evaluation/metrics/heuristics/prompt_injection.py +150 -0
- opik/evaluation/metrics/heuristics/readability.py +129 -0
- opik/evaluation/metrics/heuristics/regex_match.py +4 -1
- opik/evaluation/metrics/heuristics/rouge.py +148 -0
- opik/evaluation/metrics/heuristics/sentiment.py +98 -0
- opik/evaluation/metrics/heuristics/spearman.py +88 -0
- opik/evaluation/metrics/heuristics/tone.py +155 -0
- opik/evaluation/metrics/heuristics/vader_sentiment.py +77 -0
- opik/evaluation/metrics/llm_judges/answer_relevance/metric.py +27 -30
- opik/evaluation/metrics/llm_judges/answer_relevance/parser.py +27 -0
- opik/evaluation/metrics/llm_judges/answer_relevance/templates.py +10 -10
- opik/evaluation/metrics/llm_judges/context_precision/metric.py +28 -31
- opik/evaluation/metrics/llm_judges/context_precision/parser.py +27 -0
- opik/evaluation/metrics/llm_judges/context_precision/template.py +7 -7
- opik/evaluation/metrics/llm_judges/context_recall/metric.py +27 -31
- opik/evaluation/metrics/llm_judges/context_recall/parser.py +27 -0
- opik/evaluation/metrics/llm_judges/context_recall/template.py +7 -7
- opik/evaluation/metrics/llm_judges/factuality/metric.py +7 -26
- opik/evaluation/metrics/llm_judges/factuality/parser.py +35 -0
- opik/evaluation/metrics/llm_judges/factuality/template.py +1 -1
- opik/evaluation/metrics/llm_judges/g_eval/__init__.py +5 -0
- opik/evaluation/metrics/llm_judges/g_eval/metric.py +244 -113
- opik/evaluation/metrics/llm_judges/g_eval/parser.py +161 -0
- opik/evaluation/metrics/llm_judges/g_eval/presets.py +209 -0
- opik/evaluation/metrics/llm_judges/g_eval_presets/__init__.py +36 -0
- opik/evaluation/metrics/llm_judges/g_eval_presets/agent_assessment.py +77 -0
- opik/evaluation/metrics/llm_judges/g_eval_presets/bias_classifier.py +181 -0
- opik/evaluation/metrics/llm_judges/g_eval_presets/compliance_risk.py +41 -0
- opik/evaluation/metrics/llm_judges/g_eval_presets/prompt_uncertainty.py +41 -0
- opik/evaluation/metrics/llm_judges/g_eval_presets/qa_suite.py +146 -0
- opik/evaluation/metrics/llm_judges/hallucination/metric.py +23 -27
- opik/evaluation/metrics/llm_judges/hallucination/parser.py +29 -0
- opik/evaluation/metrics/llm_judges/hallucination/template.py +2 -4
- opik/evaluation/metrics/llm_judges/llm_juries/__init__.py +3 -0
- opik/evaluation/metrics/llm_judges/llm_juries/metric.py +76 -0
- opik/evaluation/metrics/llm_judges/moderation/metric.py +23 -28
- opik/evaluation/metrics/llm_judges/moderation/parser.py +27 -0
- opik/evaluation/metrics/llm_judges/moderation/template.py +2 -2
- opik/evaluation/metrics/llm_judges/parsing_helpers.py +26 -0
- opik/evaluation/metrics/llm_judges/structure_output_compliance/__init__.py +0 -0
- opik/evaluation/metrics/llm_judges/structure_output_compliance/metric.py +144 -0
- opik/evaluation/metrics/llm_judges/structure_output_compliance/parser.py +79 -0
- opik/evaluation/metrics/llm_judges/structure_output_compliance/schema.py +15 -0
- opik/evaluation/metrics/llm_judges/structure_output_compliance/template.py +50 -0
- opik/evaluation/metrics/llm_judges/syc_eval/__init__.py +0 -0
- opik/evaluation/metrics/llm_judges/syc_eval/metric.py +252 -0
- opik/evaluation/metrics/llm_judges/syc_eval/parser.py +82 -0
- opik/evaluation/metrics/llm_judges/syc_eval/template.py +155 -0
- opik/evaluation/metrics/llm_judges/trajectory_accuracy/__init__.py +3 -0
- opik/evaluation/metrics/llm_judges/trajectory_accuracy/metric.py +171 -0
- opik/evaluation/metrics/llm_judges/trajectory_accuracy/parser.py +38 -0
- opik/evaluation/metrics/llm_judges/trajectory_accuracy/templates.py +65 -0
- opik/evaluation/metrics/llm_judges/usefulness/metric.py +23 -32
- opik/evaluation/metrics/llm_judges/usefulness/parser.py +28 -0
- opik/evaluation/metrics/ragas_metric.py +112 -0
- opik/evaluation/models/__init__.py +10 -0
- opik/evaluation/models/base_model.py +140 -18
- opik/evaluation/models/langchain/__init__.py +3 -0
- opik/evaluation/models/langchain/langchain_chat_model.py +166 -0
- opik/evaluation/models/langchain/message_converters.py +106 -0
- opik/evaluation/models/langchain/opik_monitoring.py +23 -0
- opik/evaluation/models/litellm/litellm_chat_model.py +186 -40
- opik/evaluation/models/litellm/opik_monitor.py +24 -21
- opik/evaluation/models/litellm/util.py +125 -0
- opik/evaluation/models/litellm/warning_filters.py +16 -4
- opik/evaluation/models/model_capabilities.py +187 -0
- opik/evaluation/models/models_factory.py +25 -3
- opik/evaluation/preprocessing.py +92 -0
- opik/evaluation/report.py +70 -12
- opik/evaluation/rest_operations.py +49 -45
- opik/evaluation/samplers/__init__.py +4 -0
- opik/evaluation/samplers/base_dataset_sampler.py +40 -0
- opik/evaluation/samplers/random_dataset_sampler.py +48 -0
- opik/evaluation/score_statistics.py +66 -0
- opik/evaluation/scorers/__init__.py +4 -0
- opik/evaluation/scorers/scorer_function.py +55 -0
- opik/evaluation/scorers/scorer_wrapper_metric.py +130 -0
- opik/evaluation/test_case.py +3 -2
- opik/evaluation/test_result.py +1 -0
- opik/evaluation/threads/__init__.py +0 -0
- opik/evaluation/threads/context_helper.py +32 -0
- opik/evaluation/threads/evaluation_engine.py +181 -0
- opik/evaluation/threads/evaluation_result.py +18 -0
- opik/evaluation/threads/evaluator.py +120 -0
- opik/evaluation/threads/helpers.py +51 -0
- opik/evaluation/types.py +9 -1
- opik/exceptions.py +116 -3
- opik/file_upload/__init__.py +0 -0
- opik/file_upload/base_upload_manager.py +39 -0
- opik/file_upload/file_upload_monitor.py +14 -0
- opik/file_upload/file_uploader.py +141 -0
- opik/file_upload/mime_type.py +9 -0
- opik/file_upload/s3_multipart_upload/__init__.py +0 -0
- opik/file_upload/s3_multipart_upload/file_parts_strategy.py +89 -0
- opik/file_upload/s3_multipart_upload/s3_file_uploader.py +86 -0
- opik/file_upload/s3_multipart_upload/s3_upload_error.py +29 -0
- opik/file_upload/thread_pool.py +17 -0
- opik/file_upload/upload_client.py +114 -0
- opik/file_upload/upload_manager.py +255 -0
- opik/file_upload/upload_options.py +37 -0
- opik/format_helpers.py +17 -0
- opik/guardrails/__init__.py +4 -0
- opik/guardrails/guardrail.py +157 -0
- opik/guardrails/guards/__init__.py +5 -0
- opik/guardrails/guards/guard.py +17 -0
- opik/guardrails/guards/pii.py +47 -0
- opik/guardrails/guards/topic.py +76 -0
- opik/guardrails/rest_api_client.py +34 -0
- opik/guardrails/schemas.py +24 -0
- opik/guardrails/tracing.py +61 -0
- opik/healthcheck/__init__.py +2 -1
- opik/healthcheck/checks.py +2 -2
- opik/healthcheck/rich_representation.py +1 -1
- opik/hooks/__init__.py +23 -0
- opik/hooks/anonymizer_hook.py +36 -0
- opik/hooks/httpx_client_hook.py +112 -0
- opik/httpx_client.py +75 -4
- opik/id_helpers.py +18 -0
- opik/integrations/adk/__init__.py +14 -0
- opik/integrations/adk/callback_context_info_extractors.py +32 -0
- opik/integrations/adk/graph/__init__.py +0 -0
- opik/integrations/adk/graph/mermaid_graph_builder.py +128 -0
- opik/integrations/adk/graph/nodes.py +101 -0
- opik/integrations/adk/graph/subgraph_edges_builders.py +41 -0
- opik/integrations/adk/helpers.py +48 -0
- opik/integrations/adk/legacy_opik_tracer.py +381 -0
- opik/integrations/adk/opik_tracer.py +370 -0
- opik/integrations/adk/patchers/__init__.py +4 -0
- opik/integrations/adk/patchers/adk_otel_tracer/__init__.py +0 -0
- opik/integrations/adk/patchers/adk_otel_tracer/llm_span_helpers.py +30 -0
- opik/integrations/adk/patchers/adk_otel_tracer/opik_adk_otel_tracer.py +201 -0
- opik/integrations/adk/patchers/litellm_wrappers.py +91 -0
- opik/integrations/adk/patchers/llm_response_wrapper.py +105 -0
- opik/integrations/adk/patchers/patchers.py +64 -0
- opik/integrations/adk/recursive_callback_injector.py +126 -0
- opik/integrations/aisuite/aisuite_decorator.py +8 -3
- opik/integrations/aisuite/opik_tracker.py +1 -0
- opik/integrations/anthropic/messages_create_decorator.py +8 -3
- opik/integrations/anthropic/opik_tracker.py +0 -1
- opik/integrations/bedrock/converse/__init__.py +0 -0
- opik/integrations/bedrock/converse/chunks_aggregator.py +188 -0
- opik/integrations/bedrock/{converse_decorator.py → converse/converse_decorator.py} +18 -8
- opik/integrations/bedrock/invoke_agent_decorator.py +12 -7
- opik/integrations/bedrock/invoke_model/__init__.py +0 -0
- opik/integrations/bedrock/invoke_model/chunks_aggregator/__init__.py +78 -0
- opik/integrations/bedrock/invoke_model/chunks_aggregator/api.py +45 -0
- opik/integrations/bedrock/invoke_model/chunks_aggregator/base.py +23 -0
- opik/integrations/bedrock/invoke_model/chunks_aggregator/claude.py +121 -0
- opik/integrations/bedrock/invoke_model/chunks_aggregator/format_detector.py +107 -0
- opik/integrations/bedrock/invoke_model/chunks_aggregator/llama.py +108 -0
- opik/integrations/bedrock/invoke_model/chunks_aggregator/mistral.py +118 -0
- opik/integrations/bedrock/invoke_model/chunks_aggregator/nova.py +99 -0
- opik/integrations/bedrock/invoke_model/invoke_model_decorator.py +178 -0
- opik/integrations/bedrock/invoke_model/response_types.py +34 -0
- opik/integrations/bedrock/invoke_model/stream_wrappers.py +122 -0
- opik/integrations/bedrock/invoke_model/usage_converters.py +87 -0
- opik/integrations/bedrock/invoke_model/usage_extraction.py +108 -0
- opik/integrations/bedrock/opik_tracker.py +43 -4
- opik/integrations/bedrock/types.py +19 -0
- opik/integrations/crewai/crewai_decorator.py +34 -56
- opik/integrations/crewai/opik_tracker.py +31 -10
- opik/integrations/crewai/patchers/__init__.py +5 -0
- opik/integrations/crewai/patchers/flow.py +118 -0
- opik/integrations/crewai/patchers/litellm_completion.py +30 -0
- opik/integrations/crewai/patchers/llm_client.py +207 -0
- opik/integrations/dspy/callback.py +246 -84
- opik/integrations/dspy/graph.py +88 -0
- opik/integrations/dspy/parsers.py +168 -0
- opik/integrations/genai/encoder_extension.py +2 -6
- opik/integrations/genai/generate_content_decorator.py +20 -13
- opik/integrations/guardrails/guardrails_decorator.py +4 -0
- opik/integrations/harbor/__init__.py +17 -0
- opik/integrations/harbor/experiment_service.py +269 -0
- opik/integrations/harbor/opik_tracker.py +528 -0
- opik/integrations/haystack/constants.py +35 -0
- opik/integrations/haystack/converters.py +1 -2
- opik/integrations/haystack/opik_connector.py +28 -6
- opik/integrations/haystack/opik_span_bridge.py +284 -0
- opik/integrations/haystack/opik_tracer.py +124 -222
- opik/integrations/langchain/__init__.py +3 -1
- opik/integrations/langchain/helpers.py +96 -0
- opik/integrations/langchain/langgraph_async_context_bridge.py +131 -0
- opik/integrations/langchain/langgraph_tracer_injector.py +88 -0
- opik/integrations/langchain/opik_encoder_extension.py +2 -2
- opik/integrations/langchain/opik_tracer.py +641 -206
- opik/integrations/langchain/provider_usage_extractors/__init__.py +5 -0
- opik/integrations/langchain/provider_usage_extractors/anthropic_usage_extractor.py +101 -0
- opik/integrations/langchain/provider_usage_extractors/anthropic_vertexai_usage_extractor.py +67 -0
- opik/integrations/langchain/provider_usage_extractors/bedrock_usage_extractor.py +94 -0
- opik/integrations/langchain/provider_usage_extractors/google_generative_ai_usage_extractor.py +109 -0
- opik/integrations/langchain/provider_usage_extractors/groq_usage_extractor.py +92 -0
- opik/integrations/langchain/provider_usage_extractors/langchain_run_helpers/__init__.py +15 -0
- opik/integrations/langchain/provider_usage_extractors/langchain_run_helpers/helpers.py +134 -0
- opik/integrations/langchain/provider_usage_extractors/langchain_run_helpers/langchain_usage.py +163 -0
- opik/integrations/langchain/provider_usage_extractors/openai_usage_extractor.py +124 -0
- opik/integrations/langchain/provider_usage_extractors/provider_usage_extractor_protocol.py +29 -0
- opik/integrations/langchain/provider_usage_extractors/usage_extractor.py +48 -0
- opik/integrations/langchain/provider_usage_extractors/vertexai_usage_extractor.py +109 -0
- opik/integrations/litellm/__init__.py +5 -0
- opik/integrations/litellm/completion_chunks_aggregator.py +115 -0
- opik/integrations/litellm/litellm_completion_decorator.py +242 -0
- opik/integrations/litellm/opik_tracker.py +43 -0
- opik/integrations/litellm/stream_patchers.py +151 -0
- opik/integrations/llama_index/callback.py +179 -78
- opik/integrations/llama_index/event_parsing_utils.py +29 -9
- opik/integrations/openai/agents/opik_tracing_processor.py +204 -32
- opik/integrations/openai/agents/span_data_parsers.py +15 -6
- opik/integrations/openai/chat_completion_chunks_aggregator.py +1 -1
- opik/integrations/openai/{openai_decorator.py → openai_chat_completions_decorator.py} +45 -35
- opik/integrations/openai/openai_responses_decorator.py +158 -0
- opik/integrations/openai/opik_tracker.py +94 -13
- opik/integrations/openai/response_events_aggregator.py +36 -0
- opik/integrations/openai/stream_patchers.py +125 -15
- opik/integrations/sagemaker/auth.py +5 -1
- opik/jsonable_encoder.py +29 -1
- opik/llm_usage/base_original_provider_usage.py +15 -8
- opik/llm_usage/bedrock_usage.py +8 -2
- opik/llm_usage/google_usage.py +6 -1
- opik/llm_usage/llm_usage_info.py +6 -0
- opik/llm_usage/{openai_usage.py → openai_chat_completions_usage.py} +2 -12
- opik/llm_usage/{openai_agent_usage.py → openai_responses_usage.py} +7 -15
- opik/llm_usage/opik_usage.py +36 -10
- opik/llm_usage/opik_usage_factory.py +35 -19
- opik/logging_messages.py +19 -7
- opik/message_processing/arguments_utils.py +22 -0
- opik/message_processing/batching/base_batcher.py +45 -17
- opik/message_processing/batching/batch_manager.py +22 -10
- opik/message_processing/batching/batch_manager_constuctors.py +36 -11
- opik/message_processing/batching/batchers.py +167 -44
- opik/message_processing/batching/flushing_thread.py +0 -3
- opik/message_processing/batching/sequence_splitter.py +50 -5
- opik/message_processing/emulation/__init__.py +0 -0
- opik/message_processing/emulation/emulator_message_processor.py +578 -0
- opik/message_processing/emulation/local_emulator_message_processor.py +140 -0
- opik/message_processing/emulation/models.py +162 -0
- opik/message_processing/encoder_helpers.py +79 -0
- opik/message_processing/message_queue.py +79 -0
- opik/message_processing/messages.py +154 -12
- opik/message_processing/preprocessing/__init__.py +0 -0
- opik/message_processing/preprocessing/attachments_preprocessor.py +70 -0
- opik/message_processing/preprocessing/batching_preprocessor.py +53 -0
- opik/message_processing/preprocessing/constants.py +1 -0
- opik/message_processing/preprocessing/file_upload_preprocessor.py +38 -0
- opik/message_processing/preprocessing/preprocessor.py +36 -0
- opik/message_processing/processors/__init__.py +0 -0
- opik/message_processing/processors/attachments_extraction_processor.py +146 -0
- opik/message_processing/processors/message_processors.py +92 -0
- opik/message_processing/processors/message_processors_chain.py +96 -0
- opik/message_processing/processors/online_message_processor.py +324 -0
- opik/message_processing/queue_consumer.py +61 -13
- opik/message_processing/streamer.py +102 -31
- opik/message_processing/streamer_constructors.py +67 -12
- opik/opik_context.py +103 -11
- opik/plugins/pytest/decorator.py +2 -2
- opik/plugins/pytest/experiment_runner.py +3 -2
- opik/plugins/pytest/hooks.py +6 -4
- opik/rate_limit/__init__.py +0 -0
- opik/rate_limit/rate_limit.py +25 -0
- opik/rest_api/__init__.py +643 -11
- opik/rest_api/alerts/__init__.py +7 -0
- opik/rest_api/alerts/client.py +667 -0
- opik/rest_api/alerts/raw_client.py +1015 -0
- opik/rest_api/alerts/types/__init__.py +7 -0
- opik/rest_api/alerts/types/get_webhook_examples_request_alert_type.py +5 -0
- opik/rest_api/annotation_queues/__init__.py +4 -0
- opik/rest_api/annotation_queues/client.py +668 -0
- opik/rest_api/annotation_queues/raw_client.py +1019 -0
- opik/rest_api/attachments/__init__.py +17 -0
- opik/rest_api/attachments/client.py +752 -0
- opik/rest_api/attachments/raw_client.py +1125 -0
- opik/rest_api/attachments/types/__init__.py +15 -0
- opik/rest_api/attachments/types/attachment_list_request_entity_type.py +5 -0
- opik/rest_api/attachments/types/download_attachment_request_entity_type.py +5 -0
- opik/rest_api/attachments/types/start_multipart_upload_request_entity_type.py +5 -0
- opik/rest_api/attachments/types/upload_attachment_request_entity_type.py +5 -0
- opik/rest_api/automation_rule_evaluators/__init__.py +2 -0
- opik/rest_api/automation_rule_evaluators/client.py +182 -1162
- opik/rest_api/automation_rule_evaluators/raw_client.py +598 -0
- opik/rest_api/chat_completions/__init__.py +2 -0
- opik/rest_api/chat_completions/client.py +115 -149
- opik/rest_api/chat_completions/raw_client.py +339 -0
- opik/rest_api/check/__init__.py +2 -0
- opik/rest_api/check/client.py +88 -106
- opik/rest_api/check/raw_client.py +258 -0
- opik/rest_api/client.py +112 -212
- opik/rest_api/core/__init__.py +5 -0
- opik/rest_api/core/api_error.py +12 -6
- opik/rest_api/core/client_wrapper.py +4 -14
- opik/rest_api/core/datetime_utils.py +1 -3
- opik/rest_api/core/file.py +2 -5
- opik/rest_api/core/http_client.py +42 -120
- opik/rest_api/core/http_response.py +55 -0
- opik/rest_api/core/jsonable_encoder.py +1 -4
- opik/rest_api/core/pydantic_utilities.py +79 -147
- opik/rest_api/core/query_encoder.py +1 -3
- opik/rest_api/core/serialization.py +10 -10
- 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/__init__.py +5 -0
- opik/rest_api/datasets/client.py +1638 -1091
- opik/rest_api/datasets/raw_client.py +3389 -0
- opik/rest_api/datasets/types/__init__.py +8 -0
- opik/rest_api/datasets/types/dataset_update_visibility.py +5 -0
- opik/rest_api/datasets/types/dataset_write_visibility.py +5 -0
- opik/rest_api/errors/__init__.py +2 -0
- opik/rest_api/errors/bad_request_error.py +4 -3
- opik/rest_api/errors/conflict_error.py +4 -3
- opik/rest_api/errors/forbidden_error.py +4 -2
- opik/rest_api/errors/not_found_error.py +4 -3
- opik/rest_api/errors/not_implemented_error.py +4 -3
- opik/rest_api/errors/unauthorized_error.py +4 -3
- opik/rest_api/errors/unprocessable_entity_error.py +4 -3
- opik/rest_api/experiments/__init__.py +5 -0
- opik/rest_api/experiments/client.py +676 -752
- opik/rest_api/experiments/raw_client.py +1872 -0
- opik/rest_api/experiments/types/__init__.py +10 -0
- opik/rest_api/experiments/types/experiment_update_status.py +5 -0
- opik/rest_api/experiments/types/experiment_update_type.py +5 -0
- opik/rest_api/experiments/types/experiment_write_status.py +5 -0
- opik/rest_api/experiments/types/experiment_write_type.py +5 -0
- opik/rest_api/feedback_definitions/__init__.py +2 -0
- opik/rest_api/feedback_definitions/client.py +96 -370
- opik/rest_api/feedback_definitions/raw_client.py +541 -0
- opik/rest_api/feedback_definitions/types/__init__.py +2 -0
- opik/rest_api/feedback_definitions/types/find_feedback_definitions_request_type.py +1 -3
- opik/rest_api/guardrails/__init__.py +4 -0
- opik/rest_api/guardrails/client.py +104 -0
- opik/rest_api/guardrails/raw_client.py +102 -0
- opik/rest_api/llm_provider_key/__init__.py +2 -0
- opik/rest_api/llm_provider_key/client.py +166 -440
- opik/rest_api/llm_provider_key/raw_client.py +643 -0
- opik/rest_api/llm_provider_key/types/__init__.py +2 -0
- opik/rest_api/llm_provider_key/types/provider_api_key_write_provider.py +1 -1
- opik/rest_api/manual_evaluation/__init__.py +4 -0
- opik/rest_api/manual_evaluation/client.py +347 -0
- opik/rest_api/manual_evaluation/raw_client.py +543 -0
- opik/rest_api/open_telemetry_ingestion/__init__.py +2 -0
- opik/rest_api/open_telemetry_ingestion/client.py +38 -63
- opik/rest_api/open_telemetry_ingestion/raw_client.py +88 -0
- opik/rest_api/optimizations/__init__.py +7 -0
- opik/rest_api/optimizations/client.py +704 -0
- opik/rest_api/optimizations/raw_client.py +920 -0
- opik/rest_api/optimizations/types/__init__.py +7 -0
- opik/rest_api/optimizations/types/optimization_update_status.py +7 -0
- opik/rest_api/projects/__init__.py +10 -1
- opik/rest_api/projects/client.py +180 -855
- opik/rest_api/projects/raw_client.py +1216 -0
- opik/rest_api/projects/types/__init__.py +11 -4
- opik/rest_api/projects/types/project_metric_request_public_interval.py +1 -3
- opik/rest_api/projects/types/project_metric_request_public_metric_type.py +11 -1
- opik/rest_api/projects/types/project_update_visibility.py +5 -0
- opik/rest_api/projects/types/project_write_visibility.py +5 -0
- opik/rest_api/prompts/__init__.py +4 -2
- opik/rest_api/prompts/client.py +381 -970
- opik/rest_api/prompts/raw_client.py +1634 -0
- opik/rest_api/prompts/types/__init__.py +5 -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/raw_client.py +156 -0
- opik/rest_api/redirect/__init__.py +4 -0
- opik/rest_api/redirect/client.py +375 -0
- opik/rest_api/redirect/raw_client.py +566 -0
- opik/rest_api/service_toggles/__init__.py +4 -0
- opik/rest_api/service_toggles/client.py +91 -0
- opik/rest_api/service_toggles/raw_client.py +93 -0
- opik/rest_api/spans/__init__.py +2 -0
- opik/rest_api/spans/client.py +659 -1354
- opik/rest_api/spans/raw_client.py +2383 -0
- opik/rest_api/spans/types/__init__.py +2 -0
- opik/rest_api/spans/types/find_feedback_score_names_1_request_type.py +1 -3
- opik/rest_api/spans/types/get_span_stats_request_type.py +1 -3
- opik/rest_api/spans/types/get_spans_by_project_request_type.py +1 -3
- opik/rest_api/spans/types/span_search_stream_request_public_type.py +1 -3
- opik/rest_api/system_usage/__init__.py +2 -0
- opik/rest_api/system_usage/client.py +157 -216
- opik/rest_api/system_usage/raw_client.py +455 -0
- opik/rest_api/traces/__init__.py +2 -0
- opik/rest_api/traces/client.py +2102 -1625
- opik/rest_api/traces/raw_client.py +4144 -0
- opik/rest_api/types/__init__.py +629 -24
- opik/rest_api/types/aggregation_data.py +27 -0
- opik/rest_api/types/alert.py +33 -0
- opik/rest_api/types/alert_alert_type.py +5 -0
- opik/rest_api/types/alert_page_public.py +24 -0
- opik/rest_api/types/alert_public.py +33 -0
- opik/rest_api/types/alert_public_alert_type.py +5 -0
- opik/rest_api/types/alert_trigger.py +27 -0
- opik/rest_api/types/alert_trigger_config.py +28 -0
- opik/rest_api/types/alert_trigger_config_public.py +28 -0
- opik/rest_api/types/alert_trigger_config_public_type.py +10 -0
- opik/rest_api/types/alert_trigger_config_type.py +10 -0
- opik/rest_api/types/alert_trigger_config_write.py +22 -0
- opik/rest_api/types/alert_trigger_config_write_type.py +10 -0
- opik/rest_api/types/alert_trigger_event_type.py +19 -0
- opik/rest_api/types/alert_trigger_public.py +27 -0
- opik/rest_api/types/alert_trigger_public_event_type.py +19 -0
- opik/rest_api/types/alert_trigger_write.py +23 -0
- opik/rest_api/types/alert_trigger_write_event_type.py +19 -0
- opik/rest_api/types/alert_write.py +28 -0
- opik/rest_api/types/alert_write_alert_type.py +5 -0
- opik/rest_api/types/annotation_queue.py +42 -0
- opik/rest_api/types/annotation_queue_batch.py +27 -0
- opik/rest_api/types/{json_schema_element.py → annotation_queue_item_ids.py} +5 -7
- opik/rest_api/types/annotation_queue_page_public.py +28 -0
- opik/rest_api/types/annotation_queue_public.py +38 -0
- opik/rest_api/types/annotation_queue_public_scope.py +5 -0
- opik/rest_api/types/{workspace_metadata.py → annotation_queue_reviewer.py} +6 -7
- opik/rest_api/types/annotation_queue_reviewer_public.py +20 -0
- opik/rest_api/types/annotation_queue_scope.py +5 -0
- opik/rest_api/types/annotation_queue_write.py +31 -0
- opik/rest_api/types/annotation_queue_write_scope.py +5 -0
- opik/rest_api/types/assistant_message.py +7 -8
- opik/rest_api/types/assistant_message_role.py +1 -3
- opik/rest_api/types/attachment.py +22 -0
- opik/rest_api/types/attachment_page.py +28 -0
- opik/rest_api/types/audio_url.py +19 -0
- opik/rest_api/types/audio_url_public.py +19 -0
- opik/rest_api/types/audio_url_write.py +19 -0
- opik/rest_api/types/automation_rule_evaluator.py +160 -0
- opik/rest_api/types/automation_rule_evaluator_llm_as_judge.py +6 -6
- opik/rest_api/types/automation_rule_evaluator_llm_as_judge_public.py +6 -6
- opik/rest_api/types/automation_rule_evaluator_llm_as_judge_write.py +6 -6
- opik/rest_api/types/automation_rule_evaluator_object_object_public.py +155 -0
- opik/rest_api/types/automation_rule_evaluator_page_public.py +6 -6
- opik/rest_api/types/automation_rule_evaluator_public.py +155 -0
- 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_span_user_defined_metric_python.py +22 -0
- opik/rest_api/types/automation_rule_evaluator_span_user_defined_metric_python_public.py +22 -0
- opik/rest_api/types/automation_rule_evaluator_span_user_defined_metric_python_write.py +22 -0
- opik/rest_api/types/automation_rule_evaluator_trace_thread_llm_as_judge.py +22 -0
- opik/rest_api/types/automation_rule_evaluator_trace_thread_llm_as_judge_public.py +22 -0
- opik/rest_api/types/automation_rule_evaluator_trace_thread_llm_as_judge_write.py +22 -0
- opik/rest_api/types/automation_rule_evaluator_trace_thread_user_defined_metric_python.py +22 -0
- opik/rest_api/types/automation_rule_evaluator_trace_thread_user_defined_metric_python_public.py +22 -0
- opik/rest_api/types/automation_rule_evaluator_trace_thread_user_defined_metric_python_write.py +22 -0
- opik/rest_api/types/automation_rule_evaluator_update.py +143 -0
- opik/rest_api/types/automation_rule_evaluator_update_llm_as_judge.py +6 -6
- opik/rest_api/types/automation_rule_evaluator_update_span_llm_as_judge.py +22 -0
- opik/rest_api/types/automation_rule_evaluator_update_span_user_defined_metric_python.py +22 -0
- opik/rest_api/types/automation_rule_evaluator_update_trace_thread_llm_as_judge.py +22 -0
- opik/rest_api/types/automation_rule_evaluator_update_trace_thread_user_defined_metric_python.py +22 -0
- opik/rest_api/types/automation_rule_evaluator_update_user_defined_metric_python.py +6 -6
- opik/rest_api/types/automation_rule_evaluator_user_defined_metric_python.py +6 -6
- opik/rest_api/types/automation_rule_evaluator_user_defined_metric_python_public.py +6 -6
- opik/rest_api/types/automation_rule_evaluator_user_defined_metric_python_write.py +6 -6
- opik/rest_api/types/automation_rule_evaluator_write.py +143 -0
- opik/rest_api/types/avg_value_stat_public.py +3 -5
- opik/rest_api/types/batch_delete.py +3 -5
- opik/rest_api/types/batch_delete_by_project.py +20 -0
- opik/rest_api/types/bi_information.py +3 -5
- opik/rest_api/types/bi_information_response.py +4 -6
- 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/categorical_feedback_definition.py +5 -7
- opik/rest_api/types/categorical_feedback_definition_create.py +4 -6
- opik/rest_api/types/categorical_feedback_definition_public.py +5 -7
- opik/rest_api/types/categorical_feedback_definition_update.py +4 -6
- opik/rest_api/types/categorical_feedback_detail.py +3 -5
- opik/rest_api/types/categorical_feedback_detail_create.py +3 -5
- opik/rest_api/types/categorical_feedback_detail_public.py +3 -5
- opik/rest_api/types/categorical_feedback_detail_update.py +3 -5
- opik/rest_api/types/chat_completion_choice.py +4 -6
- opik/rest_api/types/chat_completion_response.py +5 -6
- opik/rest_api/types/check.py +22 -0
- opik/rest_api/types/{json_node_compare.py → check_name.py} +1 -1
- opik/rest_api/types/check_public.py +22 -0
- opik/rest_api/types/check_public_name.py +5 -0
- opik/rest_api/types/check_public_result.py +5 -0
- opik/rest_api/types/check_result.py +5 -0
- opik/rest_api/types/chunked_output_json_node.py +4 -6
- opik/rest_api/types/chunked_output_json_node_public.py +4 -6
- opik/rest_api/types/chunked_output_json_node_public_type.py +6 -10
- opik/rest_api/types/chunked_output_json_node_type.py +6 -10
- opik/rest_api/types/column.py +8 -10
- opik/rest_api/types/column_compare.py +8 -10
- opik/rest_api/types/column_public.py +8 -10
- opik/rest_api/types/column_types_item.py +1 -3
- opik/rest_api/types/comment.py +4 -6
- opik/rest_api/types/comment_compare.py +4 -6
- opik/rest_api/types/comment_public.py +4 -6
- opik/rest_api/types/complete_multipart_upload_request.py +33 -0
- opik/rest_api/types/complete_multipart_upload_request_entity_type.py +5 -0
- opik/rest_api/types/completion_tokens_details.py +3 -5
- opik/rest_api/types/count_value_stat_public.py +3 -5
- opik/rest_api/types/dashboard_page_public.py +24 -0
- opik/rest_api/types/dashboard_public.py +30 -0
- opik/rest_api/types/data_point_double.py +21 -0
- opik/rest_api/types/data_point_number_public.py +3 -5
- opik/rest_api/types/dataset.py +14 -6
- opik/rest_api/types/dataset_expansion.py +42 -0
- opik/rest_api/types/dataset_expansion_response.py +39 -0
- opik/rest_api/types/dataset_item.py +9 -8
- opik/rest_api/types/dataset_item_batch.py +3 -5
- opik/rest_api/types/dataset_item_changes_public.py +5 -0
- opik/rest_api/types/dataset_item_compare.py +9 -8
- opik/rest_api/types/dataset_item_compare_source.py +1 -3
- opik/rest_api/types/dataset_item_filter.py +27 -0
- opik/rest_api/types/dataset_item_filter_operator.py +21 -0
- opik/rest_api/types/dataset_item_page_compare.py +10 -7
- opik/rest_api/types/dataset_item_page_public.py +10 -7
- opik/rest_api/types/dataset_item_public.py +9 -8
- opik/rest_api/types/dataset_item_public_source.py +1 -3
- opik/rest_api/types/dataset_item_source.py +1 -3
- opik/rest_api/types/dataset_item_update.py +39 -0
- opik/rest_api/types/dataset_item_write.py +5 -6
- opik/rest_api/types/dataset_item_write_source.py +1 -3
- opik/rest_api/types/dataset_page_public.py +9 -6
- opik/rest_api/types/dataset_public.py +14 -6
- opik/rest_api/types/dataset_public_status.py +5 -0
- opik/rest_api/types/dataset_public_visibility.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 +59 -0
- opik/rest_api/types/dataset_version_summary.py +46 -0
- opik/rest_api/types/dataset_version_summary_public.py +46 -0
- opik/rest_api/types/dataset_visibility.py +5 -0
- opik/rest_api/types/delete_attachments_request.py +23 -0
- opik/rest_api/types/delete_attachments_request_entity_type.py +5 -0
- opik/rest_api/types/delete_feedback_score.py +4 -5
- opik/rest_api/types/delete_ids_holder.py +19 -0
- opik/rest_api/types/delta.py +7 -9
- opik/rest_api/types/error_count_with_deviation.py +21 -0
- opik/rest_api/types/error_count_with_deviation_detailed.py +21 -0
- opik/rest_api/types/error_info.py +3 -5
- opik/rest_api/types/error_info_experiment_item_bulk_write_view.py +21 -0
- opik/rest_api/types/error_info_public.py +3 -5
- opik/rest_api/types/error_info_write.py +3 -5
- opik/rest_api/types/error_message.py +3 -5
- opik/rest_api/types/error_message_detail.py +3 -5
- opik/rest_api/types/error_message_detailed.py +3 -5
- opik/rest_api/types/error_message_public.py +3 -5
- opik/rest_api/types/experiment.py +21 -10
- opik/rest_api/types/experiment_group_aggregations_response.py +20 -0
- opik/rest_api/types/experiment_group_response.py +22 -0
- opik/rest_api/types/experiment_item.py +14 -11
- opik/rest_api/types/experiment_item_bulk_record.py +27 -0
- opik/rest_api/types/experiment_item_bulk_record_experiment_item_bulk_write_view.py +27 -0
- opik/rest_api/types/experiment_item_bulk_upload.py +27 -0
- opik/rest_api/types/experiment_item_compare.py +14 -11
- opik/rest_api/types/experiment_item_compare_trace_visibility_mode.py +5 -0
- opik/rest_api/types/experiment_item_public.py +6 -6
- opik/rest_api/types/experiment_item_public_trace_visibility_mode.py +5 -0
- opik/rest_api/types/experiment_item_trace_visibility_mode.py +5 -0
- opik/rest_api/types/experiment_page_public.py +9 -6
- opik/rest_api/types/experiment_public.py +21 -10
- opik/rest_api/types/experiment_public_status.py +5 -0
- opik/rest_api/types/experiment_public_type.py +5 -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/experiment_status.py +5 -0
- opik/rest_api/types/experiment_type.py +5 -0
- opik/rest_api/types/export_trace_service_request.py +5 -0
- opik/rest_api/types/feedback.py +40 -27
- opik/rest_api/types/feedback_create.py +27 -13
- opik/rest_api/types/feedback_definition_page_public.py +4 -6
- opik/rest_api/types/feedback_object_public.py +40 -27
- opik/rest_api/types/feedback_public.py +40 -27
- opik/rest_api/types/feedback_score.py +7 -7
- opik/rest_api/types/feedback_score_average.py +3 -5
- opik/rest_api/types/feedback_score_average_detailed.py +3 -5
- opik/rest_api/types/feedback_score_average_public.py +3 -5
- opik/rest_api/types/feedback_score_batch.py +4 -6
- opik/rest_api/types/feedback_score_batch_item.py +6 -6
- opik/rest_api/types/feedback_score_batch_item_source.py +1 -3
- opik/rest_api/types/feedback_score_batch_item_thread.py +32 -0
- opik/rest_api/types/feedback_score_batch_item_thread_source.py +5 -0
- opik/rest_api/types/feedback_score_compare.py +7 -7
- opik/rest_api/types/feedback_score_compare_source.py +1 -3
- opik/rest_api/types/feedback_score_experiment_item_bulk_write_view.py +31 -0
- opik/rest_api/types/feedback_score_experiment_item_bulk_write_view_source.py +5 -0
- opik/rest_api/types/feedback_score_names.py +4 -6
- opik/rest_api/types/feedback_score_public.py +11 -7
- opik/rest_api/types/feedback_score_public_source.py +1 -3
- opik/rest_api/types/feedback_score_source.py +1 -3
- opik/rest_api/types/feedback_update.py +27 -13
- opik/rest_api/types/function.py +4 -7
- opik/rest_api/types/function_call.py +3 -5
- opik/rest_api/types/group_content.py +19 -0
- opik/rest_api/types/group_content_with_aggregations.py +21 -0
- opik/rest_api/types/group_detail.py +19 -0
- opik/rest_api/types/group_details.py +20 -0
- opik/rest_api/types/guardrail.py +34 -0
- opik/rest_api/types/guardrail_batch.py +20 -0
- opik/rest_api/types/guardrail_name.py +5 -0
- opik/rest_api/types/guardrail_result.py +5 -0
- opik/rest_api/types/guardrail_write.py +33 -0
- opik/rest_api/types/guardrail_write_name.py +5 -0
- opik/rest_api/types/guardrail_write_result.py +5 -0
- opik/rest_api/types/guardrails_validation.py +21 -0
- opik/rest_api/types/guardrails_validation_public.py +21 -0
- opik/rest_api/types/ids_holder.py +19 -0
- 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/json_list_string.py +7 -0
- opik/rest_api/types/json_list_string_compare.py +7 -0
- opik/rest_api/types/json_list_string_experiment_item_bulk_write_view.py +7 -0
- opik/rest_api/types/json_list_string_public.py +7 -0
- opik/rest_api/types/json_list_string_write.py +7 -0
- opik/rest_api/types/json_schema.py +5 -8
- opik/rest_api/types/llm_as_judge_code.py +8 -12
- opik/rest_api/types/llm_as_judge_code_public.py +8 -12
- opik/rest_api/types/llm_as_judge_code_write.py +8 -12
- opik/rest_api/types/llm_as_judge_message.py +9 -7
- opik/rest_api/types/llm_as_judge_message_content.py +26 -0
- opik/rest_api/types/llm_as_judge_message_content_public.py +26 -0
- opik/rest_api/types/llm_as_judge_message_content_write.py +26 -0
- opik/rest_api/types/llm_as_judge_message_public.py +9 -7
- opik/rest_api/types/llm_as_judge_message_public_role.py +1 -1
- opik/rest_api/types/llm_as_judge_message_role.py +1 -1
- opik/rest_api/types/llm_as_judge_message_write.py +9 -7
- opik/rest_api/types/llm_as_judge_message_write_role.py +1 -1
- opik/rest_api/types/llm_as_judge_model_parameters.py +6 -5
- opik/rest_api/types/llm_as_judge_model_parameters_public.py +6 -5
- opik/rest_api/types/llm_as_judge_model_parameters_write.py +6 -5
- opik/rest_api/types/llm_as_judge_output_schema.py +4 -6
- opik/rest_api/types/llm_as_judge_output_schema_public.py +4 -6
- opik/rest_api/types/llm_as_judge_output_schema_public_type.py +1 -3
- opik/rest_api/types/llm_as_judge_output_schema_type.py +1 -3
- opik/rest_api/types/llm_as_judge_output_schema_write.py +4 -6
- opik/rest_api/types/llm_as_judge_output_schema_write_type.py +1 -3
- opik/rest_api/types/log_item.py +5 -7
- opik/rest_api/types/log_item_level.py +1 -3
- opik/rest_api/types/log_page.py +4 -6
- opik/rest_api/types/manual_evaluation_request.py +38 -0
- opik/rest_api/types/manual_evaluation_request_entity_type.py +5 -0
- opik/rest_api/types/manual_evaluation_response.py +27 -0
- opik/rest_api/types/multipart_upload_part.py +20 -0
- opik/rest_api/types/numerical_feedback_definition.py +5 -7
- opik/rest_api/types/numerical_feedback_definition_create.py +4 -6
- opik/rest_api/types/numerical_feedback_definition_public.py +5 -7
- opik/rest_api/types/numerical_feedback_definition_update.py +4 -6
- opik/rest_api/types/numerical_feedback_detail.py +3 -5
- opik/rest_api/types/numerical_feedback_detail_create.py +3 -5
- opik/rest_api/types/numerical_feedback_detail_public.py +3 -5
- opik/rest_api/types/numerical_feedback_detail_update.py +3 -5
- opik/rest_api/types/optimization.py +37 -0
- opik/rest_api/types/optimization_page_public.py +28 -0
- opik/rest_api/types/optimization_public.py +37 -0
- opik/rest_api/types/optimization_public_status.py +7 -0
- opik/rest_api/types/optimization_status.py +7 -0
- 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 +30 -0
- opik/rest_api/types/optimization_write_status.py +7 -0
- opik/rest_api/types/page_columns.py +4 -6
- opik/rest_api/types/percentage_value_stat_public.py +4 -6
- opik/rest_api/types/percentage_values.py +8 -16
- opik/rest_api/types/percentage_values_detailed.py +8 -16
- opik/rest_api/types/percentage_values_public.py +8 -16
- opik/rest_api/types/project.py +12 -7
- opik/rest_api/types/project_detailed.py +12 -7
- opik/rest_api/types/project_detailed_visibility.py +5 -0
- opik/rest_api/types/project_metric_response_public.py +5 -9
- opik/rest_api/types/project_metric_response_public_interval.py +1 -3
- opik/rest_api/types/project_metric_response_public_metric_type.py +11 -1
- opik/rest_api/types/project_page_public.py +8 -10
- opik/rest_api/types/project_public.py +6 -6
- opik/rest_api/types/project_public_visibility.py +5 -0
- opik/rest_api/types/project_reference.py +31 -0
- opik/rest_api/types/project_reference_public.py +31 -0
- opik/rest_api/types/project_stat_item_object_public.py +8 -17
- opik/rest_api/types/project_stats_public.py +4 -6
- opik/rest_api/types/project_stats_summary.py +4 -6
- opik/rest_api/types/project_stats_summary_item.py +9 -6
- opik/rest_api/types/project_visibility.py +5 -0
- opik/rest_api/types/prompt.py +12 -7
- opik/rest_api/types/prompt_detail.py +12 -7
- opik/rest_api/types/prompt_detail_template_structure.py +5 -0
- opik/rest_api/types/prompt_page_public.py +9 -6
- opik/rest_api/types/prompt_public.py +11 -6
- 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_tokens_details.py +19 -0
- opik/rest_api/types/prompt_version.py +7 -6
- opik/rest_api/types/prompt_version_detail.py +7 -6
- opik/rest_api/types/prompt_version_detail_template_structure.py +5 -0
- opik/rest_api/types/prompt_version_link.py +4 -5
- opik/rest_api/types/prompt_version_link_public.py +4 -5
- opik/rest_api/types/prompt_version_link_write.py +3 -5
- opik/rest_api/types/prompt_version_page_public.py +9 -6
- opik/rest_api/types/prompt_version_public.py +7 -6
- 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/prompt_version_update.py +33 -0
- opik/rest_api/types/provider_api_key.py +18 -8
- opik/rest_api/types/provider_api_key_page_public.py +27 -0
- opik/rest_api/types/provider_api_key_provider.py +1 -1
- opik/rest_api/types/provider_api_key_public.py +18 -8
- opik/rest_api/types/provider_api_key_public_provider.py +1 -1
- opik/rest_api/types/response_format.py +5 -7
- opik/rest_api/types/response_format_type.py +1 -3
- opik/rest_api/types/result.py +21 -0
- opik/rest_api/types/results_number_public.py +4 -6
- opik/rest_api/types/score_name.py +4 -5
- opik/rest_api/types/service_toggles_config.py +44 -0
- opik/rest_api/types/span.py +13 -15
- opik/rest_api/types/span_batch.py +4 -6
- opik/rest_api/types/span_enrichment_options.py +31 -0
- opik/rest_api/types/span_experiment_item_bulk_write_view.py +39 -0
- opik/rest_api/types/span_experiment_item_bulk_write_view_type.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_public.py +4 -6
- opik/rest_api/types/span_filter_public_operator.py +2 -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_page_public.py +9 -6
- opik/rest_api/types/span_public.py +19 -16
- opik/rest_api/types/span_public_type.py +1 -1
- opik/rest_api/types/span_type.py +1 -1
- opik/rest_api/types/span_update.py +46 -0
- opik/rest_api/types/span_update_type.py +5 -0
- opik/rest_api/types/span_user_defined_metric_python_code.py +20 -0
- opik/rest_api/types/span_user_defined_metric_python_code_public.py +20 -0
- opik/rest_api/types/span_user_defined_metric_python_code_write.py +20 -0
- opik/rest_api/types/span_write.py +13 -14
- opik/rest_api/types/span_write_type.py +1 -1
- opik/rest_api/types/spans_count_response.py +20 -0
- opik/rest_api/types/start_multipart_upload_response.py +20 -0
- opik/rest_api/types/stream_options.py +3 -5
- 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/tool.py +4 -6
- opik/rest_api/types/tool_call.py +4 -6
- opik/rest_api/types/trace.py +26 -12
- opik/rest_api/types/trace_batch.py +4 -6
- opik/rest_api/types/trace_count_response.py +4 -6
- opik/rest_api/types/trace_enrichment_options.py +32 -0
- opik/rest_api/types/trace_experiment_item_bulk_write_view.py +41 -0
- opik/rest_api/types/trace_filter.py +23 -0
- opik/rest_api/types/trace_filter_operator.py +21 -0
- opik/rest_api/types/trace_filter_public.py +23 -0
- opik/rest_api/types/trace_filter_public_operator.py +21 -0
- opik/rest_api/types/trace_filter_write.py +23 -0
- opik/rest_api/types/trace_filter_write_operator.py +21 -0
- opik/rest_api/types/trace_page_public.py +8 -10
- opik/rest_api/types/trace_public.py +27 -13
- opik/rest_api/types/trace_public_visibility_mode.py +5 -0
- opik/rest_api/types/trace_thread.py +18 -9
- opik/rest_api/types/trace_thread_filter.py +23 -0
- opik/rest_api/types/trace_thread_filter_operator.py +21 -0
- opik/rest_api/types/trace_thread_filter_public.py +23 -0
- opik/rest_api/types/trace_thread_filter_public_operator.py +21 -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_identifier.py +22 -0
- opik/rest_api/types/trace_thread_llm_as_judge_code.py +26 -0
- opik/rest_api/types/trace_thread_llm_as_judge_code_public.py +26 -0
- opik/rest_api/types/trace_thread_llm_as_judge_code_write.py +26 -0
- opik/rest_api/types/trace_thread_page.py +9 -6
- opik/rest_api/types/trace_thread_status.py +5 -0
- opik/rest_api/types/trace_thread_update.py +19 -0
- opik/rest_api/types/trace_thread_user_defined_metric_python_code.py +19 -0
- opik/rest_api/types/trace_thread_user_defined_metric_python_code_public.py +19 -0
- opik/rest_api/types/trace_thread_user_defined_metric_python_code_write.py +19 -0
- opik/rest_api/types/trace_update.py +39 -0
- opik/rest_api/types/trace_visibility_mode.py +5 -0
- opik/rest_api/types/trace_write.py +10 -11
- opik/rest_api/types/usage.py +6 -6
- opik/rest_api/types/user_defined_metric_python_code.py +3 -5
- opik/rest_api/types/user_defined_metric_python_code_public.py +3 -5
- opik/rest_api/types/user_defined_metric_python_code_write.py +3 -5
- opik/rest_api/types/value_entry.py +27 -0
- opik/rest_api/types/value_entry_compare.py +27 -0
- opik/rest_api/types/value_entry_compare_source.py +5 -0
- opik/rest_api/types/value_entry_experiment_item_bulk_write_view.py +27 -0
- opik/rest_api/types/value_entry_experiment_item_bulk_write_view_source.py +5 -0
- opik/rest_api/types/value_entry_public.py +27 -0
- opik/rest_api/types/value_entry_public_source.py +5 -0
- opik/rest_api/types/value_entry_source.py +5 -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/rest_api/types/webhook.py +28 -0
- opik/rest_api/types/webhook_examples.py +19 -0
- opik/rest_api/types/webhook_public.py +28 -0
- opik/rest_api/types/webhook_test_result.py +23 -0
- opik/rest_api/types/webhook_test_result_status.py +5 -0
- opik/rest_api/types/webhook_write.py +23 -0
- opik/rest_api/types/welcome_wizard_tracking.py +22 -0
- opik/rest_api/types/workspace_configuration.py +27 -0
- opik/rest_api/types/workspace_metric_request.py +24 -0
- opik/rest_api/types/workspace_metric_response.py +20 -0
- opik/rest_api/types/workspace_metrics_summary_request.py +23 -0
- opik/rest_api/types/workspace_metrics_summary_response.py +20 -0
- opik/rest_api/types/workspace_name_holder.py +19 -0
- opik/rest_api/types/workspace_spans_count.py +20 -0
- opik/rest_api/types/workspace_trace_count.py +3 -5
- opik/rest_api/welcome_wizard/__init__.py +4 -0
- opik/rest_api/welcome_wizard/client.py +195 -0
- opik/rest_api/welcome_wizard/raw_client.py +208 -0
- opik/rest_api/workspaces/__init__.py +2 -0
- opik/rest_api/workspaces/client.py +550 -77
- opik/rest_api/workspaces/raw_client.py +923 -0
- opik/rest_client_configurator/api.py +1 -0
- opik/rest_client_configurator/retry_decorator.py +1 -0
- opik/s3_httpx_client.py +67 -0
- opik/simulation/__init__.py +6 -0
- opik/simulation/simulated_user.py +99 -0
- opik/simulation/simulator.py +108 -0
- opik/synchronization.py +11 -24
- opik/tracing_runtime_config.py +48 -0
- opik/types.py +48 -2
- opik/url_helpers.py +13 -3
- opik/validation/chat_prompt_messages.py +241 -0
- opik/validation/feedback_score.py +4 -5
- opik/validation/parameter.py +122 -0
- opik/validation/parameters_validator.py +175 -0
- opik/validation/validator.py +30 -2
- opik/validation/validator_helpers.py +147 -0
- opik-1.9.71.dist-info/METADATA +370 -0
- opik-1.9.71.dist-info/RECORD +1110 -0
- {opik-1.6.4.dist-info → opik-1.9.71.dist-info}/WHEEL +1 -1
- opik-1.9.71.dist-info/licenses/LICENSE +203 -0
- opik/api_objects/prompt/prompt.py +0 -107
- opik/api_objects/prompt/prompt_template.py +0 -35
- opik/cli.py +0 -193
- opik/evaluation/metrics/models.py +0 -8
- opik/hooks.py +0 -13
- opik/integrations/bedrock/chunks_aggregator.py +0 -55
- opik/integrations/bedrock/helpers.py +0 -8
- opik/integrations/langchain/google_run_helpers.py +0 -75
- opik/integrations/langchain/openai_run_helpers.py +0 -122
- opik/message_processing/message_processors.py +0 -203
- opik/rest_api/types/delta_role.py +0 -7
- opik/rest_api/types/json_object_schema.py +0 -34
- opik-1.6.4.dist-info/METADATA +0 -270
- opik-1.6.4.dist-info/RECORD +0 -507
- /opik/integrations/bedrock/{stream_wrappers.py → converse/stream_wrappers.py} +0 -0
- {opik-1.6.4.dist-info → opik-1.9.71.dist-info}/entry_points.txt +0 -0
- {opik-1.6.4.dist-info → opik-1.9.71.dist-info}/top_level.txt +0 -0
opik/rest_api/spans/client.py
CHANGED
|
@@ -1,39 +1,31 @@
|
|
|
1
1
|
# This file was auto-generated by Fern from our API Definition.
|
|
2
2
|
|
|
3
|
-
import typing
|
|
4
|
-
from ..core.client_wrapper import SyncClientWrapper
|
|
5
3
|
import datetime as dt
|
|
4
|
+
import typing
|
|
5
|
+
|
|
6
|
+
from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
|
|
6
7
|
from ..core.request_options import RequestOptions
|
|
7
|
-
from ..
|
|
8
|
-
from
|
|
9
|
-
from ..
|
|
8
|
+
from ..types.comment import Comment
|
|
9
|
+
from ..types.error_info import ErrorInfo
|
|
10
|
+
from ..types.error_info_write import ErrorInfoWrite
|
|
11
|
+
from ..types.feedback_score_batch_item import FeedbackScoreBatchItem
|
|
10
12
|
from ..types.feedback_score_source import FeedbackScoreSource
|
|
11
|
-
from
|
|
13
|
+
from ..types.json_list_string import JsonListString
|
|
14
|
+
from ..types.json_list_string_write import JsonListStringWrite
|
|
15
|
+
from ..types.project_stats_public import ProjectStatsPublic
|
|
16
|
+
from ..types.span_filter_public import SpanFilterPublic
|
|
12
17
|
from ..types.span_page_public import SpanPagePublic
|
|
13
|
-
from ..core.pydantic_utilities import parse_obj_as
|
|
14
|
-
from ..types.span_write_type import SpanWriteType
|
|
15
|
-
from ..types.json_node_write import JsonNodeWrite
|
|
16
|
-
from ..types.error_info_write import ErrorInfoWrite
|
|
17
|
-
from ..core.serialization import convert_and_respect_annotation_metadata
|
|
18
|
-
from ..types.span_write import SpanWrite
|
|
19
18
|
from ..types.span_public import SpanPublic
|
|
20
|
-
from ..
|
|
21
|
-
from ..
|
|
22
|
-
from ..types.
|
|
23
|
-
from ..types.
|
|
24
|
-
from
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
from ..types.comment import Comment
|
|
19
|
+
from ..types.span_update import SpanUpdate
|
|
20
|
+
from ..types.span_update_type import SpanUpdateType
|
|
21
|
+
from ..types.span_write import SpanWrite
|
|
22
|
+
from ..types.span_write_type import SpanWriteType
|
|
23
|
+
from ..types.value_entry import ValueEntry
|
|
24
|
+
from .raw_client import AsyncRawSpansClient, RawSpansClient
|
|
25
|
+
from .types.find_feedback_score_names_1_request_type import FindFeedbackScoreNames1RequestType
|
|
28
26
|
from .types.get_span_stats_request_type import GetSpanStatsRequestType
|
|
29
|
-
from
|
|
30
|
-
from
|
|
31
|
-
from .types.span_search_stream_request_public_type import (
|
|
32
|
-
SpanSearchStreamRequestPublicType,
|
|
33
|
-
)
|
|
34
|
-
from ..types.span_filter_public import SpanFilterPublic
|
|
35
|
-
from ..errors.bad_request_error import BadRequestError
|
|
36
|
-
from ..core.client_wrapper import AsyncClientWrapper
|
|
27
|
+
from .types.get_spans_by_project_request_type import GetSpansByProjectRequestType
|
|
28
|
+
from .types.span_search_stream_request_public_type import SpanSearchStreamRequestPublicType
|
|
37
29
|
|
|
38
30
|
# this is used as the default value for optional parameters
|
|
39
31
|
OMIT = typing.cast(typing.Any, ...)
|
|
@@ -41,7 +33,18 @@ OMIT = typing.cast(typing.Any, ...)
|
|
|
41
33
|
|
|
42
34
|
class SpansClient:
|
|
43
35
|
def __init__(self, *, client_wrapper: SyncClientWrapper):
|
|
44
|
-
self.
|
|
36
|
+
self._raw_client = RawSpansClient(client_wrapper=client_wrapper)
|
|
37
|
+
|
|
38
|
+
@property
|
|
39
|
+
def with_raw_response(self) -> RawSpansClient:
|
|
40
|
+
"""
|
|
41
|
+
Retrieves a raw implementation of this client that returns raw responses.
|
|
42
|
+
|
|
43
|
+
Returns
|
|
44
|
+
-------
|
|
45
|
+
RawSpansClient
|
|
46
|
+
"""
|
|
47
|
+
return self._raw_client
|
|
45
48
|
|
|
46
49
|
def add_span_comment(
|
|
47
50
|
self,
|
|
@@ -84,37 +87,20 @@ class SpansClient:
|
|
|
84
87
|
Examples
|
|
85
88
|
--------
|
|
86
89
|
from Opik import OpikApi
|
|
87
|
-
|
|
88
|
-
client =
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
f"v1/private/spans/{jsonable_encoder(id_)}/comments",
|
|
99
|
-
method="POST",
|
|
100
|
-
json={
|
|
101
|
-
"id": id,
|
|
102
|
-
"text": text,
|
|
103
|
-
"created_at": created_at,
|
|
104
|
-
"last_updated_at": last_updated_at,
|
|
105
|
-
"created_by": created_by,
|
|
106
|
-
"last_updated_by": last_updated_by,
|
|
107
|
-
},
|
|
90
|
+
client = OpikApi(api_key="YOUR_API_KEY", workspace_name="YOUR_WORKSPACE_NAME", )
|
|
91
|
+
client.spans.add_span_comment(id_='id', text='text', )
|
|
92
|
+
"""
|
|
93
|
+
_response = self._raw_client.add_span_comment(
|
|
94
|
+
id_,
|
|
95
|
+
text=text,
|
|
96
|
+
id=id,
|
|
97
|
+
created_at=created_at,
|
|
98
|
+
last_updated_at=last_updated_at,
|
|
99
|
+
created_by=created_by,
|
|
100
|
+
last_updated_by=last_updated_by,
|
|
108
101
|
request_options=request_options,
|
|
109
|
-
omit=OMIT,
|
|
110
102
|
)
|
|
111
|
-
|
|
112
|
-
if 200 <= _response.status_code < 300:
|
|
113
|
-
return
|
|
114
|
-
_response_json = _response.json()
|
|
115
|
-
except JSONDecodeError:
|
|
116
|
-
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
117
|
-
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
103
|
+
return _response.data
|
|
118
104
|
|
|
119
105
|
def add_span_feedback_score(
|
|
120
106
|
self,
|
|
@@ -129,6 +115,7 @@ class SpansClient:
|
|
|
129
115
|
last_updated_at: typing.Optional[dt.datetime] = OMIT,
|
|
130
116
|
created_by: typing.Optional[str] = OMIT,
|
|
131
117
|
last_updated_by: typing.Optional[str] = OMIT,
|
|
118
|
+
value_by_author: typing.Optional[typing.Dict[str, ValueEntry]] = OMIT,
|
|
132
119
|
request_options: typing.Optional[RequestOptions] = None,
|
|
133
120
|
) -> None:
|
|
134
121
|
"""
|
|
@@ -156,6 +143,8 @@ class SpansClient:
|
|
|
156
143
|
|
|
157
144
|
last_updated_by : typing.Optional[str]
|
|
158
145
|
|
|
146
|
+
value_by_author : typing.Optional[typing.Dict[str, ValueEntry]]
|
|
147
|
+
|
|
159
148
|
request_options : typing.Optional[RequestOptions]
|
|
160
149
|
Request-specific configuration.
|
|
161
150
|
|
|
@@ -166,42 +155,92 @@ class SpansClient:
|
|
|
166
155
|
Examples
|
|
167
156
|
--------
|
|
168
157
|
from Opik import OpikApi
|
|
169
|
-
|
|
170
|
-
client =
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
158
|
+
client = OpikApi(api_key="YOUR_API_KEY", workspace_name="YOUR_WORKSPACE_NAME", )
|
|
159
|
+
client.spans.add_span_feedback_score(id='id', name='name', value=1.1, source="ui", )
|
|
160
|
+
"""
|
|
161
|
+
_response = self._raw_client.add_span_feedback_score(
|
|
162
|
+
id,
|
|
163
|
+
name=name,
|
|
164
|
+
value=value,
|
|
165
|
+
source=source,
|
|
166
|
+
category_name=category_name,
|
|
167
|
+
reason=reason,
|
|
168
|
+
created_at=created_at,
|
|
169
|
+
last_updated_at=last_updated_at,
|
|
170
|
+
created_by=created_by,
|
|
171
|
+
last_updated_by=last_updated_by,
|
|
172
|
+
value_by_author=value_by_author,
|
|
173
|
+
request_options=request_options,
|
|
179
174
|
)
|
|
175
|
+
return _response.data
|
|
176
|
+
|
|
177
|
+
def create_spans(
|
|
178
|
+
self, *, spans: typing.Sequence[SpanWrite], request_options: typing.Optional[RequestOptions] = None
|
|
179
|
+
) -> None:
|
|
180
180
|
"""
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
181
|
+
Create spans
|
|
182
|
+
|
|
183
|
+
Parameters
|
|
184
|
+
----------
|
|
185
|
+
spans : typing.Sequence[SpanWrite]
|
|
186
|
+
|
|
187
|
+
request_options : typing.Optional[RequestOptions]
|
|
188
|
+
Request-specific configuration.
|
|
189
|
+
|
|
190
|
+
Returns
|
|
191
|
+
-------
|
|
192
|
+
None
|
|
193
|
+
|
|
194
|
+
Examples
|
|
195
|
+
--------
|
|
196
|
+
from Opik import OpikApi
|
|
197
|
+
from Opik import SpanWrite
|
|
198
|
+
import datetime
|
|
199
|
+
client = OpikApi(api_key="YOUR_API_KEY", workspace_name="YOUR_WORKSPACE_NAME", )
|
|
200
|
+
client.spans.create_spans(spans=[SpanWrite(start_time=datetime.datetime.fromisoformat("2024-01-15 09:30:00+00:00", ), )], )
|
|
201
|
+
"""
|
|
202
|
+
_response = self._raw_client.create_spans(spans=spans, request_options=request_options)
|
|
203
|
+
return _response.data
|
|
204
|
+
|
|
205
|
+
def batch_update_spans(
|
|
206
|
+
self,
|
|
207
|
+
*,
|
|
208
|
+
ids: typing.Sequence[str],
|
|
209
|
+
update: SpanUpdate,
|
|
210
|
+
merge_tags: typing.Optional[bool] = OMIT,
|
|
211
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
212
|
+
) -> None:
|
|
213
|
+
"""
|
|
214
|
+
Update multiple spans
|
|
215
|
+
|
|
216
|
+
Parameters
|
|
217
|
+
----------
|
|
218
|
+
ids : typing.Sequence[str]
|
|
219
|
+
List of span IDs to update (max 1000)
|
|
220
|
+
|
|
221
|
+
update : SpanUpdate
|
|
222
|
+
|
|
223
|
+
merge_tags : typing.Optional[bool]
|
|
224
|
+
If true, merge tags with existing tags instead of replacing them. Default: false
|
|
225
|
+
|
|
226
|
+
request_options : typing.Optional[RequestOptions]
|
|
227
|
+
Request-specific configuration.
|
|
228
|
+
|
|
229
|
+
Returns
|
|
230
|
+
-------
|
|
231
|
+
None
|
|
232
|
+
|
|
233
|
+
Examples
|
|
234
|
+
--------
|
|
235
|
+
from Opik import OpikApi
|
|
236
|
+
from Opik import SpanUpdate
|
|
237
|
+
client = OpikApi(api_key="YOUR_API_KEY", workspace_name="YOUR_WORKSPACE_NAME", )
|
|
238
|
+
client.spans.batch_update_spans(ids=['ids'], update=SpanUpdate(trace_id='trace_id', ), )
|
|
239
|
+
"""
|
|
240
|
+
_response = self._raw_client.batch_update_spans(
|
|
241
|
+
ids=ids, update=update, merge_tags=merge_tags, request_options=request_options
|
|
197
242
|
)
|
|
198
|
-
|
|
199
|
-
if 200 <= _response.status_code < 300:
|
|
200
|
-
return
|
|
201
|
-
_response_json = _response.json()
|
|
202
|
-
except JSONDecodeError:
|
|
203
|
-
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
204
|
-
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
243
|
+
return _response.data
|
|
205
244
|
|
|
206
245
|
def get_spans_by_project(
|
|
207
246
|
self,
|
|
@@ -214,6 +253,11 @@ class SpansClient:
|
|
|
214
253
|
type: typing.Optional[GetSpansByProjectRequestType] = None,
|
|
215
254
|
filters: typing.Optional[str] = None,
|
|
216
255
|
truncate: typing.Optional[bool] = None,
|
|
256
|
+
strip_attachments: typing.Optional[bool] = None,
|
|
257
|
+
sorting: typing.Optional[str] = None,
|
|
258
|
+
exclude: typing.Optional[str] = None,
|
|
259
|
+
from_time: typing.Optional[dt.datetime] = None,
|
|
260
|
+
to_time: typing.Optional[dt.datetime] = None,
|
|
217
261
|
request_options: typing.Optional[RequestOptions] = None,
|
|
218
262
|
) -> SpanPagePublic:
|
|
219
263
|
"""
|
|
@@ -237,6 +281,16 @@ class SpansClient:
|
|
|
237
281
|
|
|
238
282
|
truncate : typing.Optional[bool]
|
|
239
283
|
|
|
284
|
+
strip_attachments : typing.Optional[bool]
|
|
285
|
+
|
|
286
|
+
sorting : typing.Optional[str]
|
|
287
|
+
|
|
288
|
+
exclude : typing.Optional[str]
|
|
289
|
+
|
|
290
|
+
from_time : typing.Optional[dt.datetime]
|
|
291
|
+
|
|
292
|
+
to_time : typing.Optional[dt.datetime]
|
|
293
|
+
|
|
240
294
|
request_options : typing.Optional[RequestOptions]
|
|
241
295
|
Request-specific configuration.
|
|
242
296
|
|
|
@@ -248,61 +302,47 @@ class SpansClient:
|
|
|
248
302
|
Examples
|
|
249
303
|
--------
|
|
250
304
|
from Opik import OpikApi
|
|
251
|
-
|
|
252
|
-
client = OpikApi(
|
|
253
|
-
api_key="YOUR_API_KEY",
|
|
254
|
-
workspace_name="YOUR_WORKSPACE_NAME",
|
|
255
|
-
)
|
|
305
|
+
client = OpikApi(api_key="YOUR_API_KEY", workspace_name="YOUR_WORKSPACE_NAME", )
|
|
256
306
|
client.spans.get_spans_by_project()
|
|
257
307
|
"""
|
|
258
|
-
_response = self.
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
308
|
+
_response = self._raw_client.get_spans_by_project(
|
|
309
|
+
page=page,
|
|
310
|
+
size=size,
|
|
311
|
+
project_name=project_name,
|
|
312
|
+
project_id=project_id,
|
|
313
|
+
trace_id=trace_id,
|
|
314
|
+
type=type,
|
|
315
|
+
filters=filters,
|
|
316
|
+
truncate=truncate,
|
|
317
|
+
strip_attachments=strip_attachments,
|
|
318
|
+
sorting=sorting,
|
|
319
|
+
exclude=exclude,
|
|
320
|
+
from_time=from_time,
|
|
321
|
+
to_time=to_time,
|
|
271
322
|
request_options=request_options,
|
|
272
323
|
)
|
|
273
|
-
|
|
274
|
-
if 200 <= _response.status_code < 300:
|
|
275
|
-
return typing.cast(
|
|
276
|
-
SpanPagePublic,
|
|
277
|
-
parse_obj_as(
|
|
278
|
-
type_=SpanPagePublic, # type: ignore
|
|
279
|
-
object_=_response.json(),
|
|
280
|
-
),
|
|
281
|
-
)
|
|
282
|
-
_response_json = _response.json()
|
|
283
|
-
except JSONDecodeError:
|
|
284
|
-
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
285
|
-
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
324
|
+
return _response.data
|
|
286
325
|
|
|
287
326
|
def create_span(
|
|
288
327
|
self,
|
|
289
328
|
*,
|
|
290
|
-
trace_id: str,
|
|
291
|
-
name: str,
|
|
292
|
-
type: SpanWriteType,
|
|
293
329
|
start_time: dt.datetime,
|
|
294
330
|
id: typing.Optional[str] = OMIT,
|
|
295
331
|
project_name: typing.Optional[str] = OMIT,
|
|
332
|
+
trace_id: typing.Optional[str] = OMIT,
|
|
296
333
|
parent_span_id: typing.Optional[str] = OMIT,
|
|
334
|
+
name: typing.Optional[str] = OMIT,
|
|
335
|
+
type: typing.Optional[SpanWriteType] = OMIT,
|
|
297
336
|
end_time: typing.Optional[dt.datetime] = OMIT,
|
|
298
|
-
input: typing.Optional[
|
|
299
|
-
output: typing.Optional[
|
|
300
|
-
metadata: typing.Optional[
|
|
337
|
+
input: typing.Optional[JsonListStringWrite] = OMIT,
|
|
338
|
+
output: typing.Optional[JsonListStringWrite] = OMIT,
|
|
339
|
+
metadata: typing.Optional[JsonListStringWrite] = OMIT,
|
|
301
340
|
model: typing.Optional[str] = OMIT,
|
|
302
341
|
provider: typing.Optional[str] = OMIT,
|
|
303
342
|
tags: typing.Optional[typing.Sequence[str]] = OMIT,
|
|
304
343
|
usage: typing.Optional[typing.Dict[str, int]] = OMIT,
|
|
305
344
|
error_info: typing.Optional[ErrorInfoWrite] = OMIT,
|
|
345
|
+
last_updated_at: typing.Optional[dt.datetime] = OMIT,
|
|
306
346
|
total_estimated_cost: typing.Optional[float] = OMIT,
|
|
307
347
|
total_estimated_cost_version: typing.Optional[str] = OMIT,
|
|
308
348
|
request_options: typing.Optional[RequestOptions] = None,
|
|
@@ -312,12 +352,6 @@ class SpansClient:
|
|
|
312
352
|
|
|
313
353
|
Parameters
|
|
314
354
|
----------
|
|
315
|
-
trace_id : str
|
|
316
|
-
|
|
317
|
-
name : str
|
|
318
|
-
|
|
319
|
-
type : SpanWriteType
|
|
320
|
-
|
|
321
355
|
start_time : dt.datetime
|
|
322
356
|
|
|
323
357
|
id : typing.Optional[str]
|
|
@@ -325,15 +359,21 @@ class SpansClient:
|
|
|
325
359
|
project_name : typing.Optional[str]
|
|
326
360
|
If null, the default project is used
|
|
327
361
|
|
|
362
|
+
trace_id : typing.Optional[str]
|
|
363
|
+
|
|
328
364
|
parent_span_id : typing.Optional[str]
|
|
329
365
|
|
|
366
|
+
name : typing.Optional[str]
|
|
367
|
+
|
|
368
|
+
type : typing.Optional[SpanWriteType]
|
|
369
|
+
|
|
330
370
|
end_time : typing.Optional[dt.datetime]
|
|
331
371
|
|
|
332
|
-
input : typing.Optional[
|
|
372
|
+
input : typing.Optional[JsonListStringWrite]
|
|
333
373
|
|
|
334
|
-
output : typing.Optional[
|
|
374
|
+
output : typing.Optional[JsonListStringWrite]
|
|
335
375
|
|
|
336
|
-
metadata : typing.Optional[
|
|
376
|
+
metadata : typing.Optional[JsonListStringWrite]
|
|
337
377
|
|
|
338
378
|
model : typing.Optional[str]
|
|
339
379
|
|
|
@@ -345,6 +385,8 @@ class SpansClient:
|
|
|
345
385
|
|
|
346
386
|
error_info : typing.Optional[ErrorInfoWrite]
|
|
347
387
|
|
|
388
|
+
last_updated_at : typing.Optional[dt.datetime]
|
|
389
|
+
|
|
348
390
|
total_estimated_cost : typing.Optional[float]
|
|
349
391
|
|
|
350
392
|
total_estimated_cost_version : typing.Optional[str]
|
|
@@ -358,128 +400,41 @@ class SpansClient:
|
|
|
358
400
|
|
|
359
401
|
Examples
|
|
360
402
|
--------
|
|
361
|
-
import datetime
|
|
362
|
-
|
|
363
403
|
from Opik import OpikApi
|
|
364
|
-
|
|
365
|
-
client = OpikApi(
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
"start_time": start_time,
|
|
389
|
-
"end_time": end_time,
|
|
390
|
-
"input": input,
|
|
391
|
-
"output": output,
|
|
392
|
-
"metadata": metadata,
|
|
393
|
-
"model": model,
|
|
394
|
-
"provider": provider,
|
|
395
|
-
"tags": tags,
|
|
396
|
-
"usage": usage,
|
|
397
|
-
"error_info": convert_and_respect_annotation_metadata(
|
|
398
|
-
object_=error_info, annotation=ErrorInfoWrite, direction="write"
|
|
399
|
-
),
|
|
400
|
-
"total_estimated_cost": total_estimated_cost,
|
|
401
|
-
"total_estimated_cost_version": total_estimated_cost_version,
|
|
402
|
-
},
|
|
404
|
+
import datetime
|
|
405
|
+
client = OpikApi(api_key="YOUR_API_KEY", workspace_name="YOUR_WORKSPACE_NAME", )
|
|
406
|
+
client.spans.create_span(start_time=datetime.datetime.fromisoformat("2024-01-15 09:30:00+00:00", ), )
|
|
407
|
+
"""
|
|
408
|
+
_response = self._raw_client.create_span(
|
|
409
|
+
start_time=start_time,
|
|
410
|
+
id=id,
|
|
411
|
+
project_name=project_name,
|
|
412
|
+
trace_id=trace_id,
|
|
413
|
+
parent_span_id=parent_span_id,
|
|
414
|
+
name=name,
|
|
415
|
+
type=type,
|
|
416
|
+
end_time=end_time,
|
|
417
|
+
input=input,
|
|
418
|
+
output=output,
|
|
419
|
+
metadata=metadata,
|
|
420
|
+
model=model,
|
|
421
|
+
provider=provider,
|
|
422
|
+
tags=tags,
|
|
423
|
+
usage=usage,
|
|
424
|
+
error_info=error_info,
|
|
425
|
+
last_updated_at=last_updated_at,
|
|
426
|
+
total_estimated_cost=total_estimated_cost,
|
|
427
|
+
total_estimated_cost_version=total_estimated_cost_version,
|
|
403
428
|
request_options=request_options,
|
|
404
|
-
omit=OMIT,
|
|
405
429
|
)
|
|
406
|
-
|
|
407
|
-
if 200 <= _response.status_code < 300:
|
|
408
|
-
return
|
|
409
|
-
_response_json = _response.json()
|
|
410
|
-
except JSONDecodeError:
|
|
411
|
-
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
412
|
-
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
430
|
+
return _response.data
|
|
413
431
|
|
|
414
|
-
def
|
|
432
|
+
def get_span_by_id(
|
|
415
433
|
self,
|
|
434
|
+
id: str,
|
|
416
435
|
*,
|
|
417
|
-
|
|
436
|
+
strip_attachments: typing.Optional[bool] = None,
|
|
418
437
|
request_options: typing.Optional[RequestOptions] = None,
|
|
419
|
-
) -> None:
|
|
420
|
-
"""
|
|
421
|
-
Create spans
|
|
422
|
-
|
|
423
|
-
Parameters
|
|
424
|
-
----------
|
|
425
|
-
spans : typing.Sequence[SpanWrite]
|
|
426
|
-
|
|
427
|
-
request_options : typing.Optional[RequestOptions]
|
|
428
|
-
Request-specific configuration.
|
|
429
|
-
|
|
430
|
-
Returns
|
|
431
|
-
-------
|
|
432
|
-
None
|
|
433
|
-
|
|
434
|
-
Examples
|
|
435
|
-
--------
|
|
436
|
-
import datetime
|
|
437
|
-
|
|
438
|
-
from Opik import OpikApi, SpanWrite
|
|
439
|
-
|
|
440
|
-
client = OpikApi(
|
|
441
|
-
api_key="YOUR_API_KEY",
|
|
442
|
-
workspace_name="YOUR_WORKSPACE_NAME",
|
|
443
|
-
)
|
|
444
|
-
client.spans.create_spans(
|
|
445
|
-
spans=[
|
|
446
|
-
SpanWrite(
|
|
447
|
-
trace_id="trace_id",
|
|
448
|
-
name="name",
|
|
449
|
-
type="general",
|
|
450
|
-
start_time=datetime.datetime.fromisoformat(
|
|
451
|
-
"2024-01-15 09:30:00+00:00",
|
|
452
|
-
),
|
|
453
|
-
)
|
|
454
|
-
],
|
|
455
|
-
)
|
|
456
|
-
"""
|
|
457
|
-
_response = self._client_wrapper.httpx_client.request(
|
|
458
|
-
"v1/private/spans/batch",
|
|
459
|
-
method="POST",
|
|
460
|
-
json={
|
|
461
|
-
"spans": convert_and_respect_annotation_metadata(
|
|
462
|
-
object_=spans,
|
|
463
|
-
annotation=typing.Sequence[SpanWrite],
|
|
464
|
-
direction="write",
|
|
465
|
-
),
|
|
466
|
-
},
|
|
467
|
-
headers={
|
|
468
|
-
"content-type": "application/json",
|
|
469
|
-
},
|
|
470
|
-
request_options=request_options,
|
|
471
|
-
omit=OMIT,
|
|
472
|
-
)
|
|
473
|
-
try:
|
|
474
|
-
if 200 <= _response.status_code < 300:
|
|
475
|
-
return
|
|
476
|
-
_response_json = _response.json()
|
|
477
|
-
except JSONDecodeError:
|
|
478
|
-
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
479
|
-
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
480
|
-
|
|
481
|
-
def get_span_by_id(
|
|
482
|
-
self, id: str, *, request_options: typing.Optional[RequestOptions] = None
|
|
483
438
|
) -> SpanPublic:
|
|
484
439
|
"""
|
|
485
440
|
Get span by id
|
|
@@ -488,6 +443,8 @@ class SpansClient:
|
|
|
488
443
|
----------
|
|
489
444
|
id : str
|
|
490
445
|
|
|
446
|
+
strip_attachments : typing.Optional[bool]
|
|
447
|
+
|
|
491
448
|
request_options : typing.Optional[RequestOptions]
|
|
492
449
|
Request-specific configuration.
|
|
493
450
|
|
|
@@ -499,47 +456,15 @@ class SpansClient:
|
|
|
499
456
|
Examples
|
|
500
457
|
--------
|
|
501
458
|
from Opik import OpikApi
|
|
502
|
-
|
|
503
|
-
client
|
|
504
|
-
api_key="YOUR_API_KEY",
|
|
505
|
-
workspace_name="YOUR_WORKSPACE_NAME",
|
|
506
|
-
)
|
|
507
|
-
client.spans.get_span_by_id(
|
|
508
|
-
id="id",
|
|
509
|
-
)
|
|
459
|
+
client = OpikApi(api_key="YOUR_API_KEY", workspace_name="YOUR_WORKSPACE_NAME", )
|
|
460
|
+
client.spans.get_span_by_id(id='id', )
|
|
510
461
|
"""
|
|
511
|
-
_response = self.
|
|
512
|
-
|
|
513
|
-
method="GET",
|
|
514
|
-
request_options=request_options,
|
|
462
|
+
_response = self._raw_client.get_span_by_id(
|
|
463
|
+
id, strip_attachments=strip_attachments, request_options=request_options
|
|
515
464
|
)
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
SpanPublic,
|
|
520
|
-
parse_obj_as(
|
|
521
|
-
type_=SpanPublic, # type: ignore
|
|
522
|
-
object_=_response.json(),
|
|
523
|
-
),
|
|
524
|
-
)
|
|
525
|
-
if _response.status_code == 404:
|
|
526
|
-
raise NotFoundError(
|
|
527
|
-
typing.cast(
|
|
528
|
-
typing.Optional[typing.Any],
|
|
529
|
-
parse_obj_as(
|
|
530
|
-
type_=typing.Optional[typing.Any], # type: ignore
|
|
531
|
-
object_=_response.json(),
|
|
532
|
-
),
|
|
533
|
-
)
|
|
534
|
-
)
|
|
535
|
-
_response_json = _response.json()
|
|
536
|
-
except JSONDecodeError:
|
|
537
|
-
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
538
|
-
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
539
|
-
|
|
540
|
-
def delete_span_by_id(
|
|
541
|
-
self, id: str, *, request_options: typing.Optional[RequestOptions] = None
|
|
542
|
-
) -> None:
|
|
465
|
+
return _response.data
|
|
466
|
+
|
|
467
|
+
def delete_span_by_id(self, id: str, *, request_options: typing.Optional[RequestOptions] = None) -> None:
|
|
543
468
|
"""
|
|
544
469
|
Delete span by id
|
|
545
470
|
|
|
@@ -557,37 +482,11 @@ class SpansClient:
|
|
|
557
482
|
Examples
|
|
558
483
|
--------
|
|
559
484
|
from Opik import OpikApi
|
|
560
|
-
|
|
561
|
-
client
|
|
562
|
-
api_key="YOUR_API_KEY",
|
|
563
|
-
workspace_name="YOUR_WORKSPACE_NAME",
|
|
564
|
-
)
|
|
565
|
-
client.spans.delete_span_by_id(
|
|
566
|
-
id="id",
|
|
567
|
-
)
|
|
485
|
+
client = OpikApi(api_key="YOUR_API_KEY", workspace_name="YOUR_WORKSPACE_NAME", )
|
|
486
|
+
client.spans.delete_span_by_id(id='id', )
|
|
568
487
|
"""
|
|
569
|
-
_response = self.
|
|
570
|
-
|
|
571
|
-
method="DELETE",
|
|
572
|
-
request_options=request_options,
|
|
573
|
-
)
|
|
574
|
-
try:
|
|
575
|
-
if 200 <= _response.status_code < 300:
|
|
576
|
-
return
|
|
577
|
-
if _response.status_code == 501:
|
|
578
|
-
raise NotImplementedError(
|
|
579
|
-
typing.cast(
|
|
580
|
-
typing.Optional[typing.Any],
|
|
581
|
-
parse_obj_as(
|
|
582
|
-
type_=typing.Optional[typing.Any], # type: ignore
|
|
583
|
-
object_=_response.json(),
|
|
584
|
-
),
|
|
585
|
-
)
|
|
586
|
-
)
|
|
587
|
-
_response_json = _response.json()
|
|
588
|
-
except JSONDecodeError:
|
|
589
|
-
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
590
|
-
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
488
|
+
_response = self._raw_client.delete_span_by_id(id, request_options=request_options)
|
|
489
|
+
return _response.data
|
|
591
490
|
|
|
592
491
|
def update_span(
|
|
593
492
|
self,
|
|
@@ -597,10 +496,12 @@ class SpansClient:
|
|
|
597
496
|
project_name: typing.Optional[str] = OMIT,
|
|
598
497
|
project_id: typing.Optional[str] = OMIT,
|
|
599
498
|
parent_span_id: typing.Optional[str] = OMIT,
|
|
499
|
+
name: typing.Optional[str] = OMIT,
|
|
500
|
+
type: typing.Optional[SpanUpdateType] = OMIT,
|
|
600
501
|
end_time: typing.Optional[dt.datetime] = OMIT,
|
|
601
|
-
input: typing.Optional[
|
|
602
|
-
output: typing.Optional[
|
|
603
|
-
metadata: typing.Optional[
|
|
502
|
+
input: typing.Optional[JsonListString] = OMIT,
|
|
503
|
+
output: typing.Optional[JsonListString] = OMIT,
|
|
504
|
+
metadata: typing.Optional[JsonListString] = OMIT,
|
|
604
505
|
model: typing.Optional[str] = OMIT,
|
|
605
506
|
provider: typing.Optional[str] = OMIT,
|
|
606
507
|
tags: typing.Optional[typing.Sequence[str]] = OMIT,
|
|
@@ -626,13 +527,17 @@ class SpansClient:
|
|
|
626
527
|
|
|
627
528
|
parent_span_id : typing.Optional[str]
|
|
628
529
|
|
|
530
|
+
name : typing.Optional[str]
|
|
531
|
+
|
|
532
|
+
type : typing.Optional[SpanUpdateType]
|
|
533
|
+
|
|
629
534
|
end_time : typing.Optional[dt.datetime]
|
|
630
535
|
|
|
631
|
-
input : typing.Optional[
|
|
536
|
+
input : typing.Optional[JsonListString]
|
|
632
537
|
|
|
633
|
-
output : typing.Optional[
|
|
538
|
+
output : typing.Optional[JsonListString]
|
|
634
539
|
|
|
635
|
-
metadata : typing.Optional[
|
|
540
|
+
metadata : typing.Optional[JsonListString]
|
|
636
541
|
|
|
637
542
|
model : typing.Optional[str]
|
|
638
543
|
|
|
@@ -656,66 +561,33 @@ class SpansClient:
|
|
|
656
561
|
Examples
|
|
657
562
|
--------
|
|
658
563
|
from Opik import OpikApi
|
|
659
|
-
|
|
660
|
-
client =
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
"metadata": metadata,
|
|
681
|
-
"model": model,
|
|
682
|
-
"provider": provider,
|
|
683
|
-
"tags": tags,
|
|
684
|
-
"usage": usage,
|
|
685
|
-
"total_estimated_cost": total_estimated_cost,
|
|
686
|
-
"error_info": convert_and_respect_annotation_metadata(
|
|
687
|
-
object_=error_info, annotation=ErrorInfo, direction="write"
|
|
688
|
-
),
|
|
689
|
-
},
|
|
690
|
-
headers={
|
|
691
|
-
"content-type": "application/json",
|
|
692
|
-
},
|
|
564
|
+
client = OpikApi(api_key="YOUR_API_KEY", workspace_name="YOUR_WORKSPACE_NAME", )
|
|
565
|
+
client.spans.update_span(id='id', trace_id='trace_id', )
|
|
566
|
+
"""
|
|
567
|
+
_response = self._raw_client.update_span(
|
|
568
|
+
id,
|
|
569
|
+
trace_id=trace_id,
|
|
570
|
+
project_name=project_name,
|
|
571
|
+
project_id=project_id,
|
|
572
|
+
parent_span_id=parent_span_id,
|
|
573
|
+
name=name,
|
|
574
|
+
type=type,
|
|
575
|
+
end_time=end_time,
|
|
576
|
+
input=input,
|
|
577
|
+
output=output,
|
|
578
|
+
metadata=metadata,
|
|
579
|
+
model=model,
|
|
580
|
+
provider=provider,
|
|
581
|
+
tags=tags,
|
|
582
|
+
usage=usage,
|
|
583
|
+
total_estimated_cost=total_estimated_cost,
|
|
584
|
+
error_info=error_info,
|
|
693
585
|
request_options=request_options,
|
|
694
|
-
omit=OMIT,
|
|
695
586
|
)
|
|
696
|
-
|
|
697
|
-
if 200 <= _response.status_code < 300:
|
|
698
|
-
return
|
|
699
|
-
if _response.status_code == 404:
|
|
700
|
-
raise NotFoundError(
|
|
701
|
-
typing.cast(
|
|
702
|
-
typing.Optional[typing.Any],
|
|
703
|
-
parse_obj_as(
|
|
704
|
-
type_=typing.Optional[typing.Any], # type: ignore
|
|
705
|
-
object_=_response.json(),
|
|
706
|
-
),
|
|
707
|
-
)
|
|
708
|
-
)
|
|
709
|
-
_response_json = _response.json()
|
|
710
|
-
except JSONDecodeError:
|
|
711
|
-
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
712
|
-
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
587
|
+
return _response.data
|
|
713
588
|
|
|
714
589
|
def delete_span_comments(
|
|
715
|
-
self,
|
|
716
|
-
*,
|
|
717
|
-
ids: typing.Sequence[str],
|
|
718
|
-
request_options: typing.Optional[RequestOptions] = None,
|
|
590
|
+
self, *, ids: typing.Sequence[str], request_options: typing.Optional[RequestOptions] = None
|
|
719
591
|
) -> None:
|
|
720
592
|
"""
|
|
721
593
|
Delete span comments
|
|
@@ -734,37 +606,18 @@ class SpansClient:
|
|
|
734
606
|
Examples
|
|
735
607
|
--------
|
|
736
608
|
from Opik import OpikApi
|
|
737
|
-
|
|
738
|
-
client
|
|
739
|
-
api_key="YOUR_API_KEY",
|
|
740
|
-
workspace_name="YOUR_WORKSPACE_NAME",
|
|
741
|
-
)
|
|
742
|
-
client.spans.delete_span_comments(
|
|
743
|
-
ids=["ids"],
|
|
744
|
-
)
|
|
609
|
+
client = OpikApi(api_key="YOUR_API_KEY", workspace_name="YOUR_WORKSPACE_NAME", )
|
|
610
|
+
client.spans.delete_span_comments(ids=['ids'], )
|
|
745
611
|
"""
|
|
746
|
-
_response = self.
|
|
747
|
-
|
|
748
|
-
method="POST",
|
|
749
|
-
json={
|
|
750
|
-
"ids": ids,
|
|
751
|
-
},
|
|
752
|
-
request_options=request_options,
|
|
753
|
-
omit=OMIT,
|
|
754
|
-
)
|
|
755
|
-
try:
|
|
756
|
-
if 200 <= _response.status_code < 300:
|
|
757
|
-
return
|
|
758
|
-
_response_json = _response.json()
|
|
759
|
-
except JSONDecodeError:
|
|
760
|
-
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
761
|
-
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
612
|
+
_response = self._raw_client.delete_span_comments(ids=ids, request_options=request_options)
|
|
613
|
+
return _response.data
|
|
762
614
|
|
|
763
615
|
def delete_span_feedback_score(
|
|
764
616
|
self,
|
|
765
617
|
id: str,
|
|
766
618
|
*,
|
|
767
619
|
name: str,
|
|
620
|
+
author: typing.Optional[str] = OMIT,
|
|
768
621
|
request_options: typing.Optional[RequestOptions] = None,
|
|
769
622
|
) -> None:
|
|
770
623
|
"""
|
|
@@ -776,6 +629,8 @@ class SpansClient:
|
|
|
776
629
|
|
|
777
630
|
name : str
|
|
778
631
|
|
|
632
|
+
author : typing.Optional[str]
|
|
633
|
+
|
|
779
634
|
request_options : typing.Optional[RequestOptions]
|
|
780
635
|
Request-specific configuration.
|
|
781
636
|
|
|
@@ -786,32 +641,13 @@ class SpansClient:
|
|
|
786
641
|
Examples
|
|
787
642
|
--------
|
|
788
643
|
from Opik import OpikApi
|
|
789
|
-
|
|
790
|
-
client =
|
|
791
|
-
api_key="YOUR_API_KEY",
|
|
792
|
-
workspace_name="YOUR_WORKSPACE_NAME",
|
|
793
|
-
)
|
|
794
|
-
client.spans.delete_span_feedback_score(
|
|
795
|
-
id="id",
|
|
796
|
-
name="name",
|
|
797
|
-
)
|
|
644
|
+
client = OpikApi(api_key="YOUR_API_KEY", workspace_name="YOUR_WORKSPACE_NAME", )
|
|
645
|
+
client.spans.delete_span_feedback_score(id='id', name='name', )
|
|
798
646
|
"""
|
|
799
|
-
_response = self.
|
|
800
|
-
|
|
801
|
-
method="POST",
|
|
802
|
-
json={
|
|
803
|
-
"name": name,
|
|
804
|
-
},
|
|
805
|
-
request_options=request_options,
|
|
806
|
-
omit=OMIT,
|
|
647
|
+
_response = self._raw_client.delete_span_feedback_score(
|
|
648
|
+
id, name=name, author=author, request_options=request_options
|
|
807
649
|
)
|
|
808
|
-
|
|
809
|
-
if 200 <= _response.status_code < 300:
|
|
810
|
-
return
|
|
811
|
-
_response_json = _response.json()
|
|
812
|
-
except JSONDecodeError:
|
|
813
|
-
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
814
|
-
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
650
|
+
return _response.data
|
|
815
651
|
|
|
816
652
|
def find_feedback_score_names_1(
|
|
817
653
|
self,
|
|
@@ -840,42 +676,16 @@ class SpansClient:
|
|
|
840
676
|
Examples
|
|
841
677
|
--------
|
|
842
678
|
from Opik import OpikApi
|
|
843
|
-
|
|
844
|
-
client = OpikApi(
|
|
845
|
-
api_key="YOUR_API_KEY",
|
|
846
|
-
workspace_name="YOUR_WORKSPACE_NAME",
|
|
847
|
-
)
|
|
679
|
+
client = OpikApi(api_key="YOUR_API_KEY", workspace_name="YOUR_WORKSPACE_NAME", )
|
|
848
680
|
client.spans.find_feedback_score_names_1()
|
|
849
681
|
"""
|
|
850
|
-
_response = self.
|
|
851
|
-
|
|
852
|
-
method="GET",
|
|
853
|
-
params={
|
|
854
|
-
"project_id": project_id,
|
|
855
|
-
"type": type,
|
|
856
|
-
},
|
|
857
|
-
request_options=request_options,
|
|
682
|
+
_response = self._raw_client.find_feedback_score_names_1(
|
|
683
|
+
project_id=project_id, type=type, request_options=request_options
|
|
858
684
|
)
|
|
859
|
-
|
|
860
|
-
if 200 <= _response.status_code < 300:
|
|
861
|
-
return typing.cast(
|
|
862
|
-
typing.List[str],
|
|
863
|
-
parse_obj_as(
|
|
864
|
-
type_=typing.List[str], # type: ignore
|
|
865
|
-
object_=_response.json(),
|
|
866
|
-
),
|
|
867
|
-
)
|
|
868
|
-
_response_json = _response.json()
|
|
869
|
-
except JSONDecodeError:
|
|
870
|
-
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
871
|
-
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
685
|
+
return _response.data
|
|
872
686
|
|
|
873
687
|
def get_span_comment(
|
|
874
|
-
self,
|
|
875
|
-
comment_id: str,
|
|
876
|
-
span_id: str,
|
|
877
|
-
*,
|
|
878
|
-
request_options: typing.Optional[RequestOptions] = None,
|
|
688
|
+
self, comment_id: str, span_id: str, *, request_options: typing.Optional[RequestOptions] = None
|
|
879
689
|
) -> Comment:
|
|
880
690
|
"""
|
|
881
691
|
Get span comment
|
|
@@ -897,44 +707,11 @@ class SpansClient:
|
|
|
897
707
|
Examples
|
|
898
708
|
--------
|
|
899
709
|
from Opik import OpikApi
|
|
900
|
-
|
|
901
|
-
client =
|
|
902
|
-
api_key="YOUR_API_KEY",
|
|
903
|
-
workspace_name="YOUR_WORKSPACE_NAME",
|
|
904
|
-
)
|
|
905
|
-
client.spans.get_span_comment(
|
|
906
|
-
comment_id="commentId",
|
|
907
|
-
span_id="spanId",
|
|
908
|
-
)
|
|
710
|
+
client = OpikApi(api_key="YOUR_API_KEY", workspace_name="YOUR_WORKSPACE_NAME", )
|
|
711
|
+
client.spans.get_span_comment(comment_id='commentId', span_id='spanId', )
|
|
909
712
|
"""
|
|
910
|
-
_response = self.
|
|
911
|
-
|
|
912
|
-
method="GET",
|
|
913
|
-
request_options=request_options,
|
|
914
|
-
)
|
|
915
|
-
try:
|
|
916
|
-
if 200 <= _response.status_code < 300:
|
|
917
|
-
return typing.cast(
|
|
918
|
-
Comment,
|
|
919
|
-
parse_obj_as(
|
|
920
|
-
type_=Comment, # type: ignore
|
|
921
|
-
object_=_response.json(),
|
|
922
|
-
),
|
|
923
|
-
)
|
|
924
|
-
if _response.status_code == 404:
|
|
925
|
-
raise NotFoundError(
|
|
926
|
-
typing.cast(
|
|
927
|
-
typing.Optional[typing.Any],
|
|
928
|
-
parse_obj_as(
|
|
929
|
-
type_=typing.Optional[typing.Any], # type: ignore
|
|
930
|
-
object_=_response.json(),
|
|
931
|
-
),
|
|
932
|
-
)
|
|
933
|
-
)
|
|
934
|
-
_response_json = _response.json()
|
|
935
|
-
except JSONDecodeError:
|
|
936
|
-
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
937
|
-
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
713
|
+
_response = self._raw_client.get_span_comment(comment_id, span_id, request_options=request_options)
|
|
714
|
+
return _response.data
|
|
938
715
|
|
|
939
716
|
def get_span_stats(
|
|
940
717
|
self,
|
|
@@ -944,6 +721,8 @@ class SpansClient:
|
|
|
944
721
|
trace_id: typing.Optional[str] = None,
|
|
945
722
|
type: typing.Optional[GetSpanStatsRequestType] = None,
|
|
946
723
|
filters: typing.Optional[str] = None,
|
|
724
|
+
from_time: typing.Optional[dt.datetime] = None,
|
|
725
|
+
to_time: typing.Optional[dt.datetime] = None,
|
|
947
726
|
request_options: typing.Optional[RequestOptions] = None,
|
|
948
727
|
) -> ProjectStatsPublic:
|
|
949
728
|
"""
|
|
@@ -961,6 +740,10 @@ class SpansClient:
|
|
|
961
740
|
|
|
962
741
|
filters : typing.Optional[str]
|
|
963
742
|
|
|
743
|
+
from_time : typing.Optional[dt.datetime]
|
|
744
|
+
|
|
745
|
+
to_time : typing.Optional[dt.datetime]
|
|
746
|
+
|
|
964
747
|
request_options : typing.Optional[RequestOptions]
|
|
965
748
|
Request-specific configuration.
|
|
966
749
|
|
|
@@ -972,38 +755,20 @@ class SpansClient:
|
|
|
972
755
|
Examples
|
|
973
756
|
--------
|
|
974
757
|
from Opik import OpikApi
|
|
975
|
-
|
|
976
|
-
client = OpikApi(
|
|
977
|
-
api_key="YOUR_API_KEY",
|
|
978
|
-
workspace_name="YOUR_WORKSPACE_NAME",
|
|
979
|
-
)
|
|
758
|
+
client = OpikApi(api_key="YOUR_API_KEY", workspace_name="YOUR_WORKSPACE_NAME", )
|
|
980
759
|
client.spans.get_span_stats()
|
|
981
760
|
"""
|
|
982
|
-
_response = self.
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
"filters": filters,
|
|
991
|
-
},
|
|
761
|
+
_response = self._raw_client.get_span_stats(
|
|
762
|
+
project_id=project_id,
|
|
763
|
+
project_name=project_name,
|
|
764
|
+
trace_id=trace_id,
|
|
765
|
+
type=type,
|
|
766
|
+
filters=filters,
|
|
767
|
+
from_time=from_time,
|
|
768
|
+
to_time=to_time,
|
|
992
769
|
request_options=request_options,
|
|
993
770
|
)
|
|
994
|
-
|
|
995
|
-
if 200 <= _response.status_code < 300:
|
|
996
|
-
return typing.cast(
|
|
997
|
-
ProjectStatsPublic,
|
|
998
|
-
parse_obj_as(
|
|
999
|
-
type_=ProjectStatsPublic, # type: ignore
|
|
1000
|
-
object_=_response.json(),
|
|
1001
|
-
),
|
|
1002
|
-
)
|
|
1003
|
-
_response_json = _response.json()
|
|
1004
|
-
except JSONDecodeError:
|
|
1005
|
-
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
1006
|
-
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
771
|
+
return _response.data
|
|
1007
772
|
|
|
1008
773
|
def score_batch_of_spans(
|
|
1009
774
|
self,
|
|
@@ -1027,43 +792,13 @@ class SpansClient:
|
|
|
1027
792
|
|
|
1028
793
|
Examples
|
|
1029
794
|
--------
|
|
1030
|
-
from Opik import
|
|
1031
|
-
|
|
1032
|
-
client = OpikApi(
|
|
1033
|
-
|
|
1034
|
-
workspace_name="YOUR_WORKSPACE_NAME",
|
|
1035
|
-
)
|
|
1036
|
-
client.spans.score_batch_of_spans(
|
|
1037
|
-
scores=[
|
|
1038
|
-
FeedbackScoreBatchItem(
|
|
1039
|
-
id="id",
|
|
1040
|
-
name="name",
|
|
1041
|
-
value=1.1,
|
|
1042
|
-
source="ui",
|
|
1043
|
-
)
|
|
1044
|
-
],
|
|
1045
|
-
)
|
|
795
|
+
from Opik import OpikApi
|
|
796
|
+
from Opik import FeedbackScoreBatchItem
|
|
797
|
+
client = OpikApi(api_key="YOUR_API_KEY", workspace_name="YOUR_WORKSPACE_NAME", )
|
|
798
|
+
client.spans.score_batch_of_spans(scores=[FeedbackScoreBatchItem(name='name', value=1.1, source="ui", id='id', )], )
|
|
1046
799
|
"""
|
|
1047
|
-
_response = self.
|
|
1048
|
-
|
|
1049
|
-
method="PUT",
|
|
1050
|
-
json={
|
|
1051
|
-
"scores": convert_and_respect_annotation_metadata(
|
|
1052
|
-
object_=scores,
|
|
1053
|
-
annotation=typing.Sequence[FeedbackScoreBatchItem],
|
|
1054
|
-
direction="write",
|
|
1055
|
-
),
|
|
1056
|
-
},
|
|
1057
|
-
request_options=request_options,
|
|
1058
|
-
omit=OMIT,
|
|
1059
|
-
)
|
|
1060
|
-
try:
|
|
1061
|
-
if 200 <= _response.status_code < 300:
|
|
1062
|
-
return
|
|
1063
|
-
_response_json = _response.json()
|
|
1064
|
-
except JSONDecodeError:
|
|
1065
|
-
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
1066
|
-
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
800
|
+
_response = self._raw_client.score_batch_of_spans(scores=scores, request_options=request_options)
|
|
801
|
+
return _response.data
|
|
1067
802
|
|
|
1068
803
|
def search_spans(
|
|
1069
804
|
self,
|
|
@@ -1076,6 +811,8 @@ class SpansClient:
|
|
|
1076
811
|
limit: typing.Optional[int] = OMIT,
|
|
1077
812
|
last_retrieved_id: typing.Optional[str] = OMIT,
|
|
1078
813
|
truncate: typing.Optional[bool] = OMIT,
|
|
814
|
+
from_time: typing.Optional[dt.datetime] = OMIT,
|
|
815
|
+
to_time: typing.Optional[dt.datetime] = OMIT,
|
|
1079
816
|
request_options: typing.Optional[RequestOptions] = None,
|
|
1080
817
|
) -> typing.Iterator[bytes]:
|
|
1081
818
|
"""
|
|
@@ -1094,68 +831,41 @@ class SpansClient:
|
|
|
1094
831
|
filters : typing.Optional[typing.Sequence[SpanFilterPublic]]
|
|
1095
832
|
|
|
1096
833
|
limit : typing.Optional[int]
|
|
834
|
+
Max number of spans to be streamed
|
|
1097
835
|
|
|
1098
836
|
last_retrieved_id : typing.Optional[str]
|
|
1099
837
|
|
|
1100
838
|
truncate : typing.Optional[bool]
|
|
1101
839
|
Truncate image included in either input, output or metadata
|
|
1102
840
|
|
|
841
|
+
from_time : typing.Optional[dt.datetime]
|
|
842
|
+
Filter spans created from this time (ISO-8601 format).
|
|
843
|
+
|
|
844
|
+
to_time : typing.Optional[dt.datetime]
|
|
845
|
+
Filter spans created up to this time (ISO-8601 format). If not provided, defaults to current time. Must be after 'from_time'.
|
|
846
|
+
|
|
1103
847
|
request_options : typing.Optional[RequestOptions]
|
|
1104
848
|
Request-specific configuration. You can pass in configuration such as `chunk_size`, and more to customize the request and response.
|
|
1105
849
|
|
|
1106
|
-
|
|
1107
|
-
|
|
850
|
+
Returns
|
|
851
|
+
-------
|
|
1108
852
|
typing.Iterator[bytes]
|
|
1109
853
|
Spans stream or error during process
|
|
1110
854
|
"""
|
|
1111
|
-
with self.
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
direction="write",
|
|
1123
|
-
),
|
|
1124
|
-
"limit": limit,
|
|
1125
|
-
"last_retrieved_id": last_retrieved_id,
|
|
1126
|
-
"truncate": truncate,
|
|
1127
|
-
},
|
|
1128
|
-
headers={
|
|
1129
|
-
"content-type": "application/json",
|
|
1130
|
-
},
|
|
855
|
+
with self._raw_client.search_spans(
|
|
856
|
+
trace_id=trace_id,
|
|
857
|
+
project_name=project_name,
|
|
858
|
+
project_id=project_id,
|
|
859
|
+
type=type,
|
|
860
|
+
filters=filters,
|
|
861
|
+
limit=limit,
|
|
862
|
+
last_retrieved_id=last_retrieved_id,
|
|
863
|
+
truncate=truncate,
|
|
864
|
+
from_time=from_time,
|
|
865
|
+
to_time=to_time,
|
|
1131
866
|
request_options=request_options,
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
try:
|
|
1135
|
-
if 200 <= _response.status_code < 300:
|
|
1136
|
-
_chunk_size = (
|
|
1137
|
-
request_options.get("chunk_size", None)
|
|
1138
|
-
if request_options is not None
|
|
1139
|
-
else None
|
|
1140
|
-
)
|
|
1141
|
-
for _chunk in _response.iter_bytes(chunk_size=_chunk_size):
|
|
1142
|
-
yield _chunk
|
|
1143
|
-
return
|
|
1144
|
-
_response.read()
|
|
1145
|
-
if _response.status_code == 400:
|
|
1146
|
-
raise BadRequestError(
|
|
1147
|
-
typing.cast(
|
|
1148
|
-
typing.Optional[typing.Any],
|
|
1149
|
-
parse_obj_as(
|
|
1150
|
-
type_=typing.Optional[typing.Any], # type: ignore
|
|
1151
|
-
object_=_response.json(),
|
|
1152
|
-
),
|
|
1153
|
-
)
|
|
1154
|
-
)
|
|
1155
|
-
_response_json = _response.json()
|
|
1156
|
-
except JSONDecodeError:
|
|
1157
|
-
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
1158
|
-
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
867
|
+
) as r:
|
|
868
|
+
yield from r.data
|
|
1159
869
|
|
|
1160
870
|
def update_span_comment(
|
|
1161
871
|
self,
|
|
@@ -1198,52 +908,36 @@ class SpansClient:
|
|
|
1198
908
|
Examples
|
|
1199
909
|
--------
|
|
1200
910
|
from Opik import OpikApi
|
|
1201
|
-
|
|
1202
|
-
client =
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
f"v1/private/spans/comments/{jsonable_encoder(comment_id)}",
|
|
1213
|
-
method="PATCH",
|
|
1214
|
-
json={
|
|
1215
|
-
"id": id,
|
|
1216
|
-
"text": text,
|
|
1217
|
-
"created_at": created_at,
|
|
1218
|
-
"last_updated_at": last_updated_at,
|
|
1219
|
-
"created_by": created_by,
|
|
1220
|
-
"last_updated_by": last_updated_by,
|
|
1221
|
-
},
|
|
911
|
+
client = OpikApi(api_key="YOUR_API_KEY", workspace_name="YOUR_WORKSPACE_NAME", )
|
|
912
|
+
client.spans.update_span_comment(comment_id='commentId', text='text', )
|
|
913
|
+
"""
|
|
914
|
+
_response = self._raw_client.update_span_comment(
|
|
915
|
+
comment_id,
|
|
916
|
+
text=text,
|
|
917
|
+
id=id,
|
|
918
|
+
created_at=created_at,
|
|
919
|
+
last_updated_at=last_updated_at,
|
|
920
|
+
created_by=created_by,
|
|
921
|
+
last_updated_by=last_updated_by,
|
|
1222
922
|
request_options=request_options,
|
|
1223
|
-
omit=OMIT,
|
|
1224
923
|
)
|
|
1225
|
-
|
|
1226
|
-
if 200 <= _response.status_code < 300:
|
|
1227
|
-
return
|
|
1228
|
-
if _response.status_code == 404:
|
|
1229
|
-
raise NotFoundError(
|
|
1230
|
-
typing.cast(
|
|
1231
|
-
typing.Optional[typing.Any],
|
|
1232
|
-
parse_obj_as(
|
|
1233
|
-
type_=typing.Optional[typing.Any], # type: ignore
|
|
1234
|
-
object_=_response.json(),
|
|
1235
|
-
),
|
|
1236
|
-
)
|
|
1237
|
-
)
|
|
1238
|
-
_response_json = _response.json()
|
|
1239
|
-
except JSONDecodeError:
|
|
1240
|
-
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
1241
|
-
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
924
|
+
return _response.data
|
|
1242
925
|
|
|
1243
926
|
|
|
1244
927
|
class AsyncSpansClient:
|
|
1245
928
|
def __init__(self, *, client_wrapper: AsyncClientWrapper):
|
|
1246
|
-
self.
|
|
929
|
+
self._raw_client = AsyncRawSpansClient(client_wrapper=client_wrapper)
|
|
930
|
+
|
|
931
|
+
@property
|
|
932
|
+
def with_raw_response(self) -> AsyncRawSpansClient:
|
|
933
|
+
"""
|
|
934
|
+
Retrieves a raw implementation of this client that returns raw responses.
|
|
935
|
+
|
|
936
|
+
Returns
|
|
937
|
+
-------
|
|
938
|
+
AsyncRawSpansClient
|
|
939
|
+
"""
|
|
940
|
+
return self._raw_client
|
|
1247
941
|
|
|
1248
942
|
async def add_span_comment(
|
|
1249
943
|
self,
|
|
@@ -1285,46 +979,24 @@ class AsyncSpansClient:
|
|
|
1285
979
|
|
|
1286
980
|
Examples
|
|
1287
981
|
--------
|
|
1288
|
-
import asyncio
|
|
1289
|
-
|
|
1290
982
|
from Opik import AsyncOpikApi
|
|
1291
|
-
|
|
1292
|
-
client = AsyncOpikApi(
|
|
1293
|
-
api_key="YOUR_API_KEY",
|
|
1294
|
-
workspace_name="YOUR_WORKSPACE_NAME",
|
|
1295
|
-
)
|
|
1296
|
-
|
|
1297
|
-
|
|
983
|
+
import asyncio
|
|
984
|
+
client = AsyncOpikApi(api_key="YOUR_API_KEY", workspace_name="YOUR_WORKSPACE_NAME", )
|
|
1298
985
|
async def main() -> None:
|
|
1299
|
-
await client.spans.add_span_comment(
|
|
1300
|
-
id_="id",
|
|
1301
|
-
text="text",
|
|
1302
|
-
)
|
|
1303
|
-
|
|
1304
|
-
|
|
986
|
+
await client.spans.add_span_comment(id_='id', text='text', )
|
|
1305
987
|
asyncio.run(main())
|
|
1306
988
|
"""
|
|
1307
|
-
_response = await self.
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
"created_by": created_by,
|
|
1316
|
-
"last_updated_by": last_updated_by,
|
|
1317
|
-
},
|
|
989
|
+
_response = await self._raw_client.add_span_comment(
|
|
990
|
+
id_,
|
|
991
|
+
text=text,
|
|
992
|
+
id=id,
|
|
993
|
+
created_at=created_at,
|
|
994
|
+
last_updated_at=last_updated_at,
|
|
995
|
+
created_by=created_by,
|
|
996
|
+
last_updated_by=last_updated_by,
|
|
1318
997
|
request_options=request_options,
|
|
1319
|
-
omit=OMIT,
|
|
1320
998
|
)
|
|
1321
|
-
|
|
1322
|
-
if 200 <= _response.status_code < 300:
|
|
1323
|
-
return
|
|
1324
|
-
_response_json = _response.json()
|
|
1325
|
-
except JSONDecodeError:
|
|
1326
|
-
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
1327
|
-
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
999
|
+
return _response.data
|
|
1328
1000
|
|
|
1329
1001
|
async def add_span_feedback_score(
|
|
1330
1002
|
self,
|
|
@@ -1339,6 +1011,7 @@ class AsyncSpansClient:
|
|
|
1339
1011
|
last_updated_at: typing.Optional[dt.datetime] = OMIT,
|
|
1340
1012
|
created_by: typing.Optional[str] = OMIT,
|
|
1341
1013
|
last_updated_by: typing.Optional[str] = OMIT,
|
|
1014
|
+
value_by_author: typing.Optional[typing.Dict[str, ValueEntry]] = OMIT,
|
|
1342
1015
|
request_options: typing.Optional[RequestOptions] = None,
|
|
1343
1016
|
) -> None:
|
|
1344
1017
|
"""
|
|
@@ -1366,6 +1039,8 @@ class AsyncSpansClient:
|
|
|
1366
1039
|
|
|
1367
1040
|
last_updated_by : typing.Optional[str]
|
|
1368
1041
|
|
|
1042
|
+
value_by_author : typing.Optional[typing.Dict[str, ValueEntry]]
|
|
1043
|
+
|
|
1369
1044
|
request_options : typing.Optional[RequestOptions]
|
|
1370
1045
|
Request-specific configuration.
|
|
1371
1046
|
|
|
@@ -1375,51 +1050,102 @@ class AsyncSpansClient:
|
|
|
1375
1050
|
|
|
1376
1051
|
Examples
|
|
1377
1052
|
--------
|
|
1053
|
+
from Opik import AsyncOpikApi
|
|
1378
1054
|
import asyncio
|
|
1055
|
+
client = AsyncOpikApi(api_key="YOUR_API_KEY", workspace_name="YOUR_WORKSPACE_NAME", )
|
|
1056
|
+
async def main() -> None:
|
|
1057
|
+
await client.spans.add_span_feedback_score(id='id', name='name', value=1.1, source="ui", )
|
|
1058
|
+
asyncio.run(main())
|
|
1059
|
+
"""
|
|
1060
|
+
_response = await self._raw_client.add_span_feedback_score(
|
|
1061
|
+
id,
|
|
1062
|
+
name=name,
|
|
1063
|
+
value=value,
|
|
1064
|
+
source=source,
|
|
1065
|
+
category_name=category_name,
|
|
1066
|
+
reason=reason,
|
|
1067
|
+
created_at=created_at,
|
|
1068
|
+
last_updated_at=last_updated_at,
|
|
1069
|
+
created_by=created_by,
|
|
1070
|
+
last_updated_by=last_updated_by,
|
|
1071
|
+
value_by_author=value_by_author,
|
|
1072
|
+
request_options=request_options,
|
|
1073
|
+
)
|
|
1074
|
+
return _response.data
|
|
1379
1075
|
|
|
1380
|
-
|
|
1076
|
+
async def create_spans(
|
|
1077
|
+
self, *, spans: typing.Sequence[SpanWrite], request_options: typing.Optional[RequestOptions] = None
|
|
1078
|
+
) -> None:
|
|
1079
|
+
"""
|
|
1080
|
+
Create spans
|
|
1381
1081
|
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
)
|
|
1082
|
+
Parameters
|
|
1083
|
+
----------
|
|
1084
|
+
spans : typing.Sequence[SpanWrite]
|
|
1386
1085
|
|
|
1086
|
+
request_options : typing.Optional[RequestOptions]
|
|
1087
|
+
Request-specific configuration.
|
|
1088
|
+
|
|
1089
|
+
Returns
|
|
1090
|
+
-------
|
|
1091
|
+
None
|
|
1387
1092
|
|
|
1093
|
+
Examples
|
|
1094
|
+
--------
|
|
1095
|
+
from Opik import AsyncOpikApi
|
|
1096
|
+
from Opik import SpanWrite
|
|
1097
|
+
import datetime
|
|
1098
|
+
import asyncio
|
|
1099
|
+
client = AsyncOpikApi(api_key="YOUR_API_KEY", workspace_name="YOUR_WORKSPACE_NAME", )
|
|
1388
1100
|
async def main() -> None:
|
|
1389
|
-
await client.spans.
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1101
|
+
await client.spans.create_spans(spans=[SpanWrite(start_time=datetime.datetime.fromisoformat("2024-01-15 09:30:00+00:00", ), )], )
|
|
1102
|
+
asyncio.run(main())
|
|
1103
|
+
"""
|
|
1104
|
+
_response = await self._raw_client.create_spans(spans=spans, request_options=request_options)
|
|
1105
|
+
return _response.data
|
|
1106
|
+
|
|
1107
|
+
async def batch_update_spans(
|
|
1108
|
+
self,
|
|
1109
|
+
*,
|
|
1110
|
+
ids: typing.Sequence[str],
|
|
1111
|
+
update: SpanUpdate,
|
|
1112
|
+
merge_tags: typing.Optional[bool] = OMIT,
|
|
1113
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
1114
|
+
) -> None:
|
|
1115
|
+
"""
|
|
1116
|
+
Update multiple spans
|
|
1395
1117
|
|
|
1118
|
+
Parameters
|
|
1119
|
+
----------
|
|
1120
|
+
ids : typing.Sequence[str]
|
|
1121
|
+
List of span IDs to update (max 1000)
|
|
1396
1122
|
|
|
1123
|
+
update : SpanUpdate
|
|
1124
|
+
|
|
1125
|
+
merge_tags : typing.Optional[bool]
|
|
1126
|
+
If true, merge tags with existing tags instead of replacing them. Default: false
|
|
1127
|
+
|
|
1128
|
+
request_options : typing.Optional[RequestOptions]
|
|
1129
|
+
Request-specific configuration.
|
|
1130
|
+
|
|
1131
|
+
Returns
|
|
1132
|
+
-------
|
|
1133
|
+
None
|
|
1134
|
+
|
|
1135
|
+
Examples
|
|
1136
|
+
--------
|
|
1137
|
+
from Opik import AsyncOpikApi
|
|
1138
|
+
from Opik import SpanUpdate
|
|
1139
|
+
import asyncio
|
|
1140
|
+
client = AsyncOpikApi(api_key="YOUR_API_KEY", workspace_name="YOUR_WORKSPACE_NAME", )
|
|
1141
|
+
async def main() -> None:
|
|
1142
|
+
await client.spans.batch_update_spans(ids=['ids'], update=SpanUpdate(trace_id='trace_id', ), )
|
|
1397
1143
|
asyncio.run(main())
|
|
1398
1144
|
"""
|
|
1399
|
-
_response = await self.
|
|
1400
|
-
|
|
1401
|
-
method="PUT",
|
|
1402
|
-
json={
|
|
1403
|
-
"name": name,
|
|
1404
|
-
"category_name": category_name,
|
|
1405
|
-
"value": value,
|
|
1406
|
-
"reason": reason,
|
|
1407
|
-
"source": source,
|
|
1408
|
-
"created_at": created_at,
|
|
1409
|
-
"last_updated_at": last_updated_at,
|
|
1410
|
-
"created_by": created_by,
|
|
1411
|
-
"last_updated_by": last_updated_by,
|
|
1412
|
-
},
|
|
1413
|
-
request_options=request_options,
|
|
1414
|
-
omit=OMIT,
|
|
1145
|
+
_response = await self._raw_client.batch_update_spans(
|
|
1146
|
+
ids=ids, update=update, merge_tags=merge_tags, request_options=request_options
|
|
1415
1147
|
)
|
|
1416
|
-
|
|
1417
|
-
if 200 <= _response.status_code < 300:
|
|
1418
|
-
return
|
|
1419
|
-
_response_json = _response.json()
|
|
1420
|
-
except JSONDecodeError:
|
|
1421
|
-
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
1422
|
-
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
1148
|
+
return _response.data
|
|
1423
1149
|
|
|
1424
1150
|
async def get_spans_by_project(
|
|
1425
1151
|
self,
|
|
@@ -1432,6 +1158,11 @@ class AsyncSpansClient:
|
|
|
1432
1158
|
type: typing.Optional[GetSpansByProjectRequestType] = None,
|
|
1433
1159
|
filters: typing.Optional[str] = None,
|
|
1434
1160
|
truncate: typing.Optional[bool] = None,
|
|
1161
|
+
strip_attachments: typing.Optional[bool] = None,
|
|
1162
|
+
sorting: typing.Optional[str] = None,
|
|
1163
|
+
exclude: typing.Optional[str] = None,
|
|
1164
|
+
from_time: typing.Optional[dt.datetime] = None,
|
|
1165
|
+
to_time: typing.Optional[dt.datetime] = None,
|
|
1435
1166
|
request_options: typing.Optional[RequestOptions] = None,
|
|
1436
1167
|
) -> SpanPagePublic:
|
|
1437
1168
|
"""
|
|
@@ -1455,6 +1186,16 @@ class AsyncSpansClient:
|
|
|
1455
1186
|
|
|
1456
1187
|
truncate : typing.Optional[bool]
|
|
1457
1188
|
|
|
1189
|
+
strip_attachments : typing.Optional[bool]
|
|
1190
|
+
|
|
1191
|
+
sorting : typing.Optional[str]
|
|
1192
|
+
|
|
1193
|
+
exclude : typing.Optional[str]
|
|
1194
|
+
|
|
1195
|
+
from_time : typing.Optional[dt.datetime]
|
|
1196
|
+
|
|
1197
|
+
to_time : typing.Optional[dt.datetime]
|
|
1198
|
+
|
|
1458
1199
|
request_options : typing.Optional[RequestOptions]
|
|
1459
1200
|
Request-specific configuration.
|
|
1460
1201
|
|
|
@@ -1465,70 +1206,51 @@ class AsyncSpansClient:
|
|
|
1465
1206
|
|
|
1466
1207
|
Examples
|
|
1467
1208
|
--------
|
|
1468
|
-
import asyncio
|
|
1469
|
-
|
|
1470
1209
|
from Opik import AsyncOpikApi
|
|
1471
|
-
|
|
1472
|
-
client = AsyncOpikApi(
|
|
1473
|
-
api_key="YOUR_API_KEY",
|
|
1474
|
-
workspace_name="YOUR_WORKSPACE_NAME",
|
|
1475
|
-
)
|
|
1476
|
-
|
|
1477
|
-
|
|
1210
|
+
import asyncio
|
|
1211
|
+
client = AsyncOpikApi(api_key="YOUR_API_KEY", workspace_name="YOUR_WORKSPACE_NAME", )
|
|
1478
1212
|
async def main() -> None:
|
|
1479
1213
|
await client.spans.get_spans_by_project()
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
1214
|
asyncio.run(main())
|
|
1483
1215
|
"""
|
|
1484
|
-
_response = await self.
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1216
|
+
_response = await self._raw_client.get_spans_by_project(
|
|
1217
|
+
page=page,
|
|
1218
|
+
size=size,
|
|
1219
|
+
project_name=project_name,
|
|
1220
|
+
project_id=project_id,
|
|
1221
|
+
trace_id=trace_id,
|
|
1222
|
+
type=type,
|
|
1223
|
+
filters=filters,
|
|
1224
|
+
truncate=truncate,
|
|
1225
|
+
strip_attachments=strip_attachments,
|
|
1226
|
+
sorting=sorting,
|
|
1227
|
+
exclude=exclude,
|
|
1228
|
+
from_time=from_time,
|
|
1229
|
+
to_time=to_time,
|
|
1497
1230
|
request_options=request_options,
|
|
1498
1231
|
)
|
|
1499
|
-
|
|
1500
|
-
if 200 <= _response.status_code < 300:
|
|
1501
|
-
return typing.cast(
|
|
1502
|
-
SpanPagePublic,
|
|
1503
|
-
parse_obj_as(
|
|
1504
|
-
type_=SpanPagePublic, # type: ignore
|
|
1505
|
-
object_=_response.json(),
|
|
1506
|
-
),
|
|
1507
|
-
)
|
|
1508
|
-
_response_json = _response.json()
|
|
1509
|
-
except JSONDecodeError:
|
|
1510
|
-
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
1511
|
-
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
1232
|
+
return _response.data
|
|
1512
1233
|
|
|
1513
1234
|
async def create_span(
|
|
1514
1235
|
self,
|
|
1515
1236
|
*,
|
|
1516
|
-
trace_id: str,
|
|
1517
|
-
name: str,
|
|
1518
|
-
type: SpanWriteType,
|
|
1519
1237
|
start_time: dt.datetime,
|
|
1520
1238
|
id: typing.Optional[str] = OMIT,
|
|
1521
1239
|
project_name: typing.Optional[str] = OMIT,
|
|
1240
|
+
trace_id: typing.Optional[str] = OMIT,
|
|
1522
1241
|
parent_span_id: typing.Optional[str] = OMIT,
|
|
1242
|
+
name: typing.Optional[str] = OMIT,
|
|
1243
|
+
type: typing.Optional[SpanWriteType] = OMIT,
|
|
1523
1244
|
end_time: typing.Optional[dt.datetime] = OMIT,
|
|
1524
|
-
input: typing.Optional[
|
|
1525
|
-
output: typing.Optional[
|
|
1526
|
-
metadata: typing.Optional[
|
|
1245
|
+
input: typing.Optional[JsonListStringWrite] = OMIT,
|
|
1246
|
+
output: typing.Optional[JsonListStringWrite] = OMIT,
|
|
1247
|
+
metadata: typing.Optional[JsonListStringWrite] = OMIT,
|
|
1527
1248
|
model: typing.Optional[str] = OMIT,
|
|
1528
1249
|
provider: typing.Optional[str] = OMIT,
|
|
1529
1250
|
tags: typing.Optional[typing.Sequence[str]] = OMIT,
|
|
1530
1251
|
usage: typing.Optional[typing.Dict[str, int]] = OMIT,
|
|
1531
1252
|
error_info: typing.Optional[ErrorInfoWrite] = OMIT,
|
|
1253
|
+
last_updated_at: typing.Optional[dt.datetime] = OMIT,
|
|
1532
1254
|
total_estimated_cost: typing.Optional[float] = OMIT,
|
|
1533
1255
|
total_estimated_cost_version: typing.Optional[str] = OMIT,
|
|
1534
1256
|
request_options: typing.Optional[RequestOptions] = None,
|
|
@@ -1538,12 +1260,6 @@ class AsyncSpansClient:
|
|
|
1538
1260
|
|
|
1539
1261
|
Parameters
|
|
1540
1262
|
----------
|
|
1541
|
-
trace_id : str
|
|
1542
|
-
|
|
1543
|
-
name : str
|
|
1544
|
-
|
|
1545
|
-
type : SpanWriteType
|
|
1546
|
-
|
|
1547
1263
|
start_time : dt.datetime
|
|
1548
1264
|
|
|
1549
1265
|
id : typing.Optional[str]
|
|
@@ -1551,15 +1267,21 @@ class AsyncSpansClient:
|
|
|
1551
1267
|
project_name : typing.Optional[str]
|
|
1552
1268
|
If null, the default project is used
|
|
1553
1269
|
|
|
1270
|
+
trace_id : typing.Optional[str]
|
|
1271
|
+
|
|
1554
1272
|
parent_span_id : typing.Optional[str]
|
|
1555
1273
|
|
|
1274
|
+
name : typing.Optional[str]
|
|
1275
|
+
|
|
1276
|
+
type : typing.Optional[SpanWriteType]
|
|
1277
|
+
|
|
1556
1278
|
end_time : typing.Optional[dt.datetime]
|
|
1557
1279
|
|
|
1558
|
-
input : typing.Optional[
|
|
1280
|
+
input : typing.Optional[JsonListStringWrite]
|
|
1559
1281
|
|
|
1560
|
-
output : typing.Optional[
|
|
1282
|
+
output : typing.Optional[JsonListStringWrite]
|
|
1561
1283
|
|
|
1562
|
-
metadata : typing.Optional[
|
|
1284
|
+
metadata : typing.Optional[JsonListStringWrite]
|
|
1563
1285
|
|
|
1564
1286
|
model : typing.Optional[str]
|
|
1565
1287
|
|
|
@@ -1571,6 +1293,8 @@ class AsyncSpansClient:
|
|
|
1571
1293
|
|
|
1572
1294
|
error_info : typing.Optional[ErrorInfoWrite]
|
|
1573
1295
|
|
|
1296
|
+
last_updated_at : typing.Optional[dt.datetime]
|
|
1297
|
+
|
|
1574
1298
|
total_estimated_cost : typing.Optional[float]
|
|
1575
1299
|
|
|
1576
1300
|
total_estimated_cost_version : typing.Optional[str]
|
|
@@ -1584,142 +1308,44 @@ class AsyncSpansClient:
|
|
|
1584
1308
|
|
|
1585
1309
|
Examples
|
|
1586
1310
|
--------
|
|
1587
|
-
import asyncio
|
|
1588
|
-
import datetime
|
|
1589
|
-
|
|
1590
1311
|
from Opik import AsyncOpikApi
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
workspace_name="YOUR_WORKSPACE_NAME",
|
|
1595
|
-
)
|
|
1596
|
-
|
|
1597
|
-
|
|
1312
|
+
import datetime
|
|
1313
|
+
import asyncio
|
|
1314
|
+
client = AsyncOpikApi(api_key="YOUR_API_KEY", workspace_name="YOUR_WORKSPACE_NAME", )
|
|
1598
1315
|
async def main() -> None:
|
|
1599
|
-
await client.spans.create_span(
|
|
1600
|
-
trace_id="trace_id",
|
|
1601
|
-
name="name",
|
|
1602
|
-
type="general",
|
|
1603
|
-
start_time=datetime.datetime.fromisoformat(
|
|
1604
|
-
"2024-01-15 09:30:00+00:00",
|
|
1605
|
-
),
|
|
1606
|
-
)
|
|
1607
|
-
|
|
1608
|
-
|
|
1316
|
+
await client.spans.create_span(start_time=datetime.datetime.fromisoformat("2024-01-15 09:30:00+00:00", ), )
|
|
1609
1317
|
asyncio.run(main())
|
|
1610
1318
|
"""
|
|
1611
|
-
_response = await self.
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
object_=error_info, annotation=ErrorInfoWrite, direction="write"
|
|
1632
|
-
),
|
|
1633
|
-
"total_estimated_cost": total_estimated_cost,
|
|
1634
|
-
"total_estimated_cost_version": total_estimated_cost_version,
|
|
1635
|
-
},
|
|
1319
|
+
_response = await self._raw_client.create_span(
|
|
1320
|
+
start_time=start_time,
|
|
1321
|
+
id=id,
|
|
1322
|
+
project_name=project_name,
|
|
1323
|
+
trace_id=trace_id,
|
|
1324
|
+
parent_span_id=parent_span_id,
|
|
1325
|
+
name=name,
|
|
1326
|
+
type=type,
|
|
1327
|
+
end_time=end_time,
|
|
1328
|
+
input=input,
|
|
1329
|
+
output=output,
|
|
1330
|
+
metadata=metadata,
|
|
1331
|
+
model=model,
|
|
1332
|
+
provider=provider,
|
|
1333
|
+
tags=tags,
|
|
1334
|
+
usage=usage,
|
|
1335
|
+
error_info=error_info,
|
|
1336
|
+
last_updated_at=last_updated_at,
|
|
1337
|
+
total_estimated_cost=total_estimated_cost,
|
|
1338
|
+
total_estimated_cost_version=total_estimated_cost_version,
|
|
1636
1339
|
request_options=request_options,
|
|
1637
|
-
omit=OMIT,
|
|
1638
1340
|
)
|
|
1639
|
-
|
|
1640
|
-
if 200 <= _response.status_code < 300:
|
|
1641
|
-
return
|
|
1642
|
-
_response_json = _response.json()
|
|
1643
|
-
except JSONDecodeError:
|
|
1644
|
-
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
1645
|
-
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
1341
|
+
return _response.data
|
|
1646
1342
|
|
|
1647
|
-
async def
|
|
1343
|
+
async def get_span_by_id(
|
|
1648
1344
|
self,
|
|
1345
|
+
id: str,
|
|
1649
1346
|
*,
|
|
1650
|
-
|
|
1347
|
+
strip_attachments: typing.Optional[bool] = None,
|
|
1651
1348
|
request_options: typing.Optional[RequestOptions] = None,
|
|
1652
|
-
) -> None:
|
|
1653
|
-
"""
|
|
1654
|
-
Create spans
|
|
1655
|
-
|
|
1656
|
-
Parameters
|
|
1657
|
-
----------
|
|
1658
|
-
spans : typing.Sequence[SpanWrite]
|
|
1659
|
-
|
|
1660
|
-
request_options : typing.Optional[RequestOptions]
|
|
1661
|
-
Request-specific configuration.
|
|
1662
|
-
|
|
1663
|
-
Returns
|
|
1664
|
-
-------
|
|
1665
|
-
None
|
|
1666
|
-
|
|
1667
|
-
Examples
|
|
1668
|
-
--------
|
|
1669
|
-
import asyncio
|
|
1670
|
-
import datetime
|
|
1671
|
-
|
|
1672
|
-
from Opik import AsyncOpikApi, SpanWrite
|
|
1673
|
-
|
|
1674
|
-
client = AsyncOpikApi(
|
|
1675
|
-
api_key="YOUR_API_KEY",
|
|
1676
|
-
workspace_name="YOUR_WORKSPACE_NAME",
|
|
1677
|
-
)
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
async def main() -> None:
|
|
1681
|
-
await client.spans.create_spans(
|
|
1682
|
-
spans=[
|
|
1683
|
-
SpanWrite(
|
|
1684
|
-
trace_id="trace_id",
|
|
1685
|
-
name="name",
|
|
1686
|
-
type="general",
|
|
1687
|
-
start_time=datetime.datetime.fromisoformat(
|
|
1688
|
-
"2024-01-15 09:30:00+00:00",
|
|
1689
|
-
),
|
|
1690
|
-
)
|
|
1691
|
-
],
|
|
1692
|
-
)
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
asyncio.run(main())
|
|
1696
|
-
"""
|
|
1697
|
-
_response = await self._client_wrapper.httpx_client.request(
|
|
1698
|
-
"v1/private/spans/batch",
|
|
1699
|
-
method="POST",
|
|
1700
|
-
json={
|
|
1701
|
-
"spans": convert_and_respect_annotation_metadata(
|
|
1702
|
-
object_=spans,
|
|
1703
|
-
annotation=typing.Sequence[SpanWrite],
|
|
1704
|
-
direction="write",
|
|
1705
|
-
),
|
|
1706
|
-
},
|
|
1707
|
-
headers={
|
|
1708
|
-
"content-type": "application/json",
|
|
1709
|
-
},
|
|
1710
|
-
request_options=request_options,
|
|
1711
|
-
omit=OMIT,
|
|
1712
|
-
)
|
|
1713
|
-
try:
|
|
1714
|
-
if 200 <= _response.status_code < 300:
|
|
1715
|
-
return
|
|
1716
|
-
_response_json = _response.json()
|
|
1717
|
-
except JSONDecodeError:
|
|
1718
|
-
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
1719
|
-
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
1720
|
-
|
|
1721
|
-
async def get_span_by_id(
|
|
1722
|
-
self, id: str, *, request_options: typing.Optional[RequestOptions] = None
|
|
1723
1349
|
) -> SpanPublic:
|
|
1724
1350
|
"""
|
|
1725
1351
|
Get span by id
|
|
@@ -1728,6 +1354,8 @@ class AsyncSpansClient:
|
|
|
1728
1354
|
----------
|
|
1729
1355
|
id : str
|
|
1730
1356
|
|
|
1357
|
+
strip_attachments : typing.Optional[bool]
|
|
1358
|
+
|
|
1731
1359
|
request_options : typing.Optional[RequestOptions]
|
|
1732
1360
|
Request-specific configuration.
|
|
1733
1361
|
|
|
@@ -1738,56 +1366,19 @@ class AsyncSpansClient:
|
|
|
1738
1366
|
|
|
1739
1367
|
Examples
|
|
1740
1368
|
--------
|
|
1741
|
-
import asyncio
|
|
1742
|
-
|
|
1743
1369
|
from Opik import AsyncOpikApi
|
|
1744
|
-
|
|
1745
|
-
client = AsyncOpikApi(
|
|
1746
|
-
api_key="YOUR_API_KEY",
|
|
1747
|
-
workspace_name="YOUR_WORKSPACE_NAME",
|
|
1748
|
-
)
|
|
1749
|
-
|
|
1750
|
-
|
|
1370
|
+
import asyncio
|
|
1371
|
+
client = AsyncOpikApi(api_key="YOUR_API_KEY", workspace_name="YOUR_WORKSPACE_NAME", )
|
|
1751
1372
|
async def main() -> None:
|
|
1752
|
-
await client.spans.get_span_by_id(
|
|
1753
|
-
id="id",
|
|
1754
|
-
)
|
|
1755
|
-
|
|
1756
|
-
|
|
1373
|
+
await client.spans.get_span_by_id(id='id', )
|
|
1757
1374
|
asyncio.run(main())
|
|
1758
1375
|
"""
|
|
1759
|
-
_response = await self.
|
|
1760
|
-
|
|
1761
|
-
method="GET",
|
|
1762
|
-
request_options=request_options,
|
|
1376
|
+
_response = await self._raw_client.get_span_by_id(
|
|
1377
|
+
id, strip_attachments=strip_attachments, request_options=request_options
|
|
1763
1378
|
)
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
SpanPublic,
|
|
1768
|
-
parse_obj_as(
|
|
1769
|
-
type_=SpanPublic, # type: ignore
|
|
1770
|
-
object_=_response.json(),
|
|
1771
|
-
),
|
|
1772
|
-
)
|
|
1773
|
-
if _response.status_code == 404:
|
|
1774
|
-
raise NotFoundError(
|
|
1775
|
-
typing.cast(
|
|
1776
|
-
typing.Optional[typing.Any],
|
|
1777
|
-
parse_obj_as(
|
|
1778
|
-
type_=typing.Optional[typing.Any], # type: ignore
|
|
1779
|
-
object_=_response.json(),
|
|
1780
|
-
),
|
|
1781
|
-
)
|
|
1782
|
-
)
|
|
1783
|
-
_response_json = _response.json()
|
|
1784
|
-
except JSONDecodeError:
|
|
1785
|
-
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
1786
|
-
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
1787
|
-
|
|
1788
|
-
async def delete_span_by_id(
|
|
1789
|
-
self, id: str, *, request_options: typing.Optional[RequestOptions] = None
|
|
1790
|
-
) -> None:
|
|
1379
|
+
return _response.data
|
|
1380
|
+
|
|
1381
|
+
async def delete_span_by_id(self, id: str, *, request_options: typing.Optional[RequestOptions] = None) -> None:
|
|
1791
1382
|
"""
|
|
1792
1383
|
Delete span by id
|
|
1793
1384
|
|
|
@@ -1804,46 +1395,15 @@ class AsyncSpansClient:
|
|
|
1804
1395
|
|
|
1805
1396
|
Examples
|
|
1806
1397
|
--------
|
|
1807
|
-
import asyncio
|
|
1808
|
-
|
|
1809
1398
|
from Opik import AsyncOpikApi
|
|
1810
|
-
|
|
1811
|
-
client = AsyncOpikApi(
|
|
1812
|
-
api_key="YOUR_API_KEY",
|
|
1813
|
-
workspace_name="YOUR_WORKSPACE_NAME",
|
|
1814
|
-
)
|
|
1815
|
-
|
|
1816
|
-
|
|
1399
|
+
import asyncio
|
|
1400
|
+
client = AsyncOpikApi(api_key="YOUR_API_KEY", workspace_name="YOUR_WORKSPACE_NAME", )
|
|
1817
1401
|
async def main() -> None:
|
|
1818
|
-
await client.spans.delete_span_by_id(
|
|
1819
|
-
id="id",
|
|
1820
|
-
)
|
|
1821
|
-
|
|
1822
|
-
|
|
1402
|
+
await client.spans.delete_span_by_id(id='id', )
|
|
1823
1403
|
asyncio.run(main())
|
|
1824
1404
|
"""
|
|
1825
|
-
_response = await self.
|
|
1826
|
-
|
|
1827
|
-
method="DELETE",
|
|
1828
|
-
request_options=request_options,
|
|
1829
|
-
)
|
|
1830
|
-
try:
|
|
1831
|
-
if 200 <= _response.status_code < 300:
|
|
1832
|
-
return
|
|
1833
|
-
if _response.status_code == 501:
|
|
1834
|
-
raise NotImplementedError(
|
|
1835
|
-
typing.cast(
|
|
1836
|
-
typing.Optional[typing.Any],
|
|
1837
|
-
parse_obj_as(
|
|
1838
|
-
type_=typing.Optional[typing.Any], # type: ignore
|
|
1839
|
-
object_=_response.json(),
|
|
1840
|
-
),
|
|
1841
|
-
)
|
|
1842
|
-
)
|
|
1843
|
-
_response_json = _response.json()
|
|
1844
|
-
except JSONDecodeError:
|
|
1845
|
-
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
1846
|
-
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
1405
|
+
_response = await self._raw_client.delete_span_by_id(id, request_options=request_options)
|
|
1406
|
+
return _response.data
|
|
1847
1407
|
|
|
1848
1408
|
async def update_span(
|
|
1849
1409
|
self,
|
|
@@ -1853,10 +1413,12 @@ class AsyncSpansClient:
|
|
|
1853
1413
|
project_name: typing.Optional[str] = OMIT,
|
|
1854
1414
|
project_id: typing.Optional[str] = OMIT,
|
|
1855
1415
|
parent_span_id: typing.Optional[str] = OMIT,
|
|
1416
|
+
name: typing.Optional[str] = OMIT,
|
|
1417
|
+
type: typing.Optional[SpanUpdateType] = OMIT,
|
|
1856
1418
|
end_time: typing.Optional[dt.datetime] = OMIT,
|
|
1857
|
-
input: typing.Optional[
|
|
1858
|
-
output: typing.Optional[
|
|
1859
|
-
metadata: typing.Optional[
|
|
1419
|
+
input: typing.Optional[JsonListString] = OMIT,
|
|
1420
|
+
output: typing.Optional[JsonListString] = OMIT,
|
|
1421
|
+
metadata: typing.Optional[JsonListString] = OMIT,
|
|
1860
1422
|
model: typing.Optional[str] = OMIT,
|
|
1861
1423
|
provider: typing.Optional[str] = OMIT,
|
|
1862
1424
|
tags: typing.Optional[typing.Sequence[str]] = OMIT,
|
|
@@ -1882,13 +1444,17 @@ class AsyncSpansClient:
|
|
|
1882
1444
|
|
|
1883
1445
|
parent_span_id : typing.Optional[str]
|
|
1884
1446
|
|
|
1447
|
+
name : typing.Optional[str]
|
|
1448
|
+
|
|
1449
|
+
type : typing.Optional[SpanUpdateType]
|
|
1450
|
+
|
|
1885
1451
|
end_time : typing.Optional[dt.datetime]
|
|
1886
1452
|
|
|
1887
|
-
input : typing.Optional[
|
|
1453
|
+
input : typing.Optional[JsonListString]
|
|
1888
1454
|
|
|
1889
|
-
output : typing.Optional[
|
|
1455
|
+
output : typing.Optional[JsonListString]
|
|
1890
1456
|
|
|
1891
|
-
metadata : typing.Optional[
|
|
1457
|
+
metadata : typing.Optional[JsonListString]
|
|
1892
1458
|
|
|
1893
1459
|
model : typing.Optional[str]
|
|
1894
1460
|
|
|
@@ -1911,75 +1477,37 @@ class AsyncSpansClient:
|
|
|
1911
1477
|
|
|
1912
1478
|
Examples
|
|
1913
1479
|
--------
|
|
1914
|
-
import asyncio
|
|
1915
|
-
|
|
1916
1480
|
from Opik import AsyncOpikApi
|
|
1917
|
-
|
|
1918
|
-
client = AsyncOpikApi(
|
|
1919
|
-
api_key="YOUR_API_KEY",
|
|
1920
|
-
workspace_name="YOUR_WORKSPACE_NAME",
|
|
1921
|
-
)
|
|
1922
|
-
|
|
1923
|
-
|
|
1481
|
+
import asyncio
|
|
1482
|
+
client = AsyncOpikApi(api_key="YOUR_API_KEY", workspace_name="YOUR_WORKSPACE_NAME", )
|
|
1924
1483
|
async def main() -> None:
|
|
1925
|
-
await client.spans.update_span(
|
|
1926
|
-
id="id",
|
|
1927
|
-
trace_id="trace_id",
|
|
1928
|
-
)
|
|
1929
|
-
|
|
1930
|
-
|
|
1484
|
+
await client.spans.update_span(id='id', trace_id='trace_id', )
|
|
1931
1485
|
asyncio.run(main())
|
|
1932
1486
|
"""
|
|
1933
|
-
_response = await self.
|
|
1934
|
-
|
|
1935
|
-
|
|
1936
|
-
|
|
1937
|
-
|
|
1938
|
-
|
|
1939
|
-
|
|
1940
|
-
|
|
1941
|
-
|
|
1942
|
-
|
|
1943
|
-
|
|
1944
|
-
|
|
1945
|
-
|
|
1946
|
-
|
|
1947
|
-
|
|
1948
|
-
|
|
1949
|
-
|
|
1950
|
-
|
|
1951
|
-
object_=error_info, annotation=ErrorInfo, direction="write"
|
|
1952
|
-
),
|
|
1953
|
-
},
|
|
1954
|
-
headers={
|
|
1955
|
-
"content-type": "application/json",
|
|
1956
|
-
},
|
|
1487
|
+
_response = await self._raw_client.update_span(
|
|
1488
|
+
id,
|
|
1489
|
+
trace_id=trace_id,
|
|
1490
|
+
project_name=project_name,
|
|
1491
|
+
project_id=project_id,
|
|
1492
|
+
parent_span_id=parent_span_id,
|
|
1493
|
+
name=name,
|
|
1494
|
+
type=type,
|
|
1495
|
+
end_time=end_time,
|
|
1496
|
+
input=input,
|
|
1497
|
+
output=output,
|
|
1498
|
+
metadata=metadata,
|
|
1499
|
+
model=model,
|
|
1500
|
+
provider=provider,
|
|
1501
|
+
tags=tags,
|
|
1502
|
+
usage=usage,
|
|
1503
|
+
total_estimated_cost=total_estimated_cost,
|
|
1504
|
+
error_info=error_info,
|
|
1957
1505
|
request_options=request_options,
|
|
1958
|
-
omit=OMIT,
|
|
1959
1506
|
)
|
|
1960
|
-
|
|
1961
|
-
if 200 <= _response.status_code < 300:
|
|
1962
|
-
return
|
|
1963
|
-
if _response.status_code == 404:
|
|
1964
|
-
raise NotFoundError(
|
|
1965
|
-
typing.cast(
|
|
1966
|
-
typing.Optional[typing.Any],
|
|
1967
|
-
parse_obj_as(
|
|
1968
|
-
type_=typing.Optional[typing.Any], # type: ignore
|
|
1969
|
-
object_=_response.json(),
|
|
1970
|
-
),
|
|
1971
|
-
)
|
|
1972
|
-
)
|
|
1973
|
-
_response_json = _response.json()
|
|
1974
|
-
except JSONDecodeError:
|
|
1975
|
-
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
1976
|
-
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
1507
|
+
return _response.data
|
|
1977
1508
|
|
|
1978
1509
|
async def delete_span_comments(
|
|
1979
|
-
self,
|
|
1980
|
-
*,
|
|
1981
|
-
ids: typing.Sequence[str],
|
|
1982
|
-
request_options: typing.Optional[RequestOptions] = None,
|
|
1510
|
+
self, *, ids: typing.Sequence[str], request_options: typing.Optional[RequestOptions] = None
|
|
1983
1511
|
) -> None:
|
|
1984
1512
|
"""
|
|
1985
1513
|
Delete span comments
|
|
@@ -1997,46 +1525,22 @@ class AsyncSpansClient:
|
|
|
1997
1525
|
|
|
1998
1526
|
Examples
|
|
1999
1527
|
--------
|
|
2000
|
-
import asyncio
|
|
2001
|
-
|
|
2002
1528
|
from Opik import AsyncOpikApi
|
|
2003
|
-
|
|
2004
|
-
client = AsyncOpikApi(
|
|
2005
|
-
api_key="YOUR_API_KEY",
|
|
2006
|
-
workspace_name="YOUR_WORKSPACE_NAME",
|
|
2007
|
-
)
|
|
2008
|
-
|
|
2009
|
-
|
|
1529
|
+
import asyncio
|
|
1530
|
+
client = AsyncOpikApi(api_key="YOUR_API_KEY", workspace_name="YOUR_WORKSPACE_NAME", )
|
|
2010
1531
|
async def main() -> None:
|
|
2011
|
-
await client.spans.delete_span_comments(
|
|
2012
|
-
ids=["ids"],
|
|
2013
|
-
)
|
|
2014
|
-
|
|
2015
|
-
|
|
1532
|
+
await client.spans.delete_span_comments(ids=['ids'], )
|
|
2016
1533
|
asyncio.run(main())
|
|
2017
1534
|
"""
|
|
2018
|
-
_response = await self.
|
|
2019
|
-
|
|
2020
|
-
method="POST",
|
|
2021
|
-
json={
|
|
2022
|
-
"ids": ids,
|
|
2023
|
-
},
|
|
2024
|
-
request_options=request_options,
|
|
2025
|
-
omit=OMIT,
|
|
2026
|
-
)
|
|
2027
|
-
try:
|
|
2028
|
-
if 200 <= _response.status_code < 300:
|
|
2029
|
-
return
|
|
2030
|
-
_response_json = _response.json()
|
|
2031
|
-
except JSONDecodeError:
|
|
2032
|
-
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
2033
|
-
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
1535
|
+
_response = await self._raw_client.delete_span_comments(ids=ids, request_options=request_options)
|
|
1536
|
+
return _response.data
|
|
2034
1537
|
|
|
2035
1538
|
async def delete_span_feedback_score(
|
|
2036
1539
|
self,
|
|
2037
1540
|
id: str,
|
|
2038
1541
|
*,
|
|
2039
1542
|
name: str,
|
|
1543
|
+
author: typing.Optional[str] = OMIT,
|
|
2040
1544
|
request_options: typing.Optional[RequestOptions] = None,
|
|
2041
1545
|
) -> None:
|
|
2042
1546
|
"""
|
|
@@ -2048,6 +1552,8 @@ class AsyncSpansClient:
|
|
|
2048
1552
|
|
|
2049
1553
|
name : str
|
|
2050
1554
|
|
|
1555
|
+
author : typing.Optional[str]
|
|
1556
|
+
|
|
2051
1557
|
request_options : typing.Optional[RequestOptions]
|
|
2052
1558
|
Request-specific configuration.
|
|
2053
1559
|
|
|
@@ -2057,41 +1563,17 @@ class AsyncSpansClient:
|
|
|
2057
1563
|
|
|
2058
1564
|
Examples
|
|
2059
1565
|
--------
|
|
2060
|
-
import asyncio
|
|
2061
|
-
|
|
2062
1566
|
from Opik import AsyncOpikApi
|
|
2063
|
-
|
|
2064
|
-
client = AsyncOpikApi(
|
|
2065
|
-
api_key="YOUR_API_KEY",
|
|
2066
|
-
workspace_name="YOUR_WORKSPACE_NAME",
|
|
2067
|
-
)
|
|
2068
|
-
|
|
2069
|
-
|
|
1567
|
+
import asyncio
|
|
1568
|
+
client = AsyncOpikApi(api_key="YOUR_API_KEY", workspace_name="YOUR_WORKSPACE_NAME", )
|
|
2070
1569
|
async def main() -> None:
|
|
2071
|
-
await client.spans.delete_span_feedback_score(
|
|
2072
|
-
id="id",
|
|
2073
|
-
name="name",
|
|
2074
|
-
)
|
|
2075
|
-
|
|
2076
|
-
|
|
1570
|
+
await client.spans.delete_span_feedback_score(id='id', name='name', )
|
|
2077
1571
|
asyncio.run(main())
|
|
2078
1572
|
"""
|
|
2079
|
-
_response = await self.
|
|
2080
|
-
|
|
2081
|
-
method="POST",
|
|
2082
|
-
json={
|
|
2083
|
-
"name": name,
|
|
2084
|
-
},
|
|
2085
|
-
request_options=request_options,
|
|
2086
|
-
omit=OMIT,
|
|
1573
|
+
_response = await self._raw_client.delete_span_feedback_score(
|
|
1574
|
+
id, name=name, author=author, request_options=request_options
|
|
2087
1575
|
)
|
|
2088
|
-
|
|
2089
|
-
if 200 <= _response.status_code < 300:
|
|
2090
|
-
return
|
|
2091
|
-
_response_json = _response.json()
|
|
2092
|
-
except JSONDecodeError:
|
|
2093
|
-
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
2094
|
-
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
1576
|
+
return _response.data
|
|
2095
1577
|
|
|
2096
1578
|
async def find_feedback_score_names_1(
|
|
2097
1579
|
self,
|
|
@@ -2119,51 +1601,20 @@ class AsyncSpansClient:
|
|
|
2119
1601
|
|
|
2120
1602
|
Examples
|
|
2121
1603
|
--------
|
|
2122
|
-
import asyncio
|
|
2123
|
-
|
|
2124
1604
|
from Opik import AsyncOpikApi
|
|
2125
|
-
|
|
2126
|
-
client = AsyncOpikApi(
|
|
2127
|
-
api_key="YOUR_API_KEY",
|
|
2128
|
-
workspace_name="YOUR_WORKSPACE_NAME",
|
|
2129
|
-
)
|
|
2130
|
-
|
|
2131
|
-
|
|
1605
|
+
import asyncio
|
|
1606
|
+
client = AsyncOpikApi(api_key="YOUR_API_KEY", workspace_name="YOUR_WORKSPACE_NAME", )
|
|
2132
1607
|
async def main() -> None:
|
|
2133
1608
|
await client.spans.find_feedback_score_names_1()
|
|
2134
|
-
|
|
2135
|
-
|
|
2136
1609
|
asyncio.run(main())
|
|
2137
1610
|
"""
|
|
2138
|
-
_response = await self.
|
|
2139
|
-
|
|
2140
|
-
method="GET",
|
|
2141
|
-
params={
|
|
2142
|
-
"project_id": project_id,
|
|
2143
|
-
"type": type,
|
|
2144
|
-
},
|
|
2145
|
-
request_options=request_options,
|
|
1611
|
+
_response = await self._raw_client.find_feedback_score_names_1(
|
|
1612
|
+
project_id=project_id, type=type, request_options=request_options
|
|
2146
1613
|
)
|
|
2147
|
-
|
|
2148
|
-
if 200 <= _response.status_code < 300:
|
|
2149
|
-
return typing.cast(
|
|
2150
|
-
typing.List[str],
|
|
2151
|
-
parse_obj_as(
|
|
2152
|
-
type_=typing.List[str], # type: ignore
|
|
2153
|
-
object_=_response.json(),
|
|
2154
|
-
),
|
|
2155
|
-
)
|
|
2156
|
-
_response_json = _response.json()
|
|
2157
|
-
except JSONDecodeError:
|
|
2158
|
-
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
2159
|
-
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
1614
|
+
return _response.data
|
|
2160
1615
|
|
|
2161
1616
|
async def get_span_comment(
|
|
2162
|
-
self,
|
|
2163
|
-
comment_id: str,
|
|
2164
|
-
span_id: str,
|
|
2165
|
-
*,
|
|
2166
|
-
request_options: typing.Optional[RequestOptions] = None,
|
|
1617
|
+
self, comment_id: str, span_id: str, *, request_options: typing.Optional[RequestOptions] = None
|
|
2167
1618
|
) -> Comment:
|
|
2168
1619
|
"""
|
|
2169
1620
|
Get span comment
|
|
@@ -2184,53 +1635,15 @@ class AsyncSpansClient:
|
|
|
2184
1635
|
|
|
2185
1636
|
Examples
|
|
2186
1637
|
--------
|
|
2187
|
-
import asyncio
|
|
2188
|
-
|
|
2189
1638
|
from Opik import AsyncOpikApi
|
|
2190
|
-
|
|
2191
|
-
client = AsyncOpikApi(
|
|
2192
|
-
api_key="YOUR_API_KEY",
|
|
2193
|
-
workspace_name="YOUR_WORKSPACE_NAME",
|
|
2194
|
-
)
|
|
2195
|
-
|
|
2196
|
-
|
|
1639
|
+
import asyncio
|
|
1640
|
+
client = AsyncOpikApi(api_key="YOUR_API_KEY", workspace_name="YOUR_WORKSPACE_NAME", )
|
|
2197
1641
|
async def main() -> None:
|
|
2198
|
-
await client.spans.get_span_comment(
|
|
2199
|
-
comment_id="commentId",
|
|
2200
|
-
span_id="spanId",
|
|
2201
|
-
)
|
|
2202
|
-
|
|
2203
|
-
|
|
1642
|
+
await client.spans.get_span_comment(comment_id='commentId', span_id='spanId', )
|
|
2204
1643
|
asyncio.run(main())
|
|
2205
1644
|
"""
|
|
2206
|
-
_response = await self.
|
|
2207
|
-
|
|
2208
|
-
method="GET",
|
|
2209
|
-
request_options=request_options,
|
|
2210
|
-
)
|
|
2211
|
-
try:
|
|
2212
|
-
if 200 <= _response.status_code < 300:
|
|
2213
|
-
return typing.cast(
|
|
2214
|
-
Comment,
|
|
2215
|
-
parse_obj_as(
|
|
2216
|
-
type_=Comment, # type: ignore
|
|
2217
|
-
object_=_response.json(),
|
|
2218
|
-
),
|
|
2219
|
-
)
|
|
2220
|
-
if _response.status_code == 404:
|
|
2221
|
-
raise NotFoundError(
|
|
2222
|
-
typing.cast(
|
|
2223
|
-
typing.Optional[typing.Any],
|
|
2224
|
-
parse_obj_as(
|
|
2225
|
-
type_=typing.Optional[typing.Any], # type: ignore
|
|
2226
|
-
object_=_response.json(),
|
|
2227
|
-
),
|
|
2228
|
-
)
|
|
2229
|
-
)
|
|
2230
|
-
_response_json = _response.json()
|
|
2231
|
-
except JSONDecodeError:
|
|
2232
|
-
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
2233
|
-
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
1645
|
+
_response = await self._raw_client.get_span_comment(comment_id, span_id, request_options=request_options)
|
|
1646
|
+
return _response.data
|
|
2234
1647
|
|
|
2235
1648
|
async def get_span_stats(
|
|
2236
1649
|
self,
|
|
@@ -2240,6 +1653,8 @@ class AsyncSpansClient:
|
|
|
2240
1653
|
trace_id: typing.Optional[str] = None,
|
|
2241
1654
|
type: typing.Optional[GetSpanStatsRequestType] = None,
|
|
2242
1655
|
filters: typing.Optional[str] = None,
|
|
1656
|
+
from_time: typing.Optional[dt.datetime] = None,
|
|
1657
|
+
to_time: typing.Optional[dt.datetime] = None,
|
|
2243
1658
|
request_options: typing.Optional[RequestOptions] = None,
|
|
2244
1659
|
) -> ProjectStatsPublic:
|
|
2245
1660
|
"""
|
|
@@ -2257,6 +1672,10 @@ class AsyncSpansClient:
|
|
|
2257
1672
|
|
|
2258
1673
|
filters : typing.Optional[str]
|
|
2259
1674
|
|
|
1675
|
+
from_time : typing.Optional[dt.datetime]
|
|
1676
|
+
|
|
1677
|
+
to_time : typing.Optional[dt.datetime]
|
|
1678
|
+
|
|
2260
1679
|
request_options : typing.Optional[RequestOptions]
|
|
2261
1680
|
Request-specific configuration.
|
|
2262
1681
|
|
|
@@ -2267,47 +1686,24 @@ class AsyncSpansClient:
|
|
|
2267
1686
|
|
|
2268
1687
|
Examples
|
|
2269
1688
|
--------
|
|
2270
|
-
import asyncio
|
|
2271
|
-
|
|
2272
1689
|
from Opik import AsyncOpikApi
|
|
2273
|
-
|
|
2274
|
-
client = AsyncOpikApi(
|
|
2275
|
-
api_key="YOUR_API_KEY",
|
|
2276
|
-
workspace_name="YOUR_WORKSPACE_NAME",
|
|
2277
|
-
)
|
|
2278
|
-
|
|
2279
|
-
|
|
1690
|
+
import asyncio
|
|
1691
|
+
client = AsyncOpikApi(api_key="YOUR_API_KEY", workspace_name="YOUR_WORKSPACE_NAME", )
|
|
2280
1692
|
async def main() -> None:
|
|
2281
1693
|
await client.spans.get_span_stats()
|
|
2282
|
-
|
|
2283
|
-
|
|
2284
1694
|
asyncio.run(main())
|
|
2285
1695
|
"""
|
|
2286
|
-
_response = await self.
|
|
2287
|
-
|
|
2288
|
-
|
|
2289
|
-
|
|
2290
|
-
|
|
2291
|
-
|
|
2292
|
-
|
|
2293
|
-
|
|
2294
|
-
"filters": filters,
|
|
2295
|
-
},
|
|
1696
|
+
_response = await self._raw_client.get_span_stats(
|
|
1697
|
+
project_id=project_id,
|
|
1698
|
+
project_name=project_name,
|
|
1699
|
+
trace_id=trace_id,
|
|
1700
|
+
type=type,
|
|
1701
|
+
filters=filters,
|
|
1702
|
+
from_time=from_time,
|
|
1703
|
+
to_time=to_time,
|
|
2296
1704
|
request_options=request_options,
|
|
2297
1705
|
)
|
|
2298
|
-
|
|
2299
|
-
if 200 <= _response.status_code < 300:
|
|
2300
|
-
return typing.cast(
|
|
2301
|
-
ProjectStatsPublic,
|
|
2302
|
-
parse_obj_as(
|
|
2303
|
-
type_=ProjectStatsPublic, # type: ignore
|
|
2304
|
-
object_=_response.json(),
|
|
2305
|
-
),
|
|
2306
|
-
)
|
|
2307
|
-
_response_json = _response.json()
|
|
2308
|
-
except JSONDecodeError:
|
|
2309
|
-
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
2310
|
-
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
1706
|
+
return _response.data
|
|
2311
1707
|
|
|
2312
1708
|
async def score_batch_of_spans(
|
|
2313
1709
|
self,
|
|
@@ -2331,51 +1727,16 @@ class AsyncSpansClient:
|
|
|
2331
1727
|
|
|
2332
1728
|
Examples
|
|
2333
1729
|
--------
|
|
1730
|
+
from Opik import AsyncOpikApi
|
|
1731
|
+
from Opik import FeedbackScoreBatchItem
|
|
2334
1732
|
import asyncio
|
|
2335
|
-
|
|
2336
|
-
from Opik import AsyncOpikApi, FeedbackScoreBatchItem
|
|
2337
|
-
|
|
2338
|
-
client = AsyncOpikApi(
|
|
2339
|
-
api_key="YOUR_API_KEY",
|
|
2340
|
-
workspace_name="YOUR_WORKSPACE_NAME",
|
|
2341
|
-
)
|
|
2342
|
-
|
|
2343
|
-
|
|
1733
|
+
client = AsyncOpikApi(api_key="YOUR_API_KEY", workspace_name="YOUR_WORKSPACE_NAME", )
|
|
2344
1734
|
async def main() -> None:
|
|
2345
|
-
await client.spans.score_batch_of_spans(
|
|
2346
|
-
scores=[
|
|
2347
|
-
FeedbackScoreBatchItem(
|
|
2348
|
-
id="id",
|
|
2349
|
-
name="name",
|
|
2350
|
-
value=1.1,
|
|
2351
|
-
source="ui",
|
|
2352
|
-
)
|
|
2353
|
-
],
|
|
2354
|
-
)
|
|
2355
|
-
|
|
2356
|
-
|
|
1735
|
+
await client.spans.score_batch_of_spans(scores=[FeedbackScoreBatchItem(name='name', value=1.1, source="ui", id='id', )], )
|
|
2357
1736
|
asyncio.run(main())
|
|
2358
1737
|
"""
|
|
2359
|
-
_response = await self.
|
|
2360
|
-
|
|
2361
|
-
method="PUT",
|
|
2362
|
-
json={
|
|
2363
|
-
"scores": convert_and_respect_annotation_metadata(
|
|
2364
|
-
object_=scores,
|
|
2365
|
-
annotation=typing.Sequence[FeedbackScoreBatchItem],
|
|
2366
|
-
direction="write",
|
|
2367
|
-
),
|
|
2368
|
-
},
|
|
2369
|
-
request_options=request_options,
|
|
2370
|
-
omit=OMIT,
|
|
2371
|
-
)
|
|
2372
|
-
try:
|
|
2373
|
-
if 200 <= _response.status_code < 300:
|
|
2374
|
-
return
|
|
2375
|
-
_response_json = _response.json()
|
|
2376
|
-
except JSONDecodeError:
|
|
2377
|
-
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
2378
|
-
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
1738
|
+
_response = await self._raw_client.score_batch_of_spans(scores=scores, request_options=request_options)
|
|
1739
|
+
return _response.data
|
|
2379
1740
|
|
|
2380
1741
|
async def search_spans(
|
|
2381
1742
|
self,
|
|
@@ -2388,6 +1749,8 @@ class AsyncSpansClient:
|
|
|
2388
1749
|
limit: typing.Optional[int] = OMIT,
|
|
2389
1750
|
last_retrieved_id: typing.Optional[str] = OMIT,
|
|
2390
1751
|
truncate: typing.Optional[bool] = OMIT,
|
|
1752
|
+
from_time: typing.Optional[dt.datetime] = OMIT,
|
|
1753
|
+
to_time: typing.Optional[dt.datetime] = OMIT,
|
|
2391
1754
|
request_options: typing.Optional[RequestOptions] = None,
|
|
2392
1755
|
) -> typing.AsyncIterator[bytes]:
|
|
2393
1756
|
"""
|
|
@@ -2406,68 +1769,42 @@ class AsyncSpansClient:
|
|
|
2406
1769
|
filters : typing.Optional[typing.Sequence[SpanFilterPublic]]
|
|
2407
1770
|
|
|
2408
1771
|
limit : typing.Optional[int]
|
|
1772
|
+
Max number of spans to be streamed
|
|
2409
1773
|
|
|
2410
1774
|
last_retrieved_id : typing.Optional[str]
|
|
2411
1775
|
|
|
2412
1776
|
truncate : typing.Optional[bool]
|
|
2413
1777
|
Truncate image included in either input, output or metadata
|
|
2414
1778
|
|
|
1779
|
+
from_time : typing.Optional[dt.datetime]
|
|
1780
|
+
Filter spans created from this time (ISO-8601 format).
|
|
1781
|
+
|
|
1782
|
+
to_time : typing.Optional[dt.datetime]
|
|
1783
|
+
Filter spans created up to this time (ISO-8601 format). If not provided, defaults to current time. Must be after 'from_time'.
|
|
1784
|
+
|
|
2415
1785
|
request_options : typing.Optional[RequestOptions]
|
|
2416
1786
|
Request-specific configuration. You can pass in configuration such as `chunk_size`, and more to customize the request and response.
|
|
2417
1787
|
|
|
2418
|
-
|
|
2419
|
-
|
|
1788
|
+
Returns
|
|
1789
|
+
-------
|
|
2420
1790
|
typing.AsyncIterator[bytes]
|
|
2421
1791
|
Spans stream or error during process
|
|
2422
1792
|
"""
|
|
2423
|
-
async with self.
|
|
2424
|
-
|
|
2425
|
-
|
|
2426
|
-
|
|
2427
|
-
|
|
2428
|
-
|
|
2429
|
-
|
|
2430
|
-
|
|
2431
|
-
|
|
2432
|
-
|
|
2433
|
-
|
|
2434
|
-
direction="write",
|
|
2435
|
-
),
|
|
2436
|
-
"limit": limit,
|
|
2437
|
-
"last_retrieved_id": last_retrieved_id,
|
|
2438
|
-
"truncate": truncate,
|
|
2439
|
-
},
|
|
2440
|
-
headers={
|
|
2441
|
-
"content-type": "application/json",
|
|
2442
|
-
},
|
|
1793
|
+
async with self._raw_client.search_spans(
|
|
1794
|
+
trace_id=trace_id,
|
|
1795
|
+
project_name=project_name,
|
|
1796
|
+
project_id=project_id,
|
|
1797
|
+
type=type,
|
|
1798
|
+
filters=filters,
|
|
1799
|
+
limit=limit,
|
|
1800
|
+
last_retrieved_id=last_retrieved_id,
|
|
1801
|
+
truncate=truncate,
|
|
1802
|
+
from_time=from_time,
|
|
1803
|
+
to_time=to_time,
|
|
2443
1804
|
request_options=request_options,
|
|
2444
|
-
|
|
2445
|
-
|
|
2446
|
-
|
|
2447
|
-
if 200 <= _response.status_code < 300:
|
|
2448
|
-
_chunk_size = (
|
|
2449
|
-
request_options.get("chunk_size", None)
|
|
2450
|
-
if request_options is not None
|
|
2451
|
-
else None
|
|
2452
|
-
)
|
|
2453
|
-
async for _chunk in _response.aiter_bytes(chunk_size=_chunk_size):
|
|
2454
|
-
yield _chunk
|
|
2455
|
-
return
|
|
2456
|
-
await _response.aread()
|
|
2457
|
-
if _response.status_code == 400:
|
|
2458
|
-
raise BadRequestError(
|
|
2459
|
-
typing.cast(
|
|
2460
|
-
typing.Optional[typing.Any],
|
|
2461
|
-
parse_obj_as(
|
|
2462
|
-
type_=typing.Optional[typing.Any], # type: ignore
|
|
2463
|
-
object_=_response.json(),
|
|
2464
|
-
),
|
|
2465
|
-
)
|
|
2466
|
-
)
|
|
2467
|
-
_response_json = _response.json()
|
|
2468
|
-
except JSONDecodeError:
|
|
2469
|
-
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
2470
|
-
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
1805
|
+
) as r:
|
|
1806
|
+
async for data in r.data:
|
|
1807
|
+
yield data
|
|
2471
1808
|
|
|
2472
1809
|
async def update_span_comment(
|
|
2473
1810
|
self,
|
|
@@ -2509,53 +1846,21 @@ class AsyncSpansClient:
|
|
|
2509
1846
|
|
|
2510
1847
|
Examples
|
|
2511
1848
|
--------
|
|
2512
|
-
import asyncio
|
|
2513
|
-
|
|
2514
1849
|
from Opik import AsyncOpikApi
|
|
2515
|
-
|
|
2516
|
-
client = AsyncOpikApi(
|
|
2517
|
-
api_key="YOUR_API_KEY",
|
|
2518
|
-
workspace_name="YOUR_WORKSPACE_NAME",
|
|
2519
|
-
)
|
|
2520
|
-
|
|
2521
|
-
|
|
1850
|
+
import asyncio
|
|
1851
|
+
client = AsyncOpikApi(api_key="YOUR_API_KEY", workspace_name="YOUR_WORKSPACE_NAME", )
|
|
2522
1852
|
async def main() -> None:
|
|
2523
|
-
await client.spans.update_span_comment(
|
|
2524
|
-
comment_id="commentId",
|
|
2525
|
-
text="text",
|
|
2526
|
-
)
|
|
2527
|
-
|
|
2528
|
-
|
|
1853
|
+
await client.spans.update_span_comment(comment_id='commentId', text='text', )
|
|
2529
1854
|
asyncio.run(main())
|
|
2530
1855
|
"""
|
|
2531
|
-
_response = await self.
|
|
2532
|
-
|
|
2533
|
-
|
|
2534
|
-
|
|
2535
|
-
|
|
2536
|
-
|
|
2537
|
-
|
|
2538
|
-
|
|
2539
|
-
"created_by": created_by,
|
|
2540
|
-
"last_updated_by": last_updated_by,
|
|
2541
|
-
},
|
|
1856
|
+
_response = await self._raw_client.update_span_comment(
|
|
1857
|
+
comment_id,
|
|
1858
|
+
text=text,
|
|
1859
|
+
id=id,
|
|
1860
|
+
created_at=created_at,
|
|
1861
|
+
last_updated_at=last_updated_at,
|
|
1862
|
+
created_by=created_by,
|
|
1863
|
+
last_updated_by=last_updated_by,
|
|
2542
1864
|
request_options=request_options,
|
|
2543
|
-
omit=OMIT,
|
|
2544
1865
|
)
|
|
2545
|
-
|
|
2546
|
-
if 200 <= _response.status_code < 300:
|
|
2547
|
-
return
|
|
2548
|
-
if _response.status_code == 404:
|
|
2549
|
-
raise NotFoundError(
|
|
2550
|
-
typing.cast(
|
|
2551
|
-
typing.Optional[typing.Any],
|
|
2552
|
-
parse_obj_as(
|
|
2553
|
-
type_=typing.Optional[typing.Any], # type: ignore
|
|
2554
|
-
object_=_response.json(),
|
|
2555
|
-
),
|
|
2556
|
-
)
|
|
2557
|
-
)
|
|
2558
|
-
_response_json = _response.json()
|
|
2559
|
-
except JSONDecodeError:
|
|
2560
|
-
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
2561
|
-
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
1866
|
+
return _response.data
|