opik 1.8.39__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 +19 -3
- opik/anonymizer/__init__.py +5 -0
- opik/anonymizer/anonymizer.py +12 -0
- opik/anonymizer/factory.py +80 -0
- opik/anonymizer/recursive_anonymizer.py +64 -0
- opik/anonymizer/rules.py +56 -0
- opik/anonymizer/rules_anonymizer.py +35 -0
- opik/api_objects/attachment/attachment_context.py +36 -0
- opik/api_objects/attachment/attachments_extractor.py +153 -0
- opik/api_objects/attachment/client.py +1 -0
- opik/api_objects/attachment/converters.py +2 -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/data_helpers.py +79 -0
- opik/api_objects/dataset/dataset.py +64 -4
- opik/api_objects/dataset/rest_operations.py +11 -2
- opik/api_objects/experiment/experiment.py +57 -57
- 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 +65 -5
- opik/api_objects/helpers.py +8 -5
- opik/api_objects/local_recording.py +81 -0
- opik/api_objects/opik_client.py +600 -108
- opik/api_objects/opik_query_language.py +39 -5
- opik/api_objects/prompt/__init__.py +12 -2
- 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 +189 -47
- opik/api_objects/prompt/text/__init__.py +1 -0
- opik/api_objects/prompt/text/prompt.py +174 -0
- opik/api_objects/prompt/{prompt_template.py → text/prompt_template.py} +10 -6
- opik/api_objects/prompt/types.py +23 -0
- opik/api_objects/search_helpers.py +89 -0
- opik/api_objects/span/span_data.py +35 -25
- opik/api_objects/threads/threads_client.py +39 -5
- opik/api_objects/trace/trace_client.py +52 -2
- opik/api_objects/trace/trace_data.py +15 -24
- 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 +13 -7
- opik/configurator/configure.py +17 -0
- opik/datetime_helpers.py +12 -0
- opik/decorator/arguments_helpers.py +9 -1
- opik/decorator/base_track_decorator.py +205 -133
- opik/decorator/context_manager/span_context_manager.py +123 -0
- opik/decorator/context_manager/trace_context_manager.py +84 -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 +25 -6
- opik/dict_utils.py +3 -3
- opik/evaluation/__init__.py +13 -2
- opik/evaluation/engine/engine.py +272 -75
- opik/evaluation/engine/evaluation_tasks_executor.py +6 -3
- opik/evaluation/engine/helpers.py +31 -6
- opik/evaluation/engine/metrics_evaluator.py +237 -0
- opik/evaluation/evaluation_result.py +168 -2
- opik/evaluation/evaluator.py +533 -62
- opik/evaluation/metrics/__init__.py +103 -4
- opik/evaluation/metrics/aggregated_metric.py +35 -6
- opik/evaluation/metrics/base_metric.py +1 -1
- opik/evaluation/metrics/conversation/__init__.py +48 -0
- opik/evaluation/metrics/conversation/conversation_thread_metric.py +56 -2
- opik/evaluation/metrics/conversation/g_eval_wrappers.py +19 -0
- opik/evaluation/metrics/conversation/helpers.py +14 -15
- 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/{conversational_coherence → llm_judges/conversational_coherence}/metric.py +22 -17
- opik/evaluation/metrics/conversation/{conversational_coherence → llm_judges/conversational_coherence}/templates.py +1 -1
- opik/evaluation/metrics/conversation/llm_judges/g_eval_wrappers.py +442 -0
- opik/evaluation/metrics/conversation/{session_completeness → llm_judges/session_completeness}/metric.py +13 -7
- opik/evaluation/metrics/conversation/{session_completeness → llm_judges/session_completeness}/templates.py +1 -1
- opik/evaluation/metrics/conversation/llm_judges/user_frustration/__init__.py +0 -0
- opik/evaluation/metrics/conversation/{user_frustration → llm_judges/user_frustration}/metric.py +21 -14
- opik/evaluation/metrics/conversation/{user_frustration → llm_judges/user_frustration}/templates.py +1 -1
- opik/evaluation/metrics/conversation/types.py +4 -5
- opik/evaluation/metrics/conversation_types.py +9 -0
- opik/evaluation/metrics/heuristics/bertscore.py +107 -0
- opik/evaluation/metrics/heuristics/bleu.py +35 -15
- opik/evaluation/metrics/heuristics/chrf.py +127 -0
- opik/evaluation/metrics/heuristics/contains.py +47 -11
- opik/evaluation/metrics/heuristics/distribution_metrics.py +331 -0
- opik/evaluation/metrics/heuristics/gleu.py +113 -0
- opik/evaluation/metrics/heuristics/language_adherence.py +123 -0
- 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/rouge.py +26 -9
- 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 +20 -5
- opik/evaluation/metrics/llm_judges/context_precision/metric.py +20 -6
- opik/evaluation/metrics/llm_judges/context_recall/metric.py +20 -6
- opik/evaluation/metrics/llm_judges/g_eval/__init__.py +5 -0
- opik/evaluation/metrics/llm_judges/g_eval/metric.py +219 -68
- opik/evaluation/metrics/llm_judges/g_eval/parser.py +102 -52
- 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 +16 -3
- 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 +16 -4
- 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/metric.py +20 -5
- opik/evaluation/metrics/llm_judges/usefulness/metric.py +16 -4
- opik/evaluation/metrics/ragas_metric.py +43 -23
- opik/evaluation/models/__init__.py +8 -0
- opik/evaluation/models/base_model.py +107 -1
- opik/evaluation/models/langchain/langchain_chat_model.py +15 -7
- opik/evaluation/models/langchain/message_converters.py +97 -15
- opik/evaluation/models/litellm/litellm_chat_model.py +156 -29
- 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/evaluator.py +31 -3
- opik/evaluation/threads/helpers.py +3 -2
- opik/evaluation/types.py +9 -1
- opik/exceptions.py +33 -0
- opik/file_upload/file_uploader.py +13 -0
- opik/file_upload/upload_options.py +2 -0
- 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 +12 -9
- opik/id_helpers.py +18 -0
- opik/integrations/adk/graph/subgraph_edges_builders.py +1 -2
- opik/integrations/adk/helpers.py +16 -7
- opik/integrations/adk/legacy_opik_tracer.py +7 -4
- opik/integrations/adk/opik_tracer.py +14 -1
- opik/integrations/adk/patchers/adk_otel_tracer/opik_adk_otel_tracer.py +7 -3
- opik/integrations/adk/recursive_callback_injector.py +4 -7
- 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} +4 -3
- opik/integrations/bedrock/invoke_agent_decorator.py +5 -4
- 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 +42 -4
- opik/integrations/bedrock/types.py +19 -0
- opik/integrations/crewai/crewai_decorator.py +8 -51
- 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 +80 -17
- opik/integrations/dspy/parsers.py +168 -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/opik_connector.py +2 -2
- opik/integrations/haystack/opik_tracer.py +3 -7
- 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 +1 -1
- opik/integrations/langchain/opik_tracer.py +474 -229
- 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 +146 -107
- opik/integrations/openai/agents/opik_tracing_processor.py +1 -2
- opik/integrations/openai/openai_chat_completions_decorator.py +2 -16
- opik/integrations/openai/opik_tracker.py +1 -1
- opik/integrations/sagemaker/auth.py +5 -1
- opik/llm_usage/google_usage.py +3 -1
- opik/llm_usage/opik_usage.py +7 -8
- opik/llm_usage/opik_usage_factory.py +4 -2
- opik/logging_messages.py +6 -0
- opik/message_processing/batching/base_batcher.py +14 -21
- opik/message_processing/batching/batch_manager.py +22 -10
- opik/message_processing/batching/batch_manager_constuctors.py +10 -0
- opik/message_processing/batching/batchers.py +59 -27
- opik/message_processing/batching/flushing_thread.py +0 -3
- 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/messages.py +56 -1
- 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/{message_processors.py → processors/online_message_processor.py} +85 -29
- opik/message_processing/queue_consumer.py +9 -3
- opik/message_processing/streamer.py +71 -33
- opik/message_processing/streamer_constructors.py +43 -10
- opik/opik_context.py +16 -4
- opik/plugins/pytest/hooks.py +5 -3
- opik/rest_api/__init__.py +346 -15
- 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/automation_rule_evaluators/client.py +34 -2
- opik/rest_api/automation_rule_evaluators/raw_client.py +24 -0
- opik/rest_api/client.py +15 -0
- opik/rest_api/dashboards/__init__.py +4 -0
- opik/rest_api/dashboards/client.py +462 -0
- opik/rest_api/dashboards/raw_client.py +648 -0
- opik/rest_api/datasets/client.py +1310 -44
- opik/rest_api/datasets/raw_client.py +2269 -358
- opik/rest_api/experiments/__init__.py +2 -2
- opik/rest_api/experiments/client.py +191 -5
- opik/rest_api/experiments/raw_client.py +301 -7
- opik/rest_api/experiments/types/__init__.py +4 -1
- 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/feedback_definitions/types/find_feedback_definitions_request_type.py +1 -1
- opik/rest_api/llm_provider_key/client.py +20 -0
- opik/rest_api/llm_provider_key/raw_client.py +20 -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/optimizations/client.py +145 -9
- opik/rest_api/optimizations/raw_client.py +237 -13
- opik/rest_api/optimizations/types/optimization_update_status.py +3 -1
- opik/rest_api/prompts/__init__.py +2 -2
- opik/rest_api/prompts/client.py +227 -6
- opik/rest_api/prompts/raw_client.py +331 -2
- opik/rest_api/prompts/types/__init__.py +3 -1
- opik/rest_api/prompts/types/create_prompt_version_detail_template_structure.py +5 -0
- opik/rest_api/prompts/types/prompt_write_template_structure.py +5 -0
- opik/rest_api/spans/__init__.py +0 -2
- opik/rest_api/spans/client.py +238 -76
- opik/rest_api/spans/raw_client.py +307 -95
- opik/rest_api/spans/types/__init__.py +0 -2
- opik/rest_api/traces/client.py +572 -161
- opik/rest_api/traces/raw_client.py +736 -229
- opik/rest_api/types/__init__.py +352 -17
- opik/rest_api/types/aggregation_data.py +1 -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/annotation_queue_item_ids.py +19 -0
- 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/annotation_queue_reviewer.py +20 -0
- 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/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 +62 -2
- opik/rest_api/types/automation_rule_evaluator_llm_as_judge.py +2 -0
- opik/rest_api/types/automation_rule_evaluator_llm_as_judge_public.py +2 -0
- opik/rest_api/types/automation_rule_evaluator_llm_as_judge_write.py +2 -0
- opik/rest_api/types/automation_rule_evaluator_object_object_public.py +155 -0
- opik/rest_api/types/automation_rule_evaluator_page_public.py +3 -2
- opik/rest_api/types/automation_rule_evaluator_public.py +57 -2
- 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 +2 -0
- opik/rest_api/types/automation_rule_evaluator_trace_thread_llm_as_judge_public.py +2 -0
- opik/rest_api/types/automation_rule_evaluator_trace_thread_llm_as_judge_write.py +2 -0
- opik/rest_api/types/automation_rule_evaluator_trace_thread_user_defined_metric_python.py +2 -0
- opik/rest_api/types/automation_rule_evaluator_trace_thread_user_defined_metric_python_public.py +2 -0
- opik/rest_api/types/automation_rule_evaluator_trace_thread_user_defined_metric_python_write.py +2 -0
- opik/rest_api/types/automation_rule_evaluator_update.py +51 -1
- opik/rest_api/types/automation_rule_evaluator_update_llm_as_judge.py +2 -0
- opik/rest_api/types/automation_rule_evaluator_update_span_llm_as_judge.py +22 -0
- opik/rest_api/types/automation_rule_evaluator_update_span_user_defined_metric_python.py +22 -0
- opik/rest_api/types/automation_rule_evaluator_update_trace_thread_llm_as_judge.py +2 -0
- opik/rest_api/types/automation_rule_evaluator_update_trace_thread_user_defined_metric_python.py +2 -0
- opik/rest_api/types/automation_rule_evaluator_update_user_defined_metric_python.py +2 -0
- opik/rest_api/types/automation_rule_evaluator_user_defined_metric_python.py +2 -0
- opik/rest_api/types/automation_rule_evaluator_user_defined_metric_python_public.py +2 -0
- opik/rest_api/types/automation_rule_evaluator_user_defined_metric_python_write.py +2 -0
- opik/rest_api/types/automation_rule_evaluator_write.py +51 -1
- opik/rest_api/types/boolean_feedback_definition.py +25 -0
- opik/rest_api/types/boolean_feedback_definition_create.py +20 -0
- opik/rest_api/types/boolean_feedback_definition_public.py +25 -0
- opik/rest_api/types/boolean_feedback_definition_update.py +20 -0
- opik/rest_api/types/boolean_feedback_detail.py +29 -0
- opik/rest_api/types/boolean_feedback_detail_create.py +29 -0
- opik/rest_api/types/boolean_feedback_detail_public.py +29 -0
- opik/rest_api/types/boolean_feedback_detail_update.py +29 -0
- opik/rest_api/types/dashboard_page_public.py +24 -0
- opik/rest_api/types/dashboard_public.py +30 -0
- opik/rest_api/types/dataset.py +4 -0
- 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 +2 -0
- opik/rest_api/types/dataset_item_changes_public.py +5 -0
- opik/rest_api/types/dataset_item_compare.py +2 -0
- 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 +5 -0
- opik/rest_api/types/dataset_item_page_public.py +5 -0
- opik/rest_api/types/dataset_item_public.py +2 -0
- opik/rest_api/types/dataset_item_update.py +39 -0
- opik/rest_api/types/dataset_item_write.py +1 -0
- opik/rest_api/types/dataset_public.py +4 -0
- opik/rest_api/types/dataset_public_status.py +5 -0
- opik/rest_api/types/dataset_status.py +5 -0
- opik/rest_api/types/dataset_version_diff.py +22 -0
- opik/rest_api/types/dataset_version_diff_stats.py +24 -0
- opik/rest_api/types/dataset_version_page_public.py +23 -0
- opik/rest_api/types/dataset_version_public.py +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/experiment.py +7 -2
- opik/rest_api/types/experiment_group_response.py +2 -0
- opik/rest_api/types/experiment_public.py +7 -2
- opik/rest_api/types/experiment_public_status.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/feedback.py +25 -1
- opik/rest_api/types/feedback_create.py +20 -1
- opik/rest_api/types/feedback_object_public.py +27 -1
- opik/rest_api/types/feedback_public.py +25 -1
- opik/rest_api/types/feedback_score_batch_item.py +2 -1
- opik/rest_api/types/feedback_score_batch_item_thread.py +2 -1
- opik/rest_api/types/feedback_score_public.py +4 -0
- opik/rest_api/types/feedback_update.py +20 -1
- opik/rest_api/types/group_content_with_aggregations.py +1 -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 +1 -0
- opik/rest_api/types/guardrail_write.py +1 -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/llm_as_judge_message.py +5 -1
- 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 +5 -1
- opik/rest_api/types/llm_as_judge_message_write.py +5 -1
- opik/rest_api/types/llm_as_judge_model_parameters.py +3 -0
- opik/rest_api/types/llm_as_judge_model_parameters_public.py +3 -0
- opik/rest_api/types/llm_as_judge_model_parameters_write.py +3 -0
- 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/optimization.py +4 -2
- opik/rest_api/types/optimization_public.py +4 -2
- opik/rest_api/types/optimization_public_status.py +3 -1
- opik/rest_api/types/optimization_status.py +3 -1
- opik/rest_api/types/optimization_studio_config.py +27 -0
- opik/rest_api/types/optimization_studio_config_public.py +27 -0
- opik/rest_api/types/optimization_studio_config_write.py +27 -0
- opik/rest_api/types/optimization_studio_log.py +22 -0
- opik/rest_api/types/optimization_write.py +4 -2
- opik/rest_api/types/optimization_write_status.py +3 -1
- opik/rest_api/types/project.py +1 -0
- opik/rest_api/types/project_detailed.py +1 -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_stats_summary_item.py +1 -0
- opik/rest_api/types/prompt.py +6 -0
- opik/rest_api/types/prompt_detail.py +6 -0
- opik/rest_api/types/prompt_detail_template_structure.py +5 -0
- opik/rest_api/types/prompt_public.py +6 -0
- opik/rest_api/types/prompt_public_template_structure.py +5 -0
- opik/rest_api/types/prompt_template_structure.py +5 -0
- opik/rest_api/types/prompt_version.py +3 -0
- opik/rest_api/types/prompt_version_detail.py +3 -0
- opik/rest_api/types/prompt_version_detail_template_structure.py +5 -0
- opik/rest_api/types/prompt_version_link.py +1 -0
- opik/rest_api/types/prompt_version_link_public.py +1 -0
- opik/rest_api/types/prompt_version_page_public.py +5 -0
- opik/rest_api/types/prompt_version_public.py +3 -0
- opik/rest_api/types/prompt_version_public_template_structure.py +5 -0
- opik/rest_api/types/prompt_version_template_structure.py +5 -0
- opik/rest_api/types/prompt_version_update.py +33 -0
- opik/rest_api/types/provider_api_key.py +9 -0
- opik/rest_api/types/provider_api_key_provider.py +1 -1
- opik/rest_api/types/provider_api_key_public.py +9 -0
- opik/rest_api/types/provider_api_key_public_provider.py +1 -1
- opik/rest_api/types/score_name.py +1 -0
- opik/rest_api/types/service_toggles_config.py +18 -0
- opik/rest_api/types/span.py +1 -2
- opik/rest_api/types/span_enrichment_options.py +31 -0
- opik/rest_api/types/span_experiment_item_bulk_write_view.py +1 -2
- opik/rest_api/types/span_filter.py +23 -0
- opik/rest_api/types/span_filter_operator.py +21 -0
- opik/rest_api/types/span_filter_write.py +23 -0
- opik/rest_api/types/span_filter_write_operator.py +21 -0
- opik/rest_api/types/span_llm_as_judge_code.py +27 -0
- opik/rest_api/types/span_llm_as_judge_code_public.py +27 -0
- opik/rest_api/types/span_llm_as_judge_code_write.py +27 -0
- opik/rest_api/types/span_public.py +1 -2
- opik/rest_api/types/span_update.py +46 -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 +1 -2
- opik/rest_api/types/studio_evaluation.py +20 -0
- opik/rest_api/types/studio_evaluation_public.py +20 -0
- opik/rest_api/types/studio_evaluation_write.py +20 -0
- opik/rest_api/types/studio_llm_model.py +21 -0
- opik/rest_api/types/studio_llm_model_public.py +21 -0
- opik/rest_api/types/studio_llm_model_write.py +21 -0
- opik/rest_api/types/studio_message.py +20 -0
- opik/rest_api/types/studio_message_public.py +20 -0
- opik/rest_api/types/studio_message_write.py +20 -0
- opik/rest_api/types/studio_metric.py +21 -0
- opik/rest_api/types/studio_metric_public.py +21 -0
- opik/rest_api/types/studio_metric_write.py +21 -0
- opik/rest_api/types/studio_optimizer.py +21 -0
- opik/rest_api/types/studio_optimizer_public.py +21 -0
- opik/rest_api/types/studio_optimizer_write.py +21 -0
- opik/rest_api/types/studio_prompt.py +20 -0
- opik/rest_api/types/studio_prompt_public.py +20 -0
- opik/rest_api/types/studio_prompt_write.py +20 -0
- opik/rest_api/types/trace.py +11 -2
- opik/rest_api/types/trace_enrichment_options.py +32 -0
- opik/rest_api/types/trace_experiment_item_bulk_write_view.py +1 -2
- 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_write.py +23 -0
- opik/rest_api/types/trace_filter_write_operator.py +21 -0
- opik/rest_api/types/trace_public.py +11 -2
- 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 +1 -0
- opik/rest_api/types/trace_update.py +39 -0
- opik/rest_api/types/trace_write.py +1 -2
- opik/rest_api/types/value_entry.py +2 -0
- opik/rest_api/types/value_entry_compare.py +2 -0
- opik/rest_api/types/value_entry_experiment_item_bulk_write_view.py +2 -0
- opik/rest_api/types/value_entry_public.py +2 -0
- opik/rest_api/types/video_url.py +19 -0
- opik/rest_api/types/video_url_public.py +19 -0
- opik/rest_api/types/video_url_write.py +19 -0
- opik/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 +5 -0
- 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/client.py +14 -2
- opik/rest_api/workspaces/raw_client.py +10 -0
- opik/s3_httpx_client.py +14 -1
- opik/simulation/__init__.py +6 -0
- opik/simulation/simulated_user.py +99 -0
- opik/simulation/simulator.py +108 -0
- opik/synchronization.py +5 -6
- opik/{decorator/tracing_runtime_config.py → tracing_runtime_config.py} +6 -7
- opik/types.py +36 -0
- opik/validation/chat_prompt_messages.py +241 -0
- opik/validation/feedback_score.py +3 -3
- opik/validation/validator.py +28 -0
- opik-1.9.71.dist-info/METADATA +370 -0
- opik-1.9.71.dist-info/RECORD +1110 -0
- opik/api_objects/prompt/prompt.py +0 -112
- opik/cli.py +0 -193
- opik/hooks.py +0 -13
- opik/integrations/bedrock/chunks_aggregator.py +0 -55
- opik/integrations/bedrock/helpers.py +0 -8
- opik/rest_api/types/automation_rule_evaluator_object_public.py +0 -100
- opik/rest_api/types/json_node_experiment_item_bulk_write_view.py +0 -5
- opik-1.8.39.dist-info/METADATA +0 -339
- opik-1.8.39.dist-info/RECORD +0 -790
- /opik/{evaluation/metrics/conversation/conversational_coherence → decorator/context_manager}/__init__.py +0 -0
- /opik/evaluation/metrics/conversation/{session_completeness → llm_judges/conversational_coherence}/__init__.py +0 -0
- /opik/evaluation/metrics/conversation/{conversational_coherence → llm_judges/conversational_coherence}/schema.py +0 -0
- /opik/evaluation/metrics/conversation/{user_frustration → llm_judges/session_completeness}/__init__.py +0 -0
- /opik/evaluation/metrics/conversation/{session_completeness → llm_judges/session_completeness}/schema.py +0 -0
- /opik/evaluation/metrics/conversation/{user_frustration → llm_judges/user_frustration}/schema.py +0 -0
- /opik/integrations/bedrock/{stream_wrappers.py → converse/stream_wrappers.py} +0 -0
- /opik/rest_api/{spans/types → types}/span_update_type.py +0 -0
- {opik-1.8.39.dist-info → opik-1.9.71.dist-info}/WHEEL +0 -0
- {opik-1.8.39.dist-info → opik-1.9.71.dist-info}/entry_points.txt +0 -0
- {opik-1.8.39.dist-info → opik-1.9.71.dist-info}/licenses/LICENSE +0 -0
- {opik-1.8.39.dist-info → opik-1.9.71.dist-info}/top_level.txt +0 -0
opik/rest_api/traces/client.py
CHANGED
|
@@ -13,8 +13,6 @@ from ..types.feedback_score_batch_item_thread import FeedbackScoreBatchItemThrea
|
|
|
13
13
|
from ..types.feedback_score_source import FeedbackScoreSource
|
|
14
14
|
from ..types.json_list_string import JsonListString
|
|
15
15
|
from ..types.json_list_string_write import JsonListStringWrite
|
|
16
|
-
from ..types.json_node import JsonNode
|
|
17
|
-
from ..types.json_node_write import JsonNodeWrite
|
|
18
16
|
from ..types.project_stats_public import ProjectStatsPublic
|
|
19
17
|
from ..types.trace_filter_public import TraceFilterPublic
|
|
20
18
|
from ..types.trace_page_public import TracePagePublic
|
|
@@ -22,6 +20,8 @@ from ..types.trace_public import TracePublic
|
|
|
22
20
|
from ..types.trace_thread import TraceThread
|
|
23
21
|
from ..types.trace_thread_filter import TraceThreadFilter
|
|
24
22
|
from ..types.trace_thread_page import TraceThreadPage
|
|
23
|
+
from ..types.trace_thread_update import TraceThreadUpdate
|
|
24
|
+
from ..types.trace_update import TraceUpdate
|
|
25
25
|
from ..types.trace_write import TraceWrite
|
|
26
26
|
from ..types.value_entry import ValueEntry
|
|
27
27
|
from .raw_client import AsyncRawTracesClient, RawTracesClient
|
|
@@ -229,25 +229,136 @@ class TracesClient:
|
|
|
229
229
|
)
|
|
230
230
|
return _response.data
|
|
231
231
|
|
|
232
|
+
def create_traces(
|
|
233
|
+
self, *, traces: typing.Sequence[TraceWrite], request_options: typing.Optional[RequestOptions] = None
|
|
234
|
+
) -> None:
|
|
235
|
+
"""
|
|
236
|
+
Create traces
|
|
237
|
+
|
|
238
|
+
Parameters
|
|
239
|
+
----------
|
|
240
|
+
traces : typing.Sequence[TraceWrite]
|
|
241
|
+
|
|
242
|
+
request_options : typing.Optional[RequestOptions]
|
|
243
|
+
Request-specific configuration.
|
|
244
|
+
|
|
245
|
+
Returns
|
|
246
|
+
-------
|
|
247
|
+
None
|
|
248
|
+
|
|
249
|
+
Examples
|
|
250
|
+
--------
|
|
251
|
+
from Opik import OpikApi
|
|
252
|
+
from Opik import TraceWrite
|
|
253
|
+
import datetime
|
|
254
|
+
client = OpikApi(api_key="YOUR_API_KEY", workspace_name="YOUR_WORKSPACE_NAME", )
|
|
255
|
+
client.traces.create_traces(traces=[TraceWrite(start_time=datetime.datetime.fromisoformat("2024-01-15 09:30:00+00:00", ), )], )
|
|
256
|
+
"""
|
|
257
|
+
_response = self._raw_client.create_traces(traces=traces, request_options=request_options)
|
|
258
|
+
return _response.data
|
|
259
|
+
|
|
260
|
+
def batch_update_traces(
|
|
261
|
+
self,
|
|
262
|
+
*,
|
|
263
|
+
ids: typing.Sequence[str],
|
|
264
|
+
update: TraceUpdate,
|
|
265
|
+
merge_tags: typing.Optional[bool] = OMIT,
|
|
266
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
267
|
+
) -> None:
|
|
268
|
+
"""
|
|
269
|
+
Update multiple traces
|
|
270
|
+
|
|
271
|
+
Parameters
|
|
272
|
+
----------
|
|
273
|
+
ids : typing.Sequence[str]
|
|
274
|
+
List of trace IDs to update (max 1000)
|
|
275
|
+
|
|
276
|
+
update : TraceUpdate
|
|
277
|
+
|
|
278
|
+
merge_tags : typing.Optional[bool]
|
|
279
|
+
If true, merge tags with existing tags instead of replacing them. Default: false
|
|
280
|
+
|
|
281
|
+
request_options : typing.Optional[RequestOptions]
|
|
282
|
+
Request-specific configuration.
|
|
283
|
+
|
|
284
|
+
Returns
|
|
285
|
+
-------
|
|
286
|
+
None
|
|
287
|
+
|
|
288
|
+
Examples
|
|
289
|
+
--------
|
|
290
|
+
from Opik import OpikApi
|
|
291
|
+
from Opik import TraceUpdate
|
|
292
|
+
client = OpikApi(api_key="YOUR_API_KEY", workspace_name="YOUR_WORKSPACE_NAME", )
|
|
293
|
+
client.traces.batch_update_traces(ids=['ids'], update=TraceUpdate(), )
|
|
294
|
+
"""
|
|
295
|
+
_response = self._raw_client.batch_update_traces(
|
|
296
|
+
ids=ids, update=update, merge_tags=merge_tags, request_options=request_options
|
|
297
|
+
)
|
|
298
|
+
return _response.data
|
|
299
|
+
|
|
300
|
+
def batch_update_threads(
|
|
301
|
+
self,
|
|
302
|
+
*,
|
|
303
|
+
ids: typing.Sequence[str],
|
|
304
|
+
update: TraceThreadUpdate,
|
|
305
|
+
merge_tags: typing.Optional[bool] = OMIT,
|
|
306
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
307
|
+
) -> None:
|
|
308
|
+
"""
|
|
309
|
+
Update multiple threads
|
|
310
|
+
|
|
311
|
+
Parameters
|
|
312
|
+
----------
|
|
313
|
+
ids : typing.Sequence[str]
|
|
314
|
+
List of thread model IDs to update (max 1000)
|
|
315
|
+
|
|
316
|
+
update : TraceThreadUpdate
|
|
317
|
+
|
|
318
|
+
merge_tags : typing.Optional[bool]
|
|
319
|
+
If true, merge tags with existing tags instead of replacing them. Default: false
|
|
320
|
+
|
|
321
|
+
request_options : typing.Optional[RequestOptions]
|
|
322
|
+
Request-specific configuration.
|
|
323
|
+
|
|
324
|
+
Returns
|
|
325
|
+
-------
|
|
326
|
+
None
|
|
327
|
+
|
|
328
|
+
Examples
|
|
329
|
+
--------
|
|
330
|
+
from Opik import OpikApi
|
|
331
|
+
from Opik import TraceThreadUpdate
|
|
332
|
+
client = OpikApi(api_key="YOUR_API_KEY", workspace_name="YOUR_WORKSPACE_NAME", )
|
|
333
|
+
client.traces.batch_update_threads(ids=['ids'], update=TraceThreadUpdate(), )
|
|
334
|
+
"""
|
|
335
|
+
_response = self._raw_client.batch_update_threads(
|
|
336
|
+
ids=ids, update=update, merge_tags=merge_tags, request_options=request_options
|
|
337
|
+
)
|
|
338
|
+
return _response.data
|
|
339
|
+
|
|
232
340
|
def close_trace_thread(
|
|
233
341
|
self,
|
|
234
342
|
*,
|
|
235
|
-
thread_id: str,
|
|
236
343
|
project_name: typing.Optional[str] = OMIT,
|
|
237
344
|
project_id: typing.Optional[str] = OMIT,
|
|
345
|
+
thread_id: typing.Optional[str] = OMIT,
|
|
346
|
+
thread_ids: typing.Optional[typing.Sequence[str]] = OMIT,
|
|
238
347
|
request_options: typing.Optional[RequestOptions] = None,
|
|
239
348
|
) -> None:
|
|
240
349
|
"""
|
|
241
|
-
Close trace
|
|
350
|
+
Close one or multiple trace threads. Supports both single thread_id and multiple thread_ids for batch operations.
|
|
242
351
|
|
|
243
352
|
Parameters
|
|
244
353
|
----------
|
|
245
|
-
thread_id : str
|
|
246
|
-
|
|
247
354
|
project_name : typing.Optional[str]
|
|
248
355
|
|
|
249
356
|
project_id : typing.Optional[str]
|
|
250
357
|
|
|
358
|
+
thread_id : typing.Optional[str]
|
|
359
|
+
|
|
360
|
+
thread_ids : typing.Optional[typing.Sequence[str]]
|
|
361
|
+
|
|
251
362
|
request_options : typing.Optional[RequestOptions]
|
|
252
363
|
Request-specific configuration.
|
|
253
364
|
|
|
@@ -259,10 +370,14 @@ class TracesClient:
|
|
|
259
370
|
--------
|
|
260
371
|
from Opik import OpikApi
|
|
261
372
|
client = OpikApi(api_key="YOUR_API_KEY", workspace_name="YOUR_WORKSPACE_NAME", )
|
|
262
|
-
client.traces.close_trace_thread(
|
|
373
|
+
client.traces.close_trace_thread()
|
|
263
374
|
"""
|
|
264
375
|
_response = self._raw_client.close_trace_thread(
|
|
265
|
-
|
|
376
|
+
project_name=project_name,
|
|
377
|
+
project_id=project_id,
|
|
378
|
+
thread_id=thread_id,
|
|
379
|
+
thread_ids=thread_ids,
|
|
380
|
+
request_options=request_options,
|
|
266
381
|
)
|
|
267
382
|
return _response.data
|
|
268
383
|
|
|
@@ -275,8 +390,11 @@ class TracesClient:
|
|
|
275
390
|
project_id: typing.Optional[str] = None,
|
|
276
391
|
filters: typing.Optional[str] = None,
|
|
277
392
|
truncate: typing.Optional[bool] = None,
|
|
393
|
+
strip_attachments: typing.Optional[bool] = None,
|
|
278
394
|
sorting: typing.Optional[str] = None,
|
|
279
395
|
exclude: typing.Optional[str] = None,
|
|
396
|
+
from_time: typing.Optional[dt.datetime] = None,
|
|
397
|
+
to_time: typing.Optional[dt.datetime] = None,
|
|
280
398
|
request_options: typing.Optional[RequestOptions] = None,
|
|
281
399
|
) -> TracePagePublic:
|
|
282
400
|
"""
|
|
@@ -296,10 +414,16 @@ class TracesClient:
|
|
|
296
414
|
|
|
297
415
|
truncate : typing.Optional[bool]
|
|
298
416
|
|
|
417
|
+
strip_attachments : typing.Optional[bool]
|
|
418
|
+
|
|
299
419
|
sorting : typing.Optional[str]
|
|
300
420
|
|
|
301
421
|
exclude : typing.Optional[str]
|
|
302
422
|
|
|
423
|
+
from_time : typing.Optional[dt.datetime]
|
|
424
|
+
|
|
425
|
+
to_time : typing.Optional[dt.datetime]
|
|
426
|
+
|
|
303
427
|
request_options : typing.Optional[RequestOptions]
|
|
304
428
|
Request-specific configuration.
|
|
305
429
|
|
|
@@ -321,8 +445,11 @@ class TracesClient:
|
|
|
321
445
|
project_id=project_id,
|
|
322
446
|
filters=filters,
|
|
323
447
|
truncate=truncate,
|
|
448
|
+
strip_attachments=strip_attachments,
|
|
324
449
|
sorting=sorting,
|
|
325
450
|
exclude=exclude,
|
|
451
|
+
from_time=from_time,
|
|
452
|
+
to_time=to_time,
|
|
326
453
|
request_options=request_options,
|
|
327
454
|
)
|
|
328
455
|
return _response.data
|
|
@@ -337,7 +464,7 @@ class TracesClient:
|
|
|
337
464
|
end_time: typing.Optional[dt.datetime] = OMIT,
|
|
338
465
|
input: typing.Optional[JsonListStringWrite] = OMIT,
|
|
339
466
|
output: typing.Optional[JsonListStringWrite] = OMIT,
|
|
340
|
-
metadata: typing.Optional[
|
|
467
|
+
metadata: typing.Optional[JsonListStringWrite] = OMIT,
|
|
341
468
|
tags: typing.Optional[typing.Sequence[str]] = OMIT,
|
|
342
469
|
error_info: typing.Optional[ErrorInfoWrite] = OMIT,
|
|
343
470
|
last_updated_at: typing.Optional[dt.datetime] = OMIT,
|
|
@@ -364,7 +491,7 @@ class TracesClient:
|
|
|
364
491
|
|
|
365
492
|
output : typing.Optional[JsonListStringWrite]
|
|
366
493
|
|
|
367
|
-
metadata : typing.Optional[
|
|
494
|
+
metadata : typing.Optional[JsonListStringWrite]
|
|
368
495
|
|
|
369
496
|
tags : typing.Optional[typing.Sequence[str]]
|
|
370
497
|
|
|
@@ -405,35 +532,13 @@ class TracesClient:
|
|
|
405
532
|
)
|
|
406
533
|
return _response.data
|
|
407
534
|
|
|
408
|
-
def
|
|
409
|
-
self,
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
----------
|
|
416
|
-
traces : typing.Sequence[TraceWrite]
|
|
417
|
-
|
|
418
|
-
request_options : typing.Optional[RequestOptions]
|
|
419
|
-
Request-specific configuration.
|
|
420
|
-
|
|
421
|
-
Returns
|
|
422
|
-
-------
|
|
423
|
-
None
|
|
424
|
-
|
|
425
|
-
Examples
|
|
426
|
-
--------
|
|
427
|
-
from Opik import OpikApi
|
|
428
|
-
from Opik import TraceWrite
|
|
429
|
-
import datetime
|
|
430
|
-
client = OpikApi(api_key="YOUR_API_KEY", workspace_name="YOUR_WORKSPACE_NAME", )
|
|
431
|
-
client.traces.create_traces(traces=[TraceWrite(start_time=datetime.datetime.fromisoformat("2024-01-15 09:30:00+00:00", ), )], )
|
|
432
|
-
"""
|
|
433
|
-
_response = self._raw_client.create_traces(traces=traces, request_options=request_options)
|
|
434
|
-
return _response.data
|
|
435
|
-
|
|
436
|
-
def get_trace_by_id(self, id: str, *, request_options: typing.Optional[RequestOptions] = None) -> TracePublic:
|
|
535
|
+
def get_trace_by_id(
|
|
536
|
+
self,
|
|
537
|
+
id: str,
|
|
538
|
+
*,
|
|
539
|
+
strip_attachments: typing.Optional[bool] = None,
|
|
540
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
541
|
+
) -> TracePublic:
|
|
437
542
|
"""
|
|
438
543
|
Get trace by id
|
|
439
544
|
|
|
@@ -441,6 +546,8 @@ class TracesClient:
|
|
|
441
546
|
----------
|
|
442
547
|
id : str
|
|
443
548
|
|
|
549
|
+
strip_attachments : typing.Optional[bool]
|
|
550
|
+
|
|
444
551
|
request_options : typing.Optional[RequestOptions]
|
|
445
552
|
Request-specific configuration.
|
|
446
553
|
|
|
@@ -455,7 +562,9 @@ class TracesClient:
|
|
|
455
562
|
client = OpikApi(api_key="YOUR_API_KEY", workspace_name="YOUR_WORKSPACE_NAME", )
|
|
456
563
|
client.traces.get_trace_by_id(id='id', )
|
|
457
564
|
"""
|
|
458
|
-
_response = self._raw_client.get_trace_by_id(
|
|
565
|
+
_response = self._raw_client.get_trace_by_id(
|
|
566
|
+
id, strip_attachments=strip_attachments, request_options=request_options
|
|
567
|
+
)
|
|
459
568
|
return _response.data
|
|
460
569
|
|
|
461
570
|
def delete_trace_by_id(self, id: str, *, request_options: typing.Optional[RequestOptions] = None) -> None:
|
|
@@ -492,7 +601,7 @@ class TracesClient:
|
|
|
492
601
|
end_time: typing.Optional[dt.datetime] = OMIT,
|
|
493
602
|
input: typing.Optional[JsonListString] = OMIT,
|
|
494
603
|
output: typing.Optional[JsonListString] = OMIT,
|
|
495
|
-
metadata: typing.Optional[
|
|
604
|
+
metadata: typing.Optional[JsonListString] = OMIT,
|
|
496
605
|
tags: typing.Optional[typing.Sequence[str]] = OMIT,
|
|
497
606
|
error_info: typing.Optional[ErrorInfo] = OMIT,
|
|
498
607
|
thread_id: typing.Optional[str] = OMIT,
|
|
@@ -519,7 +628,7 @@ class TracesClient:
|
|
|
519
628
|
|
|
520
629
|
output : typing.Optional[JsonListString]
|
|
521
630
|
|
|
522
|
-
metadata : typing.Optional[
|
|
631
|
+
metadata : typing.Optional[JsonListString]
|
|
523
632
|
|
|
524
633
|
tags : typing.Optional[typing.Sequence[str]]
|
|
525
634
|
|
|
@@ -778,14 +887,14 @@ class TracesClient:
|
|
|
778
887
|
return _response.data
|
|
779
888
|
|
|
780
889
|
def find_trace_threads_feedback_score_names(
|
|
781
|
-
self, *, project_id: str, request_options: typing.Optional[RequestOptions] = None
|
|
890
|
+
self, *, project_id: typing.Optional[str] = None, request_options: typing.Optional[RequestOptions] = None
|
|
782
891
|
) -> typing.List[str]:
|
|
783
892
|
"""
|
|
784
893
|
Find Trace Threads Feedback Score names
|
|
785
894
|
|
|
786
895
|
Parameters
|
|
787
896
|
----------
|
|
788
|
-
project_id : str
|
|
897
|
+
project_id : typing.Optional[str]
|
|
789
898
|
|
|
790
899
|
request_options : typing.Optional[RequestOptions]
|
|
791
900
|
Request-specific configuration.
|
|
@@ -799,7 +908,7 @@ class TracesClient:
|
|
|
799
908
|
--------
|
|
800
909
|
from Opik import OpikApi
|
|
801
910
|
client = OpikApi(api_key="YOUR_API_KEY", workspace_name="YOUR_WORKSPACE_NAME", )
|
|
802
|
-
client.traces.find_trace_threads_feedback_score_names(
|
|
911
|
+
client.traces.find_trace_threads_feedback_score_names()
|
|
803
912
|
"""
|
|
804
913
|
_response = self._raw_client.find_trace_threads_feedback_score_names(
|
|
805
914
|
project_id=project_id, request_options=request_options
|
|
@@ -812,6 +921,8 @@ class TracesClient:
|
|
|
812
921
|
project_id: typing.Optional[str] = None,
|
|
813
922
|
project_name: typing.Optional[str] = None,
|
|
814
923
|
filters: typing.Optional[str] = None,
|
|
924
|
+
from_time: typing.Optional[dt.datetime] = None,
|
|
925
|
+
to_time: typing.Optional[dt.datetime] = None,
|
|
815
926
|
request_options: typing.Optional[RequestOptions] = None,
|
|
816
927
|
) -> ProjectStatsPublic:
|
|
817
928
|
"""
|
|
@@ -825,6 +936,10 @@ class TracesClient:
|
|
|
825
936
|
|
|
826
937
|
filters : typing.Optional[str]
|
|
827
938
|
|
|
939
|
+
from_time : typing.Optional[dt.datetime]
|
|
940
|
+
|
|
941
|
+
to_time : typing.Optional[dt.datetime]
|
|
942
|
+
|
|
828
943
|
request_options : typing.Optional[RequestOptions]
|
|
829
944
|
Request-specific configuration.
|
|
830
945
|
|
|
@@ -840,7 +955,12 @@ class TracesClient:
|
|
|
840
955
|
client.traces.get_trace_stats()
|
|
841
956
|
"""
|
|
842
957
|
_response = self._raw_client.get_trace_stats(
|
|
843
|
-
project_id=project_id,
|
|
958
|
+
project_id=project_id,
|
|
959
|
+
project_name=project_name,
|
|
960
|
+
filters=filters,
|
|
961
|
+
from_time=from_time,
|
|
962
|
+
to_time=to_time,
|
|
963
|
+
request_options=request_options,
|
|
844
964
|
)
|
|
845
965
|
return _response.data
|
|
846
966
|
|
|
@@ -873,6 +993,55 @@ class TracesClient:
|
|
|
873
993
|
_response = self._raw_client.get_thread_comment(comment_id, thread_id, request_options=request_options)
|
|
874
994
|
return _response.data
|
|
875
995
|
|
|
996
|
+
def get_trace_thread_stats(
|
|
997
|
+
self,
|
|
998
|
+
*,
|
|
999
|
+
project_id: typing.Optional[str] = None,
|
|
1000
|
+
project_name: typing.Optional[str] = None,
|
|
1001
|
+
filters: typing.Optional[str] = None,
|
|
1002
|
+
from_time: typing.Optional[dt.datetime] = None,
|
|
1003
|
+
to_time: typing.Optional[dt.datetime] = None,
|
|
1004
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
1005
|
+
) -> ProjectStatsPublic:
|
|
1006
|
+
"""
|
|
1007
|
+
Get trace thread stats
|
|
1008
|
+
|
|
1009
|
+
Parameters
|
|
1010
|
+
----------
|
|
1011
|
+
project_id : typing.Optional[str]
|
|
1012
|
+
|
|
1013
|
+
project_name : typing.Optional[str]
|
|
1014
|
+
|
|
1015
|
+
filters : typing.Optional[str]
|
|
1016
|
+
|
|
1017
|
+
from_time : typing.Optional[dt.datetime]
|
|
1018
|
+
|
|
1019
|
+
to_time : typing.Optional[dt.datetime]
|
|
1020
|
+
|
|
1021
|
+
request_options : typing.Optional[RequestOptions]
|
|
1022
|
+
Request-specific configuration.
|
|
1023
|
+
|
|
1024
|
+
Returns
|
|
1025
|
+
-------
|
|
1026
|
+
ProjectStatsPublic
|
|
1027
|
+
Trace thread stats resource
|
|
1028
|
+
|
|
1029
|
+
Examples
|
|
1030
|
+
--------
|
|
1031
|
+
from Opik import OpikApi
|
|
1032
|
+
client = OpikApi(api_key="YOUR_API_KEY", workspace_name="YOUR_WORKSPACE_NAME", )
|
|
1033
|
+
client.traces.get_trace_thread_stats()
|
|
1034
|
+
"""
|
|
1035
|
+
_response = self._raw_client.get_trace_thread_stats(
|
|
1036
|
+
project_id=project_id,
|
|
1037
|
+
project_name=project_name,
|
|
1038
|
+
filters=filters,
|
|
1039
|
+
from_time=from_time,
|
|
1040
|
+
to_time=to_time,
|
|
1041
|
+
request_options=request_options,
|
|
1042
|
+
)
|
|
1043
|
+
return _response.data
|
|
1044
|
+
|
|
876
1045
|
def get_trace_comment(
|
|
877
1046
|
self, comment_id: str, trace_id: str, *, request_options: typing.Optional[RequestOptions] = None
|
|
878
1047
|
) -> Comment:
|
|
@@ -908,6 +1077,7 @@ class TracesClient:
|
|
|
908
1077
|
thread_id: str,
|
|
909
1078
|
project_name: typing.Optional[str] = OMIT,
|
|
910
1079
|
project_id: typing.Optional[str] = OMIT,
|
|
1080
|
+
truncate: typing.Optional[bool] = OMIT,
|
|
911
1081
|
request_options: typing.Optional[RequestOptions] = None,
|
|
912
1082
|
) -> TraceThread:
|
|
913
1083
|
"""
|
|
@@ -921,6 +1091,8 @@ class TracesClient:
|
|
|
921
1091
|
|
|
922
1092
|
project_id : typing.Optional[str]
|
|
923
1093
|
|
|
1094
|
+
truncate : typing.Optional[bool]
|
|
1095
|
+
|
|
924
1096
|
request_options : typing.Optional[RequestOptions]
|
|
925
1097
|
Request-specific configuration.
|
|
926
1098
|
|
|
@@ -936,7 +1108,11 @@ class TracesClient:
|
|
|
936
1108
|
client.traces.get_trace_thread(thread_id='thread_id', )
|
|
937
1109
|
"""
|
|
938
1110
|
_response = self._raw_client.get_trace_thread(
|
|
939
|
-
thread_id=thread_id,
|
|
1111
|
+
thread_id=thread_id,
|
|
1112
|
+
project_name=project_name,
|
|
1113
|
+
project_id=project_id,
|
|
1114
|
+
truncate=truncate,
|
|
1115
|
+
request_options=request_options,
|
|
940
1116
|
)
|
|
941
1117
|
return _response.data
|
|
942
1118
|
|
|
@@ -948,8 +1124,11 @@ class TracesClient:
|
|
|
948
1124
|
project_name: typing.Optional[str] = None,
|
|
949
1125
|
project_id: typing.Optional[str] = None,
|
|
950
1126
|
truncate: typing.Optional[bool] = None,
|
|
1127
|
+
strip_attachments: typing.Optional[bool] = None,
|
|
951
1128
|
filters: typing.Optional[str] = None,
|
|
952
1129
|
sorting: typing.Optional[str] = None,
|
|
1130
|
+
from_time: typing.Optional[dt.datetime] = None,
|
|
1131
|
+
to_time: typing.Optional[dt.datetime] = None,
|
|
953
1132
|
request_options: typing.Optional[RequestOptions] = None,
|
|
954
1133
|
) -> TraceThreadPage:
|
|
955
1134
|
"""
|
|
@@ -967,10 +1146,16 @@ class TracesClient:
|
|
|
967
1146
|
|
|
968
1147
|
truncate : typing.Optional[bool]
|
|
969
1148
|
|
|
1149
|
+
strip_attachments : typing.Optional[bool]
|
|
1150
|
+
|
|
970
1151
|
filters : typing.Optional[str]
|
|
971
1152
|
|
|
972
1153
|
sorting : typing.Optional[str]
|
|
973
1154
|
|
|
1155
|
+
from_time : typing.Optional[dt.datetime]
|
|
1156
|
+
|
|
1157
|
+
to_time : typing.Optional[dt.datetime]
|
|
1158
|
+
|
|
974
1159
|
request_options : typing.Optional[RequestOptions]
|
|
975
1160
|
Request-specific configuration.
|
|
976
1161
|
|
|
@@ -991,8 +1176,11 @@ class TracesClient:
|
|
|
991
1176
|
project_name=project_name,
|
|
992
1177
|
project_id=project_id,
|
|
993
1178
|
truncate=truncate,
|
|
1179
|
+
strip_attachments=strip_attachments,
|
|
994
1180
|
filters=filters,
|
|
995
1181
|
sorting=sorting,
|
|
1182
|
+
from_time=from_time,
|
|
1183
|
+
to_time=to_time,
|
|
996
1184
|
request_options=request_options,
|
|
997
1185
|
)
|
|
998
1186
|
return _response.data
|
|
@@ -1003,6 +1191,7 @@ class TracesClient:
|
|
|
1003
1191
|
thread_id: str,
|
|
1004
1192
|
project_name: typing.Optional[str] = OMIT,
|
|
1005
1193
|
project_id: typing.Optional[str] = OMIT,
|
|
1194
|
+
truncate: typing.Optional[bool] = OMIT,
|
|
1006
1195
|
request_options: typing.Optional[RequestOptions] = None,
|
|
1007
1196
|
) -> None:
|
|
1008
1197
|
"""
|
|
@@ -1016,6 +1205,8 @@ class TracesClient:
|
|
|
1016
1205
|
|
|
1017
1206
|
project_id : typing.Optional[str]
|
|
1018
1207
|
|
|
1208
|
+
truncate : typing.Optional[bool]
|
|
1209
|
+
|
|
1019
1210
|
request_options : typing.Optional[RequestOptions]
|
|
1020
1211
|
Request-specific configuration.
|
|
1021
1212
|
|
|
@@ -1030,7 +1221,11 @@ class TracesClient:
|
|
|
1030
1221
|
client.traces.open_trace_thread(thread_id='thread_id', )
|
|
1031
1222
|
"""
|
|
1032
1223
|
_response = self._raw_client.open_trace_thread(
|
|
1033
|
-
thread_id=thread_id,
|
|
1224
|
+
thread_id=thread_id,
|
|
1225
|
+
project_name=project_name,
|
|
1226
|
+
project_id=project_id,
|
|
1227
|
+
truncate=truncate,
|
|
1228
|
+
request_options=request_options,
|
|
1034
1229
|
)
|
|
1035
1230
|
return _response.data
|
|
1036
1231
|
|
|
@@ -1059,7 +1254,7 @@ class TracesClient:
|
|
|
1059
1254
|
from Opik import OpikApi
|
|
1060
1255
|
from Opik import FeedbackScoreBatchItemThread
|
|
1061
1256
|
client = OpikApi(api_key="YOUR_API_KEY", workspace_name="YOUR_WORKSPACE_NAME", )
|
|
1062
|
-
client.traces.score_batch_of_threads(scores=[FeedbackScoreBatchItemThread(
|
|
1257
|
+
client.traces.score_batch_of_threads(scores=[FeedbackScoreBatchItemThread(name='name', value=1.1, source="ui", thread_id='thread_id', )], )
|
|
1063
1258
|
"""
|
|
1064
1259
|
_response = self._raw_client.score_batch_of_threads(scores=scores, request_options=request_options)
|
|
1065
1260
|
return _response.data
|
|
@@ -1089,7 +1284,7 @@ class TracesClient:
|
|
|
1089
1284
|
from Opik import OpikApi
|
|
1090
1285
|
from Opik import FeedbackScoreBatchItem
|
|
1091
1286
|
client = OpikApi(api_key="YOUR_API_KEY", workspace_name="YOUR_WORKSPACE_NAME", )
|
|
1092
|
-
client.traces.score_batch_of_traces(scores=[FeedbackScoreBatchItem(
|
|
1287
|
+
client.traces.score_batch_of_traces(scores=[FeedbackScoreBatchItem(name='name', value=1.1, source="ui", id='id', )], )
|
|
1093
1288
|
"""
|
|
1094
1289
|
_response = self._raw_client.score_batch_of_traces(scores=scores, request_options=request_options)
|
|
1095
1290
|
return _response.data
|
|
@@ -1103,6 +1298,9 @@ class TracesClient:
|
|
|
1103
1298
|
last_retrieved_thread_model_id: typing.Optional[str] = OMIT,
|
|
1104
1299
|
limit: typing.Optional[int] = OMIT,
|
|
1105
1300
|
truncate: typing.Optional[bool] = OMIT,
|
|
1301
|
+
strip_attachments: typing.Optional[bool] = OMIT,
|
|
1302
|
+
from_time: typing.Optional[dt.datetime] = OMIT,
|
|
1303
|
+
to_time: typing.Optional[dt.datetime] = OMIT,
|
|
1106
1304
|
request_options: typing.Optional[RequestOptions] = None,
|
|
1107
1305
|
) -> typing.Iterator[bytes]:
|
|
1108
1306
|
"""
|
|
@@ -1122,7 +1320,16 @@ class TracesClient:
|
|
|
1122
1320
|
Max number of trace thread to be streamed
|
|
1123
1321
|
|
|
1124
1322
|
truncate : typing.Optional[bool]
|
|
1125
|
-
Truncate
|
|
1323
|
+
Truncate input, output and metadata to slim payloads
|
|
1324
|
+
|
|
1325
|
+
strip_attachments : typing.Optional[bool]
|
|
1326
|
+
If true, returns attachment references like [file.png]; if false, downloads and reinjects stripped attachments
|
|
1327
|
+
|
|
1328
|
+
from_time : typing.Optional[dt.datetime]
|
|
1329
|
+
Filter trace threads created from this time (ISO-8601 format).
|
|
1330
|
+
|
|
1331
|
+
to_time : typing.Optional[dt.datetime]
|
|
1332
|
+
Filter trace threads created up to this time (ISO-8601 format). If not provided, defaults to current time. Must be after 'from_time'.
|
|
1126
1333
|
|
|
1127
1334
|
request_options : typing.Optional[RequestOptions]
|
|
1128
1335
|
Request-specific configuration. You can pass in configuration such as `chunk_size`, and more to customize the request and response.
|
|
@@ -1139,6 +1346,9 @@ class TracesClient:
|
|
|
1139
1346
|
last_retrieved_thread_model_id=last_retrieved_thread_model_id,
|
|
1140
1347
|
limit=limit,
|
|
1141
1348
|
truncate=truncate,
|
|
1349
|
+
strip_attachments=strip_attachments,
|
|
1350
|
+
from_time=from_time,
|
|
1351
|
+
to_time=to_time,
|
|
1142
1352
|
request_options=request_options,
|
|
1143
1353
|
) as r:
|
|
1144
1354
|
yield from r.data
|
|
@@ -1152,6 +1362,9 @@ class TracesClient:
|
|
|
1152
1362
|
last_retrieved_id: typing.Optional[str] = OMIT,
|
|
1153
1363
|
limit: typing.Optional[int] = OMIT,
|
|
1154
1364
|
truncate: typing.Optional[bool] = OMIT,
|
|
1365
|
+
strip_attachments: typing.Optional[bool] = OMIT,
|
|
1366
|
+
from_time: typing.Optional[dt.datetime] = OMIT,
|
|
1367
|
+
to_time: typing.Optional[dt.datetime] = OMIT,
|
|
1155
1368
|
request_options: typing.Optional[RequestOptions] = None,
|
|
1156
1369
|
) -> typing.Iterator[bytes]:
|
|
1157
1370
|
"""
|
|
@@ -1171,7 +1384,16 @@ class TracesClient:
|
|
|
1171
1384
|
Max number of traces to be streamed
|
|
1172
1385
|
|
|
1173
1386
|
truncate : typing.Optional[bool]
|
|
1174
|
-
Truncate
|
|
1387
|
+
Truncate input, output and metadata to slim payloads
|
|
1388
|
+
|
|
1389
|
+
strip_attachments : typing.Optional[bool]
|
|
1390
|
+
If true, returns attachment references like [file.png]; if false, downloads and reinjects stripped attachments
|
|
1391
|
+
|
|
1392
|
+
from_time : typing.Optional[dt.datetime]
|
|
1393
|
+
Filter traces created from this time (ISO-8601 format).
|
|
1394
|
+
|
|
1395
|
+
to_time : typing.Optional[dt.datetime]
|
|
1396
|
+
Filter traces created up to this time (ISO-8601 format). If not provided, defaults to current time. Must be after 'from_time'.
|
|
1175
1397
|
|
|
1176
1398
|
request_options : typing.Optional[RequestOptions]
|
|
1177
1399
|
Request-specific configuration. You can pass in configuration such as `chunk_size`, and more to customize the request and response.
|
|
@@ -1188,6 +1410,9 @@ class TracesClient:
|
|
|
1188
1410
|
last_retrieved_id=last_retrieved_id,
|
|
1189
1411
|
limit=limit,
|
|
1190
1412
|
truncate=truncate,
|
|
1413
|
+
strip_attachments=strip_attachments,
|
|
1414
|
+
from_time=from_time,
|
|
1415
|
+
to_time=to_time,
|
|
1191
1416
|
request_options=request_options,
|
|
1192
1417
|
) as r:
|
|
1193
1418
|
yield from r.data
|
|
@@ -1196,12 +1421,7 @@ class TracesClient:
|
|
|
1196
1421
|
self,
|
|
1197
1422
|
thread_model_id: str,
|
|
1198
1423
|
*,
|
|
1199
|
-
|
|
1200
|
-
id: typing.Optional[str] = OMIT,
|
|
1201
|
-
created_at: typing.Optional[dt.datetime] = OMIT,
|
|
1202
|
-
last_updated_at: typing.Optional[dt.datetime] = OMIT,
|
|
1203
|
-
created_by: typing.Optional[str] = OMIT,
|
|
1204
|
-
last_updated_by: typing.Optional[str] = OMIT,
|
|
1424
|
+
tags: typing.Optional[typing.Sequence[str]] = OMIT,
|
|
1205
1425
|
request_options: typing.Optional[RequestOptions] = None,
|
|
1206
1426
|
) -> None:
|
|
1207
1427
|
"""
|
|
@@ -1211,17 +1431,7 @@ class TracesClient:
|
|
|
1211
1431
|
----------
|
|
1212
1432
|
thread_model_id : str
|
|
1213
1433
|
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
id : typing.Optional[str]
|
|
1217
|
-
|
|
1218
|
-
created_at : typing.Optional[dt.datetime]
|
|
1219
|
-
|
|
1220
|
-
last_updated_at : typing.Optional[dt.datetime]
|
|
1221
|
-
|
|
1222
|
-
created_by : typing.Optional[str]
|
|
1223
|
-
|
|
1224
|
-
last_updated_by : typing.Optional[str]
|
|
1434
|
+
tags : typing.Optional[typing.Sequence[str]]
|
|
1225
1435
|
|
|
1226
1436
|
request_options : typing.Optional[RequestOptions]
|
|
1227
1437
|
Request-specific configuration.
|
|
@@ -1234,18 +1444,9 @@ class TracesClient:
|
|
|
1234
1444
|
--------
|
|
1235
1445
|
from Opik import OpikApi
|
|
1236
1446
|
client = OpikApi(api_key="YOUR_API_KEY", workspace_name="YOUR_WORKSPACE_NAME", )
|
|
1237
|
-
client.traces.update_thread(thread_model_id='threadModelId',
|
|
1447
|
+
client.traces.update_thread(thread_model_id='threadModelId', )
|
|
1238
1448
|
"""
|
|
1239
|
-
_response = self._raw_client.update_thread(
|
|
1240
|
-
thread_model_id,
|
|
1241
|
-
text=text,
|
|
1242
|
-
id=id,
|
|
1243
|
-
created_at=created_at,
|
|
1244
|
-
last_updated_at=last_updated_at,
|
|
1245
|
-
created_by=created_by,
|
|
1246
|
-
last_updated_by=last_updated_by,
|
|
1247
|
-
request_options=request_options,
|
|
1248
|
-
)
|
|
1449
|
+
_response = self._raw_client.update_thread(thread_model_id, tags=tags, request_options=request_options)
|
|
1249
1450
|
return _response.data
|
|
1250
1451
|
|
|
1251
1452
|
def update_thread_comment(
|
|
@@ -1569,25 +1770,145 @@ class AsyncTracesClient:
|
|
|
1569
1770
|
)
|
|
1570
1771
|
return _response.data
|
|
1571
1772
|
|
|
1773
|
+
async def create_traces(
|
|
1774
|
+
self, *, traces: typing.Sequence[TraceWrite], request_options: typing.Optional[RequestOptions] = None
|
|
1775
|
+
) -> None:
|
|
1776
|
+
"""
|
|
1777
|
+
Create traces
|
|
1778
|
+
|
|
1779
|
+
Parameters
|
|
1780
|
+
----------
|
|
1781
|
+
traces : typing.Sequence[TraceWrite]
|
|
1782
|
+
|
|
1783
|
+
request_options : typing.Optional[RequestOptions]
|
|
1784
|
+
Request-specific configuration.
|
|
1785
|
+
|
|
1786
|
+
Returns
|
|
1787
|
+
-------
|
|
1788
|
+
None
|
|
1789
|
+
|
|
1790
|
+
Examples
|
|
1791
|
+
--------
|
|
1792
|
+
from Opik import AsyncOpikApi
|
|
1793
|
+
from Opik import TraceWrite
|
|
1794
|
+
import datetime
|
|
1795
|
+
import asyncio
|
|
1796
|
+
client = AsyncOpikApi(api_key="YOUR_API_KEY", workspace_name="YOUR_WORKSPACE_NAME", )
|
|
1797
|
+
async def main() -> None:
|
|
1798
|
+
await client.traces.create_traces(traces=[TraceWrite(start_time=datetime.datetime.fromisoformat("2024-01-15 09:30:00+00:00", ), )], )
|
|
1799
|
+
asyncio.run(main())
|
|
1800
|
+
"""
|
|
1801
|
+
_response = await self._raw_client.create_traces(traces=traces, request_options=request_options)
|
|
1802
|
+
return _response.data
|
|
1803
|
+
|
|
1804
|
+
async def batch_update_traces(
|
|
1805
|
+
self,
|
|
1806
|
+
*,
|
|
1807
|
+
ids: typing.Sequence[str],
|
|
1808
|
+
update: TraceUpdate,
|
|
1809
|
+
merge_tags: typing.Optional[bool] = OMIT,
|
|
1810
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
1811
|
+
) -> None:
|
|
1812
|
+
"""
|
|
1813
|
+
Update multiple traces
|
|
1814
|
+
|
|
1815
|
+
Parameters
|
|
1816
|
+
----------
|
|
1817
|
+
ids : typing.Sequence[str]
|
|
1818
|
+
List of trace IDs to update (max 1000)
|
|
1819
|
+
|
|
1820
|
+
update : TraceUpdate
|
|
1821
|
+
|
|
1822
|
+
merge_tags : typing.Optional[bool]
|
|
1823
|
+
If true, merge tags with existing tags instead of replacing them. Default: false
|
|
1824
|
+
|
|
1825
|
+
request_options : typing.Optional[RequestOptions]
|
|
1826
|
+
Request-specific configuration.
|
|
1827
|
+
|
|
1828
|
+
Returns
|
|
1829
|
+
-------
|
|
1830
|
+
None
|
|
1831
|
+
|
|
1832
|
+
Examples
|
|
1833
|
+
--------
|
|
1834
|
+
from Opik import AsyncOpikApi
|
|
1835
|
+
from Opik import TraceUpdate
|
|
1836
|
+
import asyncio
|
|
1837
|
+
client = AsyncOpikApi(api_key="YOUR_API_KEY", workspace_name="YOUR_WORKSPACE_NAME", )
|
|
1838
|
+
async def main() -> None:
|
|
1839
|
+
await client.traces.batch_update_traces(ids=['ids'], update=TraceUpdate(), )
|
|
1840
|
+
asyncio.run(main())
|
|
1841
|
+
"""
|
|
1842
|
+
_response = await self._raw_client.batch_update_traces(
|
|
1843
|
+
ids=ids, update=update, merge_tags=merge_tags, request_options=request_options
|
|
1844
|
+
)
|
|
1845
|
+
return _response.data
|
|
1846
|
+
|
|
1847
|
+
async def batch_update_threads(
|
|
1848
|
+
self,
|
|
1849
|
+
*,
|
|
1850
|
+
ids: typing.Sequence[str],
|
|
1851
|
+
update: TraceThreadUpdate,
|
|
1852
|
+
merge_tags: typing.Optional[bool] = OMIT,
|
|
1853
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
1854
|
+
) -> None:
|
|
1855
|
+
"""
|
|
1856
|
+
Update multiple threads
|
|
1857
|
+
|
|
1858
|
+
Parameters
|
|
1859
|
+
----------
|
|
1860
|
+
ids : typing.Sequence[str]
|
|
1861
|
+
List of thread model IDs to update (max 1000)
|
|
1862
|
+
|
|
1863
|
+
update : TraceThreadUpdate
|
|
1864
|
+
|
|
1865
|
+
merge_tags : typing.Optional[bool]
|
|
1866
|
+
If true, merge tags with existing tags instead of replacing them. Default: false
|
|
1867
|
+
|
|
1868
|
+
request_options : typing.Optional[RequestOptions]
|
|
1869
|
+
Request-specific configuration.
|
|
1870
|
+
|
|
1871
|
+
Returns
|
|
1872
|
+
-------
|
|
1873
|
+
None
|
|
1874
|
+
|
|
1875
|
+
Examples
|
|
1876
|
+
--------
|
|
1877
|
+
from Opik import AsyncOpikApi
|
|
1878
|
+
from Opik import TraceThreadUpdate
|
|
1879
|
+
import asyncio
|
|
1880
|
+
client = AsyncOpikApi(api_key="YOUR_API_KEY", workspace_name="YOUR_WORKSPACE_NAME", )
|
|
1881
|
+
async def main() -> None:
|
|
1882
|
+
await client.traces.batch_update_threads(ids=['ids'], update=TraceThreadUpdate(), )
|
|
1883
|
+
asyncio.run(main())
|
|
1884
|
+
"""
|
|
1885
|
+
_response = await self._raw_client.batch_update_threads(
|
|
1886
|
+
ids=ids, update=update, merge_tags=merge_tags, request_options=request_options
|
|
1887
|
+
)
|
|
1888
|
+
return _response.data
|
|
1889
|
+
|
|
1572
1890
|
async def close_trace_thread(
|
|
1573
1891
|
self,
|
|
1574
1892
|
*,
|
|
1575
|
-
thread_id: str,
|
|
1576
1893
|
project_name: typing.Optional[str] = OMIT,
|
|
1577
1894
|
project_id: typing.Optional[str] = OMIT,
|
|
1895
|
+
thread_id: typing.Optional[str] = OMIT,
|
|
1896
|
+
thread_ids: typing.Optional[typing.Sequence[str]] = OMIT,
|
|
1578
1897
|
request_options: typing.Optional[RequestOptions] = None,
|
|
1579
1898
|
) -> None:
|
|
1580
1899
|
"""
|
|
1581
|
-
Close trace
|
|
1900
|
+
Close one or multiple trace threads. Supports both single thread_id and multiple thread_ids for batch operations.
|
|
1582
1901
|
|
|
1583
1902
|
Parameters
|
|
1584
1903
|
----------
|
|
1585
|
-
thread_id : str
|
|
1586
|
-
|
|
1587
1904
|
project_name : typing.Optional[str]
|
|
1588
1905
|
|
|
1589
1906
|
project_id : typing.Optional[str]
|
|
1590
1907
|
|
|
1908
|
+
thread_id : typing.Optional[str]
|
|
1909
|
+
|
|
1910
|
+
thread_ids : typing.Optional[typing.Sequence[str]]
|
|
1911
|
+
|
|
1591
1912
|
request_options : typing.Optional[RequestOptions]
|
|
1592
1913
|
Request-specific configuration.
|
|
1593
1914
|
|
|
@@ -1601,11 +1922,15 @@ class AsyncTracesClient:
|
|
|
1601
1922
|
import asyncio
|
|
1602
1923
|
client = AsyncOpikApi(api_key="YOUR_API_KEY", workspace_name="YOUR_WORKSPACE_NAME", )
|
|
1603
1924
|
async def main() -> None:
|
|
1604
|
-
await client.traces.close_trace_thread(
|
|
1925
|
+
await client.traces.close_trace_thread()
|
|
1605
1926
|
asyncio.run(main())
|
|
1606
1927
|
"""
|
|
1607
1928
|
_response = await self._raw_client.close_trace_thread(
|
|
1608
|
-
|
|
1929
|
+
project_name=project_name,
|
|
1930
|
+
project_id=project_id,
|
|
1931
|
+
thread_id=thread_id,
|
|
1932
|
+
thread_ids=thread_ids,
|
|
1933
|
+
request_options=request_options,
|
|
1609
1934
|
)
|
|
1610
1935
|
return _response.data
|
|
1611
1936
|
|
|
@@ -1618,8 +1943,11 @@ class AsyncTracesClient:
|
|
|
1618
1943
|
project_id: typing.Optional[str] = None,
|
|
1619
1944
|
filters: typing.Optional[str] = None,
|
|
1620
1945
|
truncate: typing.Optional[bool] = None,
|
|
1946
|
+
strip_attachments: typing.Optional[bool] = None,
|
|
1621
1947
|
sorting: typing.Optional[str] = None,
|
|
1622
1948
|
exclude: typing.Optional[str] = None,
|
|
1949
|
+
from_time: typing.Optional[dt.datetime] = None,
|
|
1950
|
+
to_time: typing.Optional[dt.datetime] = None,
|
|
1623
1951
|
request_options: typing.Optional[RequestOptions] = None,
|
|
1624
1952
|
) -> TracePagePublic:
|
|
1625
1953
|
"""
|
|
@@ -1639,10 +1967,16 @@ class AsyncTracesClient:
|
|
|
1639
1967
|
|
|
1640
1968
|
truncate : typing.Optional[bool]
|
|
1641
1969
|
|
|
1970
|
+
strip_attachments : typing.Optional[bool]
|
|
1971
|
+
|
|
1642
1972
|
sorting : typing.Optional[str]
|
|
1643
1973
|
|
|
1644
1974
|
exclude : typing.Optional[str]
|
|
1645
1975
|
|
|
1976
|
+
from_time : typing.Optional[dt.datetime]
|
|
1977
|
+
|
|
1978
|
+
to_time : typing.Optional[dt.datetime]
|
|
1979
|
+
|
|
1646
1980
|
request_options : typing.Optional[RequestOptions]
|
|
1647
1981
|
Request-specific configuration.
|
|
1648
1982
|
|
|
@@ -1667,8 +2001,11 @@ class AsyncTracesClient:
|
|
|
1667
2001
|
project_id=project_id,
|
|
1668
2002
|
filters=filters,
|
|
1669
2003
|
truncate=truncate,
|
|
2004
|
+
strip_attachments=strip_attachments,
|
|
1670
2005
|
sorting=sorting,
|
|
1671
2006
|
exclude=exclude,
|
|
2007
|
+
from_time=from_time,
|
|
2008
|
+
to_time=to_time,
|
|
1672
2009
|
request_options=request_options,
|
|
1673
2010
|
)
|
|
1674
2011
|
return _response.data
|
|
@@ -1683,7 +2020,7 @@ class AsyncTracesClient:
|
|
|
1683
2020
|
end_time: typing.Optional[dt.datetime] = OMIT,
|
|
1684
2021
|
input: typing.Optional[JsonListStringWrite] = OMIT,
|
|
1685
2022
|
output: typing.Optional[JsonListStringWrite] = OMIT,
|
|
1686
|
-
metadata: typing.Optional[
|
|
2023
|
+
metadata: typing.Optional[JsonListStringWrite] = OMIT,
|
|
1687
2024
|
tags: typing.Optional[typing.Sequence[str]] = OMIT,
|
|
1688
2025
|
error_info: typing.Optional[ErrorInfoWrite] = OMIT,
|
|
1689
2026
|
last_updated_at: typing.Optional[dt.datetime] = OMIT,
|
|
@@ -1710,7 +2047,7 @@ class AsyncTracesClient:
|
|
|
1710
2047
|
|
|
1711
2048
|
output : typing.Optional[JsonListStringWrite]
|
|
1712
2049
|
|
|
1713
|
-
metadata : typing.Optional[
|
|
2050
|
+
metadata : typing.Optional[JsonListStringWrite]
|
|
1714
2051
|
|
|
1715
2052
|
tags : typing.Optional[typing.Sequence[str]]
|
|
1716
2053
|
|
|
@@ -1754,38 +2091,13 @@ class AsyncTracesClient:
|
|
|
1754
2091
|
)
|
|
1755
2092
|
return _response.data
|
|
1756
2093
|
|
|
1757
|
-
async def
|
|
1758
|
-
self,
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
----------
|
|
1765
|
-
traces : typing.Sequence[TraceWrite]
|
|
1766
|
-
|
|
1767
|
-
request_options : typing.Optional[RequestOptions]
|
|
1768
|
-
Request-specific configuration.
|
|
1769
|
-
|
|
1770
|
-
Returns
|
|
1771
|
-
-------
|
|
1772
|
-
None
|
|
1773
|
-
|
|
1774
|
-
Examples
|
|
1775
|
-
--------
|
|
1776
|
-
from Opik import AsyncOpikApi
|
|
1777
|
-
from Opik import TraceWrite
|
|
1778
|
-
import datetime
|
|
1779
|
-
import asyncio
|
|
1780
|
-
client = AsyncOpikApi(api_key="YOUR_API_KEY", workspace_name="YOUR_WORKSPACE_NAME", )
|
|
1781
|
-
async def main() -> None:
|
|
1782
|
-
await client.traces.create_traces(traces=[TraceWrite(start_time=datetime.datetime.fromisoformat("2024-01-15 09:30:00+00:00", ), )], )
|
|
1783
|
-
asyncio.run(main())
|
|
1784
|
-
"""
|
|
1785
|
-
_response = await self._raw_client.create_traces(traces=traces, request_options=request_options)
|
|
1786
|
-
return _response.data
|
|
1787
|
-
|
|
1788
|
-
async def get_trace_by_id(self, id: str, *, request_options: typing.Optional[RequestOptions] = None) -> TracePublic:
|
|
2094
|
+
async def get_trace_by_id(
|
|
2095
|
+
self,
|
|
2096
|
+
id: str,
|
|
2097
|
+
*,
|
|
2098
|
+
strip_attachments: typing.Optional[bool] = None,
|
|
2099
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
2100
|
+
) -> TracePublic:
|
|
1789
2101
|
"""
|
|
1790
2102
|
Get trace by id
|
|
1791
2103
|
|
|
@@ -1793,6 +2105,8 @@ class AsyncTracesClient:
|
|
|
1793
2105
|
----------
|
|
1794
2106
|
id : str
|
|
1795
2107
|
|
|
2108
|
+
strip_attachments : typing.Optional[bool]
|
|
2109
|
+
|
|
1796
2110
|
request_options : typing.Optional[RequestOptions]
|
|
1797
2111
|
Request-specific configuration.
|
|
1798
2112
|
|
|
@@ -1810,7 +2124,9 @@ class AsyncTracesClient:
|
|
|
1810
2124
|
await client.traces.get_trace_by_id(id='id', )
|
|
1811
2125
|
asyncio.run(main())
|
|
1812
2126
|
"""
|
|
1813
|
-
_response = await self._raw_client.get_trace_by_id(
|
|
2127
|
+
_response = await self._raw_client.get_trace_by_id(
|
|
2128
|
+
id, strip_attachments=strip_attachments, request_options=request_options
|
|
2129
|
+
)
|
|
1814
2130
|
return _response.data
|
|
1815
2131
|
|
|
1816
2132
|
async def delete_trace_by_id(self, id: str, *, request_options: typing.Optional[RequestOptions] = None) -> None:
|
|
@@ -1850,7 +2166,7 @@ class AsyncTracesClient:
|
|
|
1850
2166
|
end_time: typing.Optional[dt.datetime] = OMIT,
|
|
1851
2167
|
input: typing.Optional[JsonListString] = OMIT,
|
|
1852
2168
|
output: typing.Optional[JsonListString] = OMIT,
|
|
1853
|
-
metadata: typing.Optional[
|
|
2169
|
+
metadata: typing.Optional[JsonListString] = OMIT,
|
|
1854
2170
|
tags: typing.Optional[typing.Sequence[str]] = OMIT,
|
|
1855
2171
|
error_info: typing.Optional[ErrorInfo] = OMIT,
|
|
1856
2172
|
thread_id: typing.Optional[str] = OMIT,
|
|
@@ -1877,7 +2193,7 @@ class AsyncTracesClient:
|
|
|
1877
2193
|
|
|
1878
2194
|
output : typing.Optional[JsonListString]
|
|
1879
2195
|
|
|
1880
|
-
metadata : typing.Optional[
|
|
2196
|
+
metadata : typing.Optional[JsonListString]
|
|
1881
2197
|
|
|
1882
2198
|
tags : typing.Optional[typing.Sequence[str]]
|
|
1883
2199
|
|
|
@@ -2162,14 +2478,14 @@ class AsyncTracesClient:
|
|
|
2162
2478
|
return _response.data
|
|
2163
2479
|
|
|
2164
2480
|
async def find_trace_threads_feedback_score_names(
|
|
2165
|
-
self, *, project_id: str, request_options: typing.Optional[RequestOptions] = None
|
|
2481
|
+
self, *, project_id: typing.Optional[str] = None, request_options: typing.Optional[RequestOptions] = None
|
|
2166
2482
|
) -> typing.List[str]:
|
|
2167
2483
|
"""
|
|
2168
2484
|
Find Trace Threads Feedback Score names
|
|
2169
2485
|
|
|
2170
2486
|
Parameters
|
|
2171
2487
|
----------
|
|
2172
|
-
project_id : str
|
|
2488
|
+
project_id : typing.Optional[str]
|
|
2173
2489
|
|
|
2174
2490
|
request_options : typing.Optional[RequestOptions]
|
|
2175
2491
|
Request-specific configuration.
|
|
@@ -2185,7 +2501,7 @@ class AsyncTracesClient:
|
|
|
2185
2501
|
import asyncio
|
|
2186
2502
|
client = AsyncOpikApi(api_key="YOUR_API_KEY", workspace_name="YOUR_WORKSPACE_NAME", )
|
|
2187
2503
|
async def main() -> None:
|
|
2188
|
-
await client.traces.find_trace_threads_feedback_score_names(
|
|
2504
|
+
await client.traces.find_trace_threads_feedback_score_names()
|
|
2189
2505
|
asyncio.run(main())
|
|
2190
2506
|
"""
|
|
2191
2507
|
_response = await self._raw_client.find_trace_threads_feedback_score_names(
|
|
@@ -2199,6 +2515,8 @@ class AsyncTracesClient:
|
|
|
2199
2515
|
project_id: typing.Optional[str] = None,
|
|
2200
2516
|
project_name: typing.Optional[str] = None,
|
|
2201
2517
|
filters: typing.Optional[str] = None,
|
|
2518
|
+
from_time: typing.Optional[dt.datetime] = None,
|
|
2519
|
+
to_time: typing.Optional[dt.datetime] = None,
|
|
2202
2520
|
request_options: typing.Optional[RequestOptions] = None,
|
|
2203
2521
|
) -> ProjectStatsPublic:
|
|
2204
2522
|
"""
|
|
@@ -2212,6 +2530,10 @@ class AsyncTracesClient:
|
|
|
2212
2530
|
|
|
2213
2531
|
filters : typing.Optional[str]
|
|
2214
2532
|
|
|
2533
|
+
from_time : typing.Optional[dt.datetime]
|
|
2534
|
+
|
|
2535
|
+
to_time : typing.Optional[dt.datetime]
|
|
2536
|
+
|
|
2215
2537
|
request_options : typing.Optional[RequestOptions]
|
|
2216
2538
|
Request-specific configuration.
|
|
2217
2539
|
|
|
@@ -2230,7 +2552,12 @@ class AsyncTracesClient:
|
|
|
2230
2552
|
asyncio.run(main())
|
|
2231
2553
|
"""
|
|
2232
2554
|
_response = await self._raw_client.get_trace_stats(
|
|
2233
|
-
project_id=project_id,
|
|
2555
|
+
project_id=project_id,
|
|
2556
|
+
project_name=project_name,
|
|
2557
|
+
filters=filters,
|
|
2558
|
+
from_time=from_time,
|
|
2559
|
+
to_time=to_time,
|
|
2560
|
+
request_options=request_options,
|
|
2234
2561
|
)
|
|
2235
2562
|
return _response.data
|
|
2236
2563
|
|
|
@@ -2266,6 +2593,58 @@ class AsyncTracesClient:
|
|
|
2266
2593
|
_response = await self._raw_client.get_thread_comment(comment_id, thread_id, request_options=request_options)
|
|
2267
2594
|
return _response.data
|
|
2268
2595
|
|
|
2596
|
+
async def get_trace_thread_stats(
|
|
2597
|
+
self,
|
|
2598
|
+
*,
|
|
2599
|
+
project_id: typing.Optional[str] = None,
|
|
2600
|
+
project_name: typing.Optional[str] = None,
|
|
2601
|
+
filters: typing.Optional[str] = None,
|
|
2602
|
+
from_time: typing.Optional[dt.datetime] = None,
|
|
2603
|
+
to_time: typing.Optional[dt.datetime] = None,
|
|
2604
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
2605
|
+
) -> ProjectStatsPublic:
|
|
2606
|
+
"""
|
|
2607
|
+
Get trace thread stats
|
|
2608
|
+
|
|
2609
|
+
Parameters
|
|
2610
|
+
----------
|
|
2611
|
+
project_id : typing.Optional[str]
|
|
2612
|
+
|
|
2613
|
+
project_name : typing.Optional[str]
|
|
2614
|
+
|
|
2615
|
+
filters : typing.Optional[str]
|
|
2616
|
+
|
|
2617
|
+
from_time : typing.Optional[dt.datetime]
|
|
2618
|
+
|
|
2619
|
+
to_time : typing.Optional[dt.datetime]
|
|
2620
|
+
|
|
2621
|
+
request_options : typing.Optional[RequestOptions]
|
|
2622
|
+
Request-specific configuration.
|
|
2623
|
+
|
|
2624
|
+
Returns
|
|
2625
|
+
-------
|
|
2626
|
+
ProjectStatsPublic
|
|
2627
|
+
Trace thread stats resource
|
|
2628
|
+
|
|
2629
|
+
Examples
|
|
2630
|
+
--------
|
|
2631
|
+
from Opik import AsyncOpikApi
|
|
2632
|
+
import asyncio
|
|
2633
|
+
client = AsyncOpikApi(api_key="YOUR_API_KEY", workspace_name="YOUR_WORKSPACE_NAME", )
|
|
2634
|
+
async def main() -> None:
|
|
2635
|
+
await client.traces.get_trace_thread_stats()
|
|
2636
|
+
asyncio.run(main())
|
|
2637
|
+
"""
|
|
2638
|
+
_response = await self._raw_client.get_trace_thread_stats(
|
|
2639
|
+
project_id=project_id,
|
|
2640
|
+
project_name=project_name,
|
|
2641
|
+
filters=filters,
|
|
2642
|
+
from_time=from_time,
|
|
2643
|
+
to_time=to_time,
|
|
2644
|
+
request_options=request_options,
|
|
2645
|
+
)
|
|
2646
|
+
return _response.data
|
|
2647
|
+
|
|
2269
2648
|
async def get_trace_comment(
|
|
2270
2649
|
self, comment_id: str, trace_id: str, *, request_options: typing.Optional[RequestOptions] = None
|
|
2271
2650
|
) -> Comment:
|
|
@@ -2304,6 +2683,7 @@ class AsyncTracesClient:
|
|
|
2304
2683
|
thread_id: str,
|
|
2305
2684
|
project_name: typing.Optional[str] = OMIT,
|
|
2306
2685
|
project_id: typing.Optional[str] = OMIT,
|
|
2686
|
+
truncate: typing.Optional[bool] = OMIT,
|
|
2307
2687
|
request_options: typing.Optional[RequestOptions] = None,
|
|
2308
2688
|
) -> TraceThread:
|
|
2309
2689
|
"""
|
|
@@ -2317,6 +2697,8 @@ class AsyncTracesClient:
|
|
|
2317
2697
|
|
|
2318
2698
|
project_id : typing.Optional[str]
|
|
2319
2699
|
|
|
2700
|
+
truncate : typing.Optional[bool]
|
|
2701
|
+
|
|
2320
2702
|
request_options : typing.Optional[RequestOptions]
|
|
2321
2703
|
Request-specific configuration.
|
|
2322
2704
|
|
|
@@ -2335,7 +2717,11 @@ class AsyncTracesClient:
|
|
|
2335
2717
|
asyncio.run(main())
|
|
2336
2718
|
"""
|
|
2337
2719
|
_response = await self._raw_client.get_trace_thread(
|
|
2338
|
-
thread_id=thread_id,
|
|
2720
|
+
thread_id=thread_id,
|
|
2721
|
+
project_name=project_name,
|
|
2722
|
+
project_id=project_id,
|
|
2723
|
+
truncate=truncate,
|
|
2724
|
+
request_options=request_options,
|
|
2339
2725
|
)
|
|
2340
2726
|
return _response.data
|
|
2341
2727
|
|
|
@@ -2347,8 +2733,11 @@ class AsyncTracesClient:
|
|
|
2347
2733
|
project_name: typing.Optional[str] = None,
|
|
2348
2734
|
project_id: typing.Optional[str] = None,
|
|
2349
2735
|
truncate: typing.Optional[bool] = None,
|
|
2736
|
+
strip_attachments: typing.Optional[bool] = None,
|
|
2350
2737
|
filters: typing.Optional[str] = None,
|
|
2351
2738
|
sorting: typing.Optional[str] = None,
|
|
2739
|
+
from_time: typing.Optional[dt.datetime] = None,
|
|
2740
|
+
to_time: typing.Optional[dt.datetime] = None,
|
|
2352
2741
|
request_options: typing.Optional[RequestOptions] = None,
|
|
2353
2742
|
) -> TraceThreadPage:
|
|
2354
2743
|
"""
|
|
@@ -2366,10 +2755,16 @@ class AsyncTracesClient:
|
|
|
2366
2755
|
|
|
2367
2756
|
truncate : typing.Optional[bool]
|
|
2368
2757
|
|
|
2758
|
+
strip_attachments : typing.Optional[bool]
|
|
2759
|
+
|
|
2369
2760
|
filters : typing.Optional[str]
|
|
2370
2761
|
|
|
2371
2762
|
sorting : typing.Optional[str]
|
|
2372
2763
|
|
|
2764
|
+
from_time : typing.Optional[dt.datetime]
|
|
2765
|
+
|
|
2766
|
+
to_time : typing.Optional[dt.datetime]
|
|
2767
|
+
|
|
2373
2768
|
request_options : typing.Optional[RequestOptions]
|
|
2374
2769
|
Request-specific configuration.
|
|
2375
2770
|
|
|
@@ -2393,8 +2788,11 @@ class AsyncTracesClient:
|
|
|
2393
2788
|
project_name=project_name,
|
|
2394
2789
|
project_id=project_id,
|
|
2395
2790
|
truncate=truncate,
|
|
2791
|
+
strip_attachments=strip_attachments,
|
|
2396
2792
|
filters=filters,
|
|
2397
2793
|
sorting=sorting,
|
|
2794
|
+
from_time=from_time,
|
|
2795
|
+
to_time=to_time,
|
|
2398
2796
|
request_options=request_options,
|
|
2399
2797
|
)
|
|
2400
2798
|
return _response.data
|
|
@@ -2405,6 +2803,7 @@ class AsyncTracesClient:
|
|
|
2405
2803
|
thread_id: str,
|
|
2406
2804
|
project_name: typing.Optional[str] = OMIT,
|
|
2407
2805
|
project_id: typing.Optional[str] = OMIT,
|
|
2806
|
+
truncate: typing.Optional[bool] = OMIT,
|
|
2408
2807
|
request_options: typing.Optional[RequestOptions] = None,
|
|
2409
2808
|
) -> None:
|
|
2410
2809
|
"""
|
|
@@ -2418,6 +2817,8 @@ class AsyncTracesClient:
|
|
|
2418
2817
|
|
|
2419
2818
|
project_id : typing.Optional[str]
|
|
2420
2819
|
|
|
2820
|
+
truncate : typing.Optional[bool]
|
|
2821
|
+
|
|
2421
2822
|
request_options : typing.Optional[RequestOptions]
|
|
2422
2823
|
Request-specific configuration.
|
|
2423
2824
|
|
|
@@ -2435,7 +2836,11 @@ class AsyncTracesClient:
|
|
|
2435
2836
|
asyncio.run(main())
|
|
2436
2837
|
"""
|
|
2437
2838
|
_response = await self._raw_client.open_trace_thread(
|
|
2438
|
-
thread_id=thread_id,
|
|
2839
|
+
thread_id=thread_id,
|
|
2840
|
+
project_name=project_name,
|
|
2841
|
+
project_id=project_id,
|
|
2842
|
+
truncate=truncate,
|
|
2843
|
+
request_options=request_options,
|
|
2439
2844
|
)
|
|
2440
2845
|
return _response.data
|
|
2441
2846
|
|
|
@@ -2466,7 +2871,7 @@ class AsyncTracesClient:
|
|
|
2466
2871
|
import asyncio
|
|
2467
2872
|
client = AsyncOpikApi(api_key="YOUR_API_KEY", workspace_name="YOUR_WORKSPACE_NAME", )
|
|
2468
2873
|
async def main() -> None:
|
|
2469
|
-
await client.traces.score_batch_of_threads(scores=[FeedbackScoreBatchItemThread(
|
|
2874
|
+
await client.traces.score_batch_of_threads(scores=[FeedbackScoreBatchItemThread(name='name', value=1.1, source="ui", thread_id='thread_id', )], )
|
|
2470
2875
|
asyncio.run(main())
|
|
2471
2876
|
"""
|
|
2472
2877
|
_response = await self._raw_client.score_batch_of_threads(scores=scores, request_options=request_options)
|
|
@@ -2499,7 +2904,7 @@ class AsyncTracesClient:
|
|
|
2499
2904
|
import asyncio
|
|
2500
2905
|
client = AsyncOpikApi(api_key="YOUR_API_KEY", workspace_name="YOUR_WORKSPACE_NAME", )
|
|
2501
2906
|
async def main() -> None:
|
|
2502
|
-
await client.traces.score_batch_of_traces(scores=[FeedbackScoreBatchItem(
|
|
2907
|
+
await client.traces.score_batch_of_traces(scores=[FeedbackScoreBatchItem(name='name', value=1.1, source="ui", id='id', )], )
|
|
2503
2908
|
asyncio.run(main())
|
|
2504
2909
|
"""
|
|
2505
2910
|
_response = await self._raw_client.score_batch_of_traces(scores=scores, request_options=request_options)
|
|
@@ -2514,6 +2919,9 @@ class AsyncTracesClient:
|
|
|
2514
2919
|
last_retrieved_thread_model_id: typing.Optional[str] = OMIT,
|
|
2515
2920
|
limit: typing.Optional[int] = OMIT,
|
|
2516
2921
|
truncate: typing.Optional[bool] = OMIT,
|
|
2922
|
+
strip_attachments: typing.Optional[bool] = OMIT,
|
|
2923
|
+
from_time: typing.Optional[dt.datetime] = OMIT,
|
|
2924
|
+
to_time: typing.Optional[dt.datetime] = OMIT,
|
|
2517
2925
|
request_options: typing.Optional[RequestOptions] = None,
|
|
2518
2926
|
) -> typing.AsyncIterator[bytes]:
|
|
2519
2927
|
"""
|
|
@@ -2533,7 +2941,16 @@ class AsyncTracesClient:
|
|
|
2533
2941
|
Max number of trace thread to be streamed
|
|
2534
2942
|
|
|
2535
2943
|
truncate : typing.Optional[bool]
|
|
2536
|
-
Truncate
|
|
2944
|
+
Truncate input, output and metadata to slim payloads
|
|
2945
|
+
|
|
2946
|
+
strip_attachments : typing.Optional[bool]
|
|
2947
|
+
If true, returns attachment references like [file.png]; if false, downloads and reinjects stripped attachments
|
|
2948
|
+
|
|
2949
|
+
from_time : typing.Optional[dt.datetime]
|
|
2950
|
+
Filter trace threads created from this time (ISO-8601 format).
|
|
2951
|
+
|
|
2952
|
+
to_time : typing.Optional[dt.datetime]
|
|
2953
|
+
Filter trace threads created up to this time (ISO-8601 format). If not provided, defaults to current time. Must be after 'from_time'.
|
|
2537
2954
|
|
|
2538
2955
|
request_options : typing.Optional[RequestOptions]
|
|
2539
2956
|
Request-specific configuration. You can pass in configuration such as `chunk_size`, and more to customize the request and response.
|
|
@@ -2550,6 +2967,9 @@ class AsyncTracesClient:
|
|
|
2550
2967
|
last_retrieved_thread_model_id=last_retrieved_thread_model_id,
|
|
2551
2968
|
limit=limit,
|
|
2552
2969
|
truncate=truncate,
|
|
2970
|
+
strip_attachments=strip_attachments,
|
|
2971
|
+
from_time=from_time,
|
|
2972
|
+
to_time=to_time,
|
|
2553
2973
|
request_options=request_options,
|
|
2554
2974
|
) as r:
|
|
2555
2975
|
async for data in r.data:
|
|
@@ -2564,6 +2984,9 @@ class AsyncTracesClient:
|
|
|
2564
2984
|
last_retrieved_id: typing.Optional[str] = OMIT,
|
|
2565
2985
|
limit: typing.Optional[int] = OMIT,
|
|
2566
2986
|
truncate: typing.Optional[bool] = OMIT,
|
|
2987
|
+
strip_attachments: typing.Optional[bool] = OMIT,
|
|
2988
|
+
from_time: typing.Optional[dt.datetime] = OMIT,
|
|
2989
|
+
to_time: typing.Optional[dt.datetime] = OMIT,
|
|
2567
2990
|
request_options: typing.Optional[RequestOptions] = None,
|
|
2568
2991
|
) -> typing.AsyncIterator[bytes]:
|
|
2569
2992
|
"""
|
|
@@ -2583,7 +3006,16 @@ class AsyncTracesClient:
|
|
|
2583
3006
|
Max number of traces to be streamed
|
|
2584
3007
|
|
|
2585
3008
|
truncate : typing.Optional[bool]
|
|
2586
|
-
Truncate
|
|
3009
|
+
Truncate input, output and metadata to slim payloads
|
|
3010
|
+
|
|
3011
|
+
strip_attachments : typing.Optional[bool]
|
|
3012
|
+
If true, returns attachment references like [file.png]; if false, downloads and reinjects stripped attachments
|
|
3013
|
+
|
|
3014
|
+
from_time : typing.Optional[dt.datetime]
|
|
3015
|
+
Filter traces created from this time (ISO-8601 format).
|
|
3016
|
+
|
|
3017
|
+
to_time : typing.Optional[dt.datetime]
|
|
3018
|
+
Filter traces created up to this time (ISO-8601 format). If not provided, defaults to current time. Must be after 'from_time'.
|
|
2587
3019
|
|
|
2588
3020
|
request_options : typing.Optional[RequestOptions]
|
|
2589
3021
|
Request-specific configuration. You can pass in configuration such as `chunk_size`, and more to customize the request and response.
|
|
@@ -2600,6 +3032,9 @@ class AsyncTracesClient:
|
|
|
2600
3032
|
last_retrieved_id=last_retrieved_id,
|
|
2601
3033
|
limit=limit,
|
|
2602
3034
|
truncate=truncate,
|
|
3035
|
+
strip_attachments=strip_attachments,
|
|
3036
|
+
from_time=from_time,
|
|
3037
|
+
to_time=to_time,
|
|
2603
3038
|
request_options=request_options,
|
|
2604
3039
|
) as r:
|
|
2605
3040
|
async for data in r.data:
|
|
@@ -2609,12 +3044,7 @@ class AsyncTracesClient:
|
|
|
2609
3044
|
self,
|
|
2610
3045
|
thread_model_id: str,
|
|
2611
3046
|
*,
|
|
2612
|
-
|
|
2613
|
-
id: typing.Optional[str] = OMIT,
|
|
2614
|
-
created_at: typing.Optional[dt.datetime] = OMIT,
|
|
2615
|
-
last_updated_at: typing.Optional[dt.datetime] = OMIT,
|
|
2616
|
-
created_by: typing.Optional[str] = OMIT,
|
|
2617
|
-
last_updated_by: typing.Optional[str] = OMIT,
|
|
3047
|
+
tags: typing.Optional[typing.Sequence[str]] = OMIT,
|
|
2618
3048
|
request_options: typing.Optional[RequestOptions] = None,
|
|
2619
3049
|
) -> None:
|
|
2620
3050
|
"""
|
|
@@ -2624,17 +3054,7 @@ class AsyncTracesClient:
|
|
|
2624
3054
|
----------
|
|
2625
3055
|
thread_model_id : str
|
|
2626
3056
|
|
|
2627
|
-
|
|
2628
|
-
|
|
2629
|
-
id : typing.Optional[str]
|
|
2630
|
-
|
|
2631
|
-
created_at : typing.Optional[dt.datetime]
|
|
2632
|
-
|
|
2633
|
-
last_updated_at : typing.Optional[dt.datetime]
|
|
2634
|
-
|
|
2635
|
-
created_by : typing.Optional[str]
|
|
2636
|
-
|
|
2637
|
-
last_updated_by : typing.Optional[str]
|
|
3057
|
+
tags : typing.Optional[typing.Sequence[str]]
|
|
2638
3058
|
|
|
2639
3059
|
request_options : typing.Optional[RequestOptions]
|
|
2640
3060
|
Request-specific configuration.
|
|
@@ -2649,19 +3069,10 @@ class AsyncTracesClient:
|
|
|
2649
3069
|
import asyncio
|
|
2650
3070
|
client = AsyncOpikApi(api_key="YOUR_API_KEY", workspace_name="YOUR_WORKSPACE_NAME", )
|
|
2651
3071
|
async def main() -> None:
|
|
2652
|
-
await client.traces.update_thread(thread_model_id='threadModelId',
|
|
3072
|
+
await client.traces.update_thread(thread_model_id='threadModelId', )
|
|
2653
3073
|
asyncio.run(main())
|
|
2654
3074
|
"""
|
|
2655
|
-
_response = await self._raw_client.update_thread(
|
|
2656
|
-
thread_model_id,
|
|
2657
|
-
text=text,
|
|
2658
|
-
id=id,
|
|
2659
|
-
created_at=created_at,
|
|
2660
|
-
last_updated_at=last_updated_at,
|
|
2661
|
-
created_by=created_by,
|
|
2662
|
-
last_updated_by=last_updated_by,
|
|
2663
|
-
request_options=request_options,
|
|
2664
|
-
)
|
|
3075
|
+
_response = await self._raw_client.update_thread(thread_model_id, tags=tags, request_options=request_options)
|
|
2665
3076
|
return _response.data
|
|
2666
3077
|
|
|
2667
3078
|
async def update_thread_comment(
|