opik 1.9.41__py3-none-any.whl → 1.9.86__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/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/constants.py +2 -0
- opik/api_objects/dataset/dataset.py +133 -40
- opik/api_objects/dataset/rest_operations.py +2 -0
- opik/api_objects/experiment/experiment.py +6 -0
- opik/api_objects/helpers.py +8 -4
- opik/api_objects/local_recording.py +6 -5
- opik/api_objects/observation_data.py +101 -0
- opik/api_objects/opik_client.py +78 -45
- opik/api_objects/opik_query_language.py +9 -3
- opik/api_objects/prompt/chat/chat_prompt.py +18 -1
- opik/api_objects/prompt/client.py +8 -1
- opik/api_objects/span/span_data.py +3 -88
- opik/api_objects/threads/threads_client.py +7 -4
- opik/api_objects/trace/trace_data.py +3 -74
- opik/api_objects/validation_helpers.py +3 -3
- 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/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 +14 -12
- opik/config.py +12 -1
- opik/datetime_helpers.py +12 -0
- opik/decorator/arguments_helpers.py +4 -1
- opik/decorator/base_track_decorator.py +111 -37
- opik/decorator/context_manager/span_context_manager.py +5 -1
- opik/decorator/generator_wrappers.py +5 -4
- opik/decorator/span_creation_handler.py +13 -4
- opik/evaluation/engine/engine.py +111 -28
- opik/evaluation/engine/evaluation_tasks_executor.py +71 -19
- opik/evaluation/evaluator.py +12 -0
- opik/evaluation/metrics/conversation/llm_judges/conversational_coherence/metric.py +3 -1
- opik/evaluation/metrics/conversation/llm_judges/session_completeness/metric.py +3 -1
- opik/evaluation/metrics/conversation/llm_judges/user_frustration/metric.py +3 -1
- opik/evaluation/metrics/heuristics/equals.py +11 -7
- opik/evaluation/metrics/llm_judges/answer_relevance/metric.py +3 -1
- opik/evaluation/metrics/llm_judges/context_precision/metric.py +3 -1
- opik/evaluation/metrics/llm_judges/context_recall/metric.py +3 -1
- opik/evaluation/metrics/llm_judges/factuality/metric.py +1 -1
- opik/evaluation/metrics/llm_judges/g_eval/metric.py +3 -1
- opik/evaluation/metrics/llm_judges/hallucination/metric.py +3 -1
- opik/evaluation/metrics/llm_judges/moderation/metric.py +3 -1
- opik/evaluation/metrics/llm_judges/structure_output_compliance/metric.py +3 -1
- opik/evaluation/metrics/llm_judges/syc_eval/metric.py +4 -2
- opik/evaluation/metrics/llm_judges/trajectory_accuracy/metric.py +3 -1
- opik/evaluation/metrics/llm_judges/usefulness/metric.py +3 -1
- opik/evaluation/metrics/ragas_metric.py +43 -23
- opik/evaluation/models/litellm/litellm_chat_model.py +7 -2
- opik/evaluation/models/litellm/util.py +4 -20
- opik/evaluation/models/models_factory.py +19 -5
- opik/evaluation/rest_operations.py +3 -3
- opik/evaluation/threads/helpers.py +3 -2
- opik/file_upload/file_uploader.py +13 -0
- opik/file_upload/upload_options.py +2 -0
- opik/integrations/adk/legacy_opik_tracer.py +9 -11
- opik/integrations/adk/opik_tracer.py +2 -2
- opik/integrations/adk/patchers/adk_otel_tracer/opik_adk_otel_tracer.py +2 -2
- opik/integrations/dspy/callback.py +100 -14
- 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_tracer.py +2 -2
- opik/integrations/langchain/__init__.py +15 -2
- opik/integrations/langchain/langgraph_tracer_injector.py +88 -0
- opik/integrations/langchain/opik_tracer.py +258 -160
- opik/integrations/langchain/provider_usage_extractors/langchain_run_helpers/helpers.py +7 -4
- opik/integrations/llama_index/callback.py +43 -6
- opik/integrations/openai/agents/opik_tracing_processor.py +8 -10
- opik/integrations/openai/opik_tracker.py +99 -4
- opik/integrations/openai/videos/__init__.py +9 -0
- opik/integrations/openai/videos/binary_response_write_to_file_decorator.py +88 -0
- opik/integrations/openai/videos/videos_create_decorator.py +159 -0
- opik/integrations/openai/videos/videos_download_decorator.py +110 -0
- opik/message_processing/batching/base_batcher.py +14 -21
- opik/message_processing/batching/batch_manager.py +22 -10
- opik/message_processing/batching/batchers.py +32 -40
- opik/message_processing/batching/flushing_thread.py +0 -3
- opik/message_processing/emulation/emulator_message_processor.py +36 -1
- opik/message_processing/emulation/models.py +21 -0
- opik/message_processing/messages.py +9 -0
- 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/{message_processors.py → processors/message_processors.py} +15 -1
- opik/message_processing/{message_processors_chain.py → processors/message_processors_chain.py} +3 -2
- opik/message_processing/{online_message_processor.py → processors/online_message_processor.py} +11 -9
- opik/message_processing/queue_consumer.py +4 -2
- opik/message_processing/streamer.py +71 -33
- opik/message_processing/streamer_constructors.py +36 -8
- opik/plugins/pytest/experiment_runner.py +1 -1
- opik/plugins/pytest/hooks.py +5 -3
- opik/rest_api/__init__.py +38 -0
- opik/rest_api/datasets/client.py +249 -148
- opik/rest_api/datasets/raw_client.py +356 -217
- opik/rest_api/experiments/client.py +26 -0
- opik/rest_api/experiments/raw_client.py +26 -0
- opik/rest_api/llm_provider_key/client.py +4 -4
- opik/rest_api/llm_provider_key/raw_client.py +4 -4
- opik/rest_api/llm_provider_key/types/provider_api_key_write_provider.py +2 -1
- opik/rest_api/manual_evaluation/client.py +101 -0
- opik/rest_api/manual_evaluation/raw_client.py +172 -0
- opik/rest_api/optimizations/client.py +0 -166
- opik/rest_api/optimizations/raw_client.py +0 -248
- opik/rest_api/projects/client.py +9 -0
- opik/rest_api/projects/raw_client.py +13 -0
- opik/rest_api/projects/types/project_metric_request_public_metric_type.py +4 -0
- opik/rest_api/prompts/client.py +130 -2
- opik/rest_api/prompts/raw_client.py +175 -0
- opik/rest_api/traces/client.py +101 -0
- opik/rest_api/traces/raw_client.py +120 -0
- opik/rest_api/types/__init__.py +46 -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 +38 -2
- opik/rest_api/types/automation_rule_evaluator_object_object_public.py +33 -2
- opik/rest_api/types/automation_rule_evaluator_public.py +33 -2
- 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_update.py +27 -1
- opik/rest_api/types/automation_rule_evaluator_update_span_user_defined_metric_python.py +22 -0
- opik/rest_api/types/automation_rule_evaluator_write.py +27 -1
- opik/rest_api/types/dataset_item.py +1 -1
- opik/rest_api/types/dataset_item_batch.py +4 -0
- opik/rest_api/types/dataset_item_changes_public.py +5 -0
- opik/rest_api/types/dataset_item_compare.py +1 -1
- opik/rest_api/types/dataset_item_filter.py +4 -0
- opik/rest_api/types/dataset_item_page_compare.py +0 -1
- opik/rest_api/types/dataset_item_page_public.py +0 -1
- opik/rest_api/types/dataset_item_public.py +1 -1
- opik/rest_api/types/dataset_version_public.py +5 -0
- opik/rest_api/types/dataset_version_summary.py +5 -0
- opik/rest_api/types/dataset_version_summary_public.py +5 -0
- opik/rest_api/types/experiment.py +9 -0
- opik/rest_api/types/experiment_public.py +9 -0
- opik/rest_api/types/llm_as_judge_message_content.py +2 -0
- opik/rest_api/types/llm_as_judge_message_content_public.py +2 -0
- opik/rest_api/types/llm_as_judge_message_content_write.py +2 -0
- opik/rest_api/types/manual_evaluation_request_entity_type.py +1 -1
- opik/rest_api/types/project.py +1 -0
- opik/rest_api/types/project_detailed.py +1 -0
- opik/rest_api/types/project_metric_response_public_metric_type.py +4 -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_version.py +1 -0
- opik/rest_api/types/prompt_version_detail.py +1 -0
- opik/rest_api/types/prompt_version_page_public.py +5 -0
- opik/rest_api/types/prompt_version_public.py +1 -0
- opik/rest_api/types/prompt_version_update.py +33 -0
- opik/rest_api/types/provider_api_key.py +5 -1
- opik/rest_api/types/provider_api_key_provider.py +2 -1
- opik/rest_api/types/provider_api_key_public.py +5 -1
- opik/rest_api/types/provider_api_key_public_provider.py +2 -1
- opik/rest_api/types/service_toggles_config.py +11 -1
- 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/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.41.dist-info → opik-1.9.86.dist-info}/METADATA +5 -5
- {opik-1.9.41.dist-info → opik-1.9.86.dist-info}/RECORD +190 -141
- opik/cli/export.py +0 -791
- opik/cli/import_command.py +0 -575
- {opik-1.9.41.dist-info → opik-1.9.86.dist-info}/WHEEL +0 -0
- {opik-1.9.41.dist-info → opik-1.9.86.dist-info}/entry_points.txt +0 -0
- {opik-1.9.41.dist-info → opik-1.9.86.dist-info}/licenses/LICENSE +0 -0
- {opik-1.9.41.dist-info → opik-1.9.86.dist-info}/top_level.txt +0 -0
|
@@ -256,59 +256,6 @@ class OptimizationsClient:
|
|
|
256
256
|
_response = self._raw_client.delete_optimizations_by_id(ids=ids, request_options=request_options)
|
|
257
257
|
return _response.data
|
|
258
258
|
|
|
259
|
-
def find_studio_optimizations(
|
|
260
|
-
self,
|
|
261
|
-
*,
|
|
262
|
-
page: typing.Optional[int] = None,
|
|
263
|
-
size: typing.Optional[int] = None,
|
|
264
|
-
dataset_id: typing.Optional[str] = None,
|
|
265
|
-
name: typing.Optional[str] = None,
|
|
266
|
-
dataset_deleted: typing.Optional[bool] = None,
|
|
267
|
-
filters: typing.Optional[str] = None,
|
|
268
|
-
request_options: typing.Optional[RequestOptions] = None,
|
|
269
|
-
) -> OptimizationPagePublic:
|
|
270
|
-
"""
|
|
271
|
-
Find Studio optimizations
|
|
272
|
-
|
|
273
|
-
Parameters
|
|
274
|
-
----------
|
|
275
|
-
page : typing.Optional[int]
|
|
276
|
-
|
|
277
|
-
size : typing.Optional[int]
|
|
278
|
-
|
|
279
|
-
dataset_id : typing.Optional[str]
|
|
280
|
-
|
|
281
|
-
name : typing.Optional[str]
|
|
282
|
-
|
|
283
|
-
dataset_deleted : typing.Optional[bool]
|
|
284
|
-
|
|
285
|
-
filters : typing.Optional[str]
|
|
286
|
-
|
|
287
|
-
request_options : typing.Optional[RequestOptions]
|
|
288
|
-
Request-specific configuration.
|
|
289
|
-
|
|
290
|
-
Returns
|
|
291
|
-
-------
|
|
292
|
-
OptimizationPagePublic
|
|
293
|
-
Studio optimizations resource
|
|
294
|
-
|
|
295
|
-
Examples
|
|
296
|
-
--------
|
|
297
|
-
from Opik import OpikApi
|
|
298
|
-
client = OpikApi(api_key="YOUR_API_KEY", workspace_name="YOUR_WORKSPACE_NAME", )
|
|
299
|
-
client.optimizations.find_studio_optimizations()
|
|
300
|
-
"""
|
|
301
|
-
_response = self._raw_client.find_studio_optimizations(
|
|
302
|
-
page=page,
|
|
303
|
-
size=size,
|
|
304
|
-
dataset_id=dataset_id,
|
|
305
|
-
name=name,
|
|
306
|
-
dataset_deleted=dataset_deleted,
|
|
307
|
-
filters=filters,
|
|
308
|
-
request_options=request_options,
|
|
309
|
-
)
|
|
310
|
-
return _response.data
|
|
311
|
-
|
|
312
259
|
def get_optimization_by_id(
|
|
313
260
|
self, id: str, *, request_options: typing.Optional[RequestOptions] = None
|
|
314
261
|
) -> OptimizationPublic:
|
|
@@ -373,33 +320,6 @@ class OptimizationsClient:
|
|
|
373
320
|
)
|
|
374
321
|
return _response.data
|
|
375
322
|
|
|
376
|
-
def get_studio_optimization_by_id(
|
|
377
|
-
self, id: str, *, request_options: typing.Optional[RequestOptions] = None
|
|
378
|
-
) -> OptimizationPublic:
|
|
379
|
-
"""
|
|
380
|
-
Get Studio optimization with config included
|
|
381
|
-
|
|
382
|
-
Parameters
|
|
383
|
-
----------
|
|
384
|
-
id : str
|
|
385
|
-
|
|
386
|
-
request_options : typing.Optional[RequestOptions]
|
|
387
|
-
Request-specific configuration.
|
|
388
|
-
|
|
389
|
-
Returns
|
|
390
|
-
-------
|
|
391
|
-
OptimizationPublic
|
|
392
|
-
Studio optimization resource
|
|
393
|
-
|
|
394
|
-
Examples
|
|
395
|
-
--------
|
|
396
|
-
from Opik import OpikApi
|
|
397
|
-
client = OpikApi(api_key="YOUR_API_KEY", workspace_name="YOUR_WORKSPACE_NAME", )
|
|
398
|
-
client.optimizations.get_studio_optimization_by_id(id='id', )
|
|
399
|
-
"""
|
|
400
|
-
_response = self._raw_client.get_studio_optimization_by_id(id, request_options=request_options)
|
|
401
|
-
return _response.data
|
|
402
|
-
|
|
403
323
|
def get_studio_optimization_logs(
|
|
404
324
|
self, id: str, *, request_options: typing.Optional[RequestOptions] = None
|
|
405
325
|
) -> OptimizationStudioLog:
|
|
@@ -683,62 +603,6 @@ class AsyncOptimizationsClient:
|
|
|
683
603
|
_response = await self._raw_client.delete_optimizations_by_id(ids=ids, request_options=request_options)
|
|
684
604
|
return _response.data
|
|
685
605
|
|
|
686
|
-
async def find_studio_optimizations(
|
|
687
|
-
self,
|
|
688
|
-
*,
|
|
689
|
-
page: typing.Optional[int] = None,
|
|
690
|
-
size: typing.Optional[int] = None,
|
|
691
|
-
dataset_id: typing.Optional[str] = None,
|
|
692
|
-
name: typing.Optional[str] = None,
|
|
693
|
-
dataset_deleted: typing.Optional[bool] = None,
|
|
694
|
-
filters: typing.Optional[str] = None,
|
|
695
|
-
request_options: typing.Optional[RequestOptions] = None,
|
|
696
|
-
) -> OptimizationPagePublic:
|
|
697
|
-
"""
|
|
698
|
-
Find Studio optimizations
|
|
699
|
-
|
|
700
|
-
Parameters
|
|
701
|
-
----------
|
|
702
|
-
page : typing.Optional[int]
|
|
703
|
-
|
|
704
|
-
size : typing.Optional[int]
|
|
705
|
-
|
|
706
|
-
dataset_id : typing.Optional[str]
|
|
707
|
-
|
|
708
|
-
name : typing.Optional[str]
|
|
709
|
-
|
|
710
|
-
dataset_deleted : typing.Optional[bool]
|
|
711
|
-
|
|
712
|
-
filters : typing.Optional[str]
|
|
713
|
-
|
|
714
|
-
request_options : typing.Optional[RequestOptions]
|
|
715
|
-
Request-specific configuration.
|
|
716
|
-
|
|
717
|
-
Returns
|
|
718
|
-
-------
|
|
719
|
-
OptimizationPagePublic
|
|
720
|
-
Studio optimizations resource
|
|
721
|
-
|
|
722
|
-
Examples
|
|
723
|
-
--------
|
|
724
|
-
from Opik import AsyncOpikApi
|
|
725
|
-
import asyncio
|
|
726
|
-
client = AsyncOpikApi(api_key="YOUR_API_KEY", workspace_name="YOUR_WORKSPACE_NAME", )
|
|
727
|
-
async def main() -> None:
|
|
728
|
-
await client.optimizations.find_studio_optimizations()
|
|
729
|
-
asyncio.run(main())
|
|
730
|
-
"""
|
|
731
|
-
_response = await self._raw_client.find_studio_optimizations(
|
|
732
|
-
page=page,
|
|
733
|
-
size=size,
|
|
734
|
-
dataset_id=dataset_id,
|
|
735
|
-
name=name,
|
|
736
|
-
dataset_deleted=dataset_deleted,
|
|
737
|
-
filters=filters,
|
|
738
|
-
request_options=request_options,
|
|
739
|
-
)
|
|
740
|
-
return _response.data
|
|
741
|
-
|
|
742
606
|
async def get_optimization_by_id(
|
|
743
607
|
self, id: str, *, request_options: typing.Optional[RequestOptions] = None
|
|
744
608
|
) -> OptimizationPublic:
|
|
@@ -809,36 +673,6 @@ class AsyncOptimizationsClient:
|
|
|
809
673
|
)
|
|
810
674
|
return _response.data
|
|
811
675
|
|
|
812
|
-
async def get_studio_optimization_by_id(
|
|
813
|
-
self, id: str, *, request_options: typing.Optional[RequestOptions] = None
|
|
814
|
-
) -> OptimizationPublic:
|
|
815
|
-
"""
|
|
816
|
-
Get Studio optimization with config included
|
|
817
|
-
|
|
818
|
-
Parameters
|
|
819
|
-
----------
|
|
820
|
-
id : str
|
|
821
|
-
|
|
822
|
-
request_options : typing.Optional[RequestOptions]
|
|
823
|
-
Request-specific configuration.
|
|
824
|
-
|
|
825
|
-
Returns
|
|
826
|
-
-------
|
|
827
|
-
OptimizationPublic
|
|
828
|
-
Studio optimization resource
|
|
829
|
-
|
|
830
|
-
Examples
|
|
831
|
-
--------
|
|
832
|
-
from Opik import AsyncOpikApi
|
|
833
|
-
import asyncio
|
|
834
|
-
client = AsyncOpikApi(api_key="YOUR_API_KEY", workspace_name="YOUR_WORKSPACE_NAME", )
|
|
835
|
-
async def main() -> None:
|
|
836
|
-
await client.optimizations.get_studio_optimization_by_id(id='id', )
|
|
837
|
-
asyncio.run(main())
|
|
838
|
-
"""
|
|
839
|
-
_response = await self._raw_client.get_studio_optimization_by_id(id, request_options=request_options)
|
|
840
|
-
return _response.data
|
|
841
|
-
|
|
842
676
|
async def get_studio_optimization_logs(
|
|
843
677
|
self, id: str, *, request_options: typing.Optional[RequestOptions] = None
|
|
844
678
|
) -> OptimizationStudioLog:
|
|
@@ -327,81 +327,6 @@ class RawOptimizationsClient:
|
|
|
327
327
|
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
328
328
|
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
329
329
|
|
|
330
|
-
def find_studio_optimizations(
|
|
331
|
-
self,
|
|
332
|
-
*,
|
|
333
|
-
page: typing.Optional[int] = None,
|
|
334
|
-
size: typing.Optional[int] = None,
|
|
335
|
-
dataset_id: typing.Optional[str] = None,
|
|
336
|
-
name: typing.Optional[str] = None,
|
|
337
|
-
dataset_deleted: typing.Optional[bool] = None,
|
|
338
|
-
filters: typing.Optional[str] = None,
|
|
339
|
-
request_options: typing.Optional[RequestOptions] = None,
|
|
340
|
-
) -> HttpResponse[OptimizationPagePublic]:
|
|
341
|
-
"""
|
|
342
|
-
Find Studio optimizations
|
|
343
|
-
|
|
344
|
-
Parameters
|
|
345
|
-
----------
|
|
346
|
-
page : typing.Optional[int]
|
|
347
|
-
|
|
348
|
-
size : typing.Optional[int]
|
|
349
|
-
|
|
350
|
-
dataset_id : typing.Optional[str]
|
|
351
|
-
|
|
352
|
-
name : typing.Optional[str]
|
|
353
|
-
|
|
354
|
-
dataset_deleted : typing.Optional[bool]
|
|
355
|
-
|
|
356
|
-
filters : typing.Optional[str]
|
|
357
|
-
|
|
358
|
-
request_options : typing.Optional[RequestOptions]
|
|
359
|
-
Request-specific configuration.
|
|
360
|
-
|
|
361
|
-
Returns
|
|
362
|
-
-------
|
|
363
|
-
HttpResponse[OptimizationPagePublic]
|
|
364
|
-
Studio optimizations resource
|
|
365
|
-
"""
|
|
366
|
-
_response = self._client_wrapper.httpx_client.request(
|
|
367
|
-
"v1/private/optimizations/studio",
|
|
368
|
-
method="GET",
|
|
369
|
-
params={
|
|
370
|
-
"page": page,
|
|
371
|
-
"size": size,
|
|
372
|
-
"dataset_id": dataset_id,
|
|
373
|
-
"name": name,
|
|
374
|
-
"dataset_deleted": dataset_deleted,
|
|
375
|
-
"filters": filters,
|
|
376
|
-
},
|
|
377
|
-
request_options=request_options,
|
|
378
|
-
)
|
|
379
|
-
try:
|
|
380
|
-
if 200 <= _response.status_code < 300:
|
|
381
|
-
_data = typing.cast(
|
|
382
|
-
OptimizationPagePublic,
|
|
383
|
-
parse_obj_as(
|
|
384
|
-
type_=OptimizationPagePublic, # type: ignore
|
|
385
|
-
object_=_response.json(),
|
|
386
|
-
),
|
|
387
|
-
)
|
|
388
|
-
return HttpResponse(response=_response, data=_data)
|
|
389
|
-
if _response.status_code == 400:
|
|
390
|
-
raise BadRequestError(
|
|
391
|
-
headers=dict(_response.headers),
|
|
392
|
-
body=typing.cast(
|
|
393
|
-
typing.Optional[typing.Any],
|
|
394
|
-
parse_obj_as(
|
|
395
|
-
type_=typing.Optional[typing.Any], # type: ignore
|
|
396
|
-
object_=_response.json(),
|
|
397
|
-
),
|
|
398
|
-
),
|
|
399
|
-
)
|
|
400
|
-
_response_json = _response.json()
|
|
401
|
-
except JSONDecodeError:
|
|
402
|
-
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
403
|
-
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
404
|
-
|
|
405
330
|
def get_optimization_by_id(
|
|
406
331
|
self, id: str, *, request_options: typing.Optional[RequestOptions] = None
|
|
407
332
|
) -> HttpResponse[OptimizationPublic]:
|
|
@@ -498,55 +423,6 @@ class RawOptimizationsClient:
|
|
|
498
423
|
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
499
424
|
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
500
425
|
|
|
501
|
-
def get_studio_optimization_by_id(
|
|
502
|
-
self, id: str, *, request_options: typing.Optional[RequestOptions] = None
|
|
503
|
-
) -> HttpResponse[OptimizationPublic]:
|
|
504
|
-
"""
|
|
505
|
-
Get Studio optimization with config included
|
|
506
|
-
|
|
507
|
-
Parameters
|
|
508
|
-
----------
|
|
509
|
-
id : str
|
|
510
|
-
|
|
511
|
-
request_options : typing.Optional[RequestOptions]
|
|
512
|
-
Request-specific configuration.
|
|
513
|
-
|
|
514
|
-
Returns
|
|
515
|
-
-------
|
|
516
|
-
HttpResponse[OptimizationPublic]
|
|
517
|
-
Studio optimization resource
|
|
518
|
-
"""
|
|
519
|
-
_response = self._client_wrapper.httpx_client.request(
|
|
520
|
-
f"v1/private/optimizations/studio/{jsonable_encoder(id)}",
|
|
521
|
-
method="GET",
|
|
522
|
-
request_options=request_options,
|
|
523
|
-
)
|
|
524
|
-
try:
|
|
525
|
-
if 200 <= _response.status_code < 300:
|
|
526
|
-
_data = typing.cast(
|
|
527
|
-
OptimizationPublic,
|
|
528
|
-
parse_obj_as(
|
|
529
|
-
type_=OptimizationPublic, # type: ignore
|
|
530
|
-
object_=_response.json(),
|
|
531
|
-
),
|
|
532
|
-
)
|
|
533
|
-
return HttpResponse(response=_response, data=_data)
|
|
534
|
-
if _response.status_code == 404:
|
|
535
|
-
raise NotFoundError(
|
|
536
|
-
headers=dict(_response.headers),
|
|
537
|
-
body=typing.cast(
|
|
538
|
-
typing.Optional[typing.Any],
|
|
539
|
-
parse_obj_as(
|
|
540
|
-
type_=typing.Optional[typing.Any], # type: ignore
|
|
541
|
-
object_=_response.json(),
|
|
542
|
-
),
|
|
543
|
-
),
|
|
544
|
-
)
|
|
545
|
-
_response_json = _response.json()
|
|
546
|
-
except JSONDecodeError:
|
|
547
|
-
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
548
|
-
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
549
|
-
|
|
550
426
|
def get_studio_optimization_logs(
|
|
551
427
|
self, id: str, *, request_options: typing.Optional[RequestOptions] = None
|
|
552
428
|
) -> HttpResponse[OptimizationStudioLog]:
|
|
@@ -898,81 +774,6 @@ class AsyncRawOptimizationsClient:
|
|
|
898
774
|
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
899
775
|
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
900
776
|
|
|
901
|
-
async def find_studio_optimizations(
|
|
902
|
-
self,
|
|
903
|
-
*,
|
|
904
|
-
page: typing.Optional[int] = None,
|
|
905
|
-
size: typing.Optional[int] = None,
|
|
906
|
-
dataset_id: typing.Optional[str] = None,
|
|
907
|
-
name: typing.Optional[str] = None,
|
|
908
|
-
dataset_deleted: typing.Optional[bool] = None,
|
|
909
|
-
filters: typing.Optional[str] = None,
|
|
910
|
-
request_options: typing.Optional[RequestOptions] = None,
|
|
911
|
-
) -> AsyncHttpResponse[OptimizationPagePublic]:
|
|
912
|
-
"""
|
|
913
|
-
Find Studio optimizations
|
|
914
|
-
|
|
915
|
-
Parameters
|
|
916
|
-
----------
|
|
917
|
-
page : typing.Optional[int]
|
|
918
|
-
|
|
919
|
-
size : typing.Optional[int]
|
|
920
|
-
|
|
921
|
-
dataset_id : typing.Optional[str]
|
|
922
|
-
|
|
923
|
-
name : typing.Optional[str]
|
|
924
|
-
|
|
925
|
-
dataset_deleted : typing.Optional[bool]
|
|
926
|
-
|
|
927
|
-
filters : typing.Optional[str]
|
|
928
|
-
|
|
929
|
-
request_options : typing.Optional[RequestOptions]
|
|
930
|
-
Request-specific configuration.
|
|
931
|
-
|
|
932
|
-
Returns
|
|
933
|
-
-------
|
|
934
|
-
AsyncHttpResponse[OptimizationPagePublic]
|
|
935
|
-
Studio optimizations resource
|
|
936
|
-
"""
|
|
937
|
-
_response = await self._client_wrapper.httpx_client.request(
|
|
938
|
-
"v1/private/optimizations/studio",
|
|
939
|
-
method="GET",
|
|
940
|
-
params={
|
|
941
|
-
"page": page,
|
|
942
|
-
"size": size,
|
|
943
|
-
"dataset_id": dataset_id,
|
|
944
|
-
"name": name,
|
|
945
|
-
"dataset_deleted": dataset_deleted,
|
|
946
|
-
"filters": filters,
|
|
947
|
-
},
|
|
948
|
-
request_options=request_options,
|
|
949
|
-
)
|
|
950
|
-
try:
|
|
951
|
-
if 200 <= _response.status_code < 300:
|
|
952
|
-
_data = typing.cast(
|
|
953
|
-
OptimizationPagePublic,
|
|
954
|
-
parse_obj_as(
|
|
955
|
-
type_=OptimizationPagePublic, # type: ignore
|
|
956
|
-
object_=_response.json(),
|
|
957
|
-
),
|
|
958
|
-
)
|
|
959
|
-
return AsyncHttpResponse(response=_response, data=_data)
|
|
960
|
-
if _response.status_code == 400:
|
|
961
|
-
raise BadRequestError(
|
|
962
|
-
headers=dict(_response.headers),
|
|
963
|
-
body=typing.cast(
|
|
964
|
-
typing.Optional[typing.Any],
|
|
965
|
-
parse_obj_as(
|
|
966
|
-
type_=typing.Optional[typing.Any], # type: ignore
|
|
967
|
-
object_=_response.json(),
|
|
968
|
-
),
|
|
969
|
-
),
|
|
970
|
-
)
|
|
971
|
-
_response_json = _response.json()
|
|
972
|
-
except JSONDecodeError:
|
|
973
|
-
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
974
|
-
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
975
|
-
|
|
976
777
|
async def get_optimization_by_id(
|
|
977
778
|
self, id: str, *, request_options: typing.Optional[RequestOptions] = None
|
|
978
779
|
) -> AsyncHttpResponse[OptimizationPublic]:
|
|
@@ -1069,55 +870,6 @@ class AsyncRawOptimizationsClient:
|
|
|
1069
870
|
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
1070
871
|
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
1071
872
|
|
|
1072
|
-
async def get_studio_optimization_by_id(
|
|
1073
|
-
self, id: str, *, request_options: typing.Optional[RequestOptions] = None
|
|
1074
|
-
) -> AsyncHttpResponse[OptimizationPublic]:
|
|
1075
|
-
"""
|
|
1076
|
-
Get Studio optimization with config included
|
|
1077
|
-
|
|
1078
|
-
Parameters
|
|
1079
|
-
----------
|
|
1080
|
-
id : str
|
|
1081
|
-
|
|
1082
|
-
request_options : typing.Optional[RequestOptions]
|
|
1083
|
-
Request-specific configuration.
|
|
1084
|
-
|
|
1085
|
-
Returns
|
|
1086
|
-
-------
|
|
1087
|
-
AsyncHttpResponse[OptimizationPublic]
|
|
1088
|
-
Studio optimization resource
|
|
1089
|
-
"""
|
|
1090
|
-
_response = await self._client_wrapper.httpx_client.request(
|
|
1091
|
-
f"v1/private/optimizations/studio/{jsonable_encoder(id)}",
|
|
1092
|
-
method="GET",
|
|
1093
|
-
request_options=request_options,
|
|
1094
|
-
)
|
|
1095
|
-
try:
|
|
1096
|
-
if 200 <= _response.status_code < 300:
|
|
1097
|
-
_data = typing.cast(
|
|
1098
|
-
OptimizationPublic,
|
|
1099
|
-
parse_obj_as(
|
|
1100
|
-
type_=OptimizationPublic, # type: ignore
|
|
1101
|
-
object_=_response.json(),
|
|
1102
|
-
),
|
|
1103
|
-
)
|
|
1104
|
-
return AsyncHttpResponse(response=_response, data=_data)
|
|
1105
|
-
if _response.status_code == 404:
|
|
1106
|
-
raise NotFoundError(
|
|
1107
|
-
headers=dict(_response.headers),
|
|
1108
|
-
body=typing.cast(
|
|
1109
|
-
typing.Optional[typing.Any],
|
|
1110
|
-
parse_obj_as(
|
|
1111
|
-
type_=typing.Optional[typing.Any], # type: ignore
|
|
1112
|
-
object_=_response.json(),
|
|
1113
|
-
),
|
|
1114
|
-
),
|
|
1115
|
-
)
|
|
1116
|
-
_response_json = _response.json()
|
|
1117
|
-
except JSONDecodeError:
|
|
1118
|
-
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
1119
|
-
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
1120
|
-
|
|
1121
873
|
async def get_studio_optimization_logs(
|
|
1122
874
|
self, id: str, *, request_options: typing.Optional[RequestOptions] = None
|
|
1123
875
|
) -> AsyncHttpResponse[OptimizationStudioLog]:
|
opik/rest_api/projects/client.py
CHANGED
|
@@ -11,6 +11,7 @@ from ..types.project_metric_response_public import ProjectMetricResponsePublic
|
|
|
11
11
|
from ..types.project_page_public import ProjectPagePublic
|
|
12
12
|
from ..types.project_public import ProjectPublic
|
|
13
13
|
from ..types.project_stats_summary import ProjectStatsSummary
|
|
14
|
+
from ..types.span_filter_public import SpanFilterPublic
|
|
14
15
|
from ..types.trace_filter_public import TraceFilterPublic
|
|
15
16
|
from ..types.trace_thread_filter_public import TraceThreadFilterPublic
|
|
16
17
|
from .raw_client import AsyncRawProjectsClient, RawProjectsClient
|
|
@@ -268,6 +269,7 @@ class ProjectsClient:
|
|
|
268
269
|
interval: typing.Optional[ProjectMetricRequestPublicInterval] = OMIT,
|
|
269
270
|
interval_start: typing.Optional[dt.datetime] = OMIT,
|
|
270
271
|
interval_end: typing.Optional[dt.datetime] = OMIT,
|
|
272
|
+
span_filters: typing.Optional[typing.Sequence[SpanFilterPublic]] = OMIT,
|
|
271
273
|
trace_filters: typing.Optional[typing.Sequence[TraceFilterPublic]] = OMIT,
|
|
272
274
|
thread_filters: typing.Optional[typing.Sequence[TraceThreadFilterPublic]] = OMIT,
|
|
273
275
|
request_options: typing.Optional[RequestOptions] = None,
|
|
@@ -287,6 +289,8 @@ class ProjectsClient:
|
|
|
287
289
|
|
|
288
290
|
interval_end : typing.Optional[dt.datetime]
|
|
289
291
|
|
|
292
|
+
span_filters : typing.Optional[typing.Sequence[SpanFilterPublic]]
|
|
293
|
+
|
|
290
294
|
trace_filters : typing.Optional[typing.Sequence[TraceFilterPublic]]
|
|
291
295
|
|
|
292
296
|
thread_filters : typing.Optional[typing.Sequence[TraceThreadFilterPublic]]
|
|
@@ -311,6 +315,7 @@ class ProjectsClient:
|
|
|
311
315
|
interval=interval,
|
|
312
316
|
interval_start=interval_start,
|
|
313
317
|
interval_end=interval_end,
|
|
318
|
+
span_filters=span_filters,
|
|
314
319
|
trace_filters=trace_filters,
|
|
315
320
|
thread_filters=thread_filters,
|
|
316
321
|
request_options=request_options,
|
|
@@ -654,6 +659,7 @@ class AsyncProjectsClient:
|
|
|
654
659
|
interval: typing.Optional[ProjectMetricRequestPublicInterval] = OMIT,
|
|
655
660
|
interval_start: typing.Optional[dt.datetime] = OMIT,
|
|
656
661
|
interval_end: typing.Optional[dt.datetime] = OMIT,
|
|
662
|
+
span_filters: typing.Optional[typing.Sequence[SpanFilterPublic]] = OMIT,
|
|
657
663
|
trace_filters: typing.Optional[typing.Sequence[TraceFilterPublic]] = OMIT,
|
|
658
664
|
thread_filters: typing.Optional[typing.Sequence[TraceThreadFilterPublic]] = OMIT,
|
|
659
665
|
request_options: typing.Optional[RequestOptions] = None,
|
|
@@ -673,6 +679,8 @@ class AsyncProjectsClient:
|
|
|
673
679
|
|
|
674
680
|
interval_end : typing.Optional[dt.datetime]
|
|
675
681
|
|
|
682
|
+
span_filters : typing.Optional[typing.Sequence[SpanFilterPublic]]
|
|
683
|
+
|
|
676
684
|
trace_filters : typing.Optional[typing.Sequence[TraceFilterPublic]]
|
|
677
685
|
|
|
678
686
|
thread_filters : typing.Optional[typing.Sequence[TraceThreadFilterPublic]]
|
|
@@ -700,6 +708,7 @@ class AsyncProjectsClient:
|
|
|
700
708
|
interval=interval,
|
|
701
709
|
interval_start=interval_start,
|
|
702
710
|
interval_end=interval_end,
|
|
711
|
+
span_filters=span_filters,
|
|
703
712
|
trace_filters=trace_filters,
|
|
704
713
|
thread_filters=thread_filters,
|
|
705
714
|
request_options=request_options,
|
|
@@ -21,6 +21,7 @@ from ..types.project_metric_response_public import ProjectMetricResponsePublic
|
|
|
21
21
|
from ..types.project_page_public import ProjectPagePublic
|
|
22
22
|
from ..types.project_public import ProjectPublic
|
|
23
23
|
from ..types.project_stats_summary import ProjectStatsSummary
|
|
24
|
+
from ..types.span_filter_public import SpanFilterPublic
|
|
24
25
|
from ..types.trace_filter_public import TraceFilterPublic
|
|
25
26
|
from ..types.trace_thread_filter_public import TraceThreadFilterPublic
|
|
26
27
|
from .types.project_metric_request_public_interval import ProjectMetricRequestPublicInterval
|
|
@@ -400,6 +401,7 @@ class RawProjectsClient:
|
|
|
400
401
|
interval: typing.Optional[ProjectMetricRequestPublicInterval] = OMIT,
|
|
401
402
|
interval_start: typing.Optional[dt.datetime] = OMIT,
|
|
402
403
|
interval_end: typing.Optional[dt.datetime] = OMIT,
|
|
404
|
+
span_filters: typing.Optional[typing.Sequence[SpanFilterPublic]] = OMIT,
|
|
403
405
|
trace_filters: typing.Optional[typing.Sequence[TraceFilterPublic]] = OMIT,
|
|
404
406
|
thread_filters: typing.Optional[typing.Sequence[TraceThreadFilterPublic]] = OMIT,
|
|
405
407
|
request_options: typing.Optional[RequestOptions] = None,
|
|
@@ -419,6 +421,8 @@ class RawProjectsClient:
|
|
|
419
421
|
|
|
420
422
|
interval_end : typing.Optional[dt.datetime]
|
|
421
423
|
|
|
424
|
+
span_filters : typing.Optional[typing.Sequence[SpanFilterPublic]]
|
|
425
|
+
|
|
422
426
|
trace_filters : typing.Optional[typing.Sequence[TraceFilterPublic]]
|
|
423
427
|
|
|
424
428
|
thread_filters : typing.Optional[typing.Sequence[TraceThreadFilterPublic]]
|
|
@@ -439,6 +443,9 @@ class RawProjectsClient:
|
|
|
439
443
|
"interval": interval,
|
|
440
444
|
"interval_start": interval_start,
|
|
441
445
|
"interval_end": interval_end,
|
|
446
|
+
"span_filters": convert_and_respect_annotation_metadata(
|
|
447
|
+
object_=span_filters, annotation=typing.Sequence[SpanFilterPublic], direction="write"
|
|
448
|
+
),
|
|
442
449
|
"trace_filters": convert_and_respect_annotation_metadata(
|
|
443
450
|
object_=trace_filters, annotation=typing.Sequence[TraceFilterPublic], direction="write"
|
|
444
451
|
),
|
|
@@ -992,6 +999,7 @@ class AsyncRawProjectsClient:
|
|
|
992
999
|
interval: typing.Optional[ProjectMetricRequestPublicInterval] = OMIT,
|
|
993
1000
|
interval_start: typing.Optional[dt.datetime] = OMIT,
|
|
994
1001
|
interval_end: typing.Optional[dt.datetime] = OMIT,
|
|
1002
|
+
span_filters: typing.Optional[typing.Sequence[SpanFilterPublic]] = OMIT,
|
|
995
1003
|
trace_filters: typing.Optional[typing.Sequence[TraceFilterPublic]] = OMIT,
|
|
996
1004
|
thread_filters: typing.Optional[typing.Sequence[TraceThreadFilterPublic]] = OMIT,
|
|
997
1005
|
request_options: typing.Optional[RequestOptions] = None,
|
|
@@ -1011,6 +1019,8 @@ class AsyncRawProjectsClient:
|
|
|
1011
1019
|
|
|
1012
1020
|
interval_end : typing.Optional[dt.datetime]
|
|
1013
1021
|
|
|
1022
|
+
span_filters : typing.Optional[typing.Sequence[SpanFilterPublic]]
|
|
1023
|
+
|
|
1014
1024
|
trace_filters : typing.Optional[typing.Sequence[TraceFilterPublic]]
|
|
1015
1025
|
|
|
1016
1026
|
thread_filters : typing.Optional[typing.Sequence[TraceThreadFilterPublic]]
|
|
@@ -1031,6 +1041,9 @@ class AsyncRawProjectsClient:
|
|
|
1031
1041
|
"interval": interval,
|
|
1032
1042
|
"interval_start": interval_start,
|
|
1033
1043
|
"interval_end": interval_end,
|
|
1044
|
+
"span_filters": convert_and_respect_annotation_metadata(
|
|
1045
|
+
object_=span_filters, annotation=typing.Sequence[SpanFilterPublic], direction="write"
|
|
1046
|
+
),
|
|
1034
1047
|
"trace_filters": convert_and_respect_annotation_metadata(
|
|
1035
1048
|
object_=trace_filters, annotation=typing.Sequence[TraceFilterPublic], direction="write"
|
|
1036
1049
|
),
|