opik 1.9.26__py3-none-any.whl → 1.9.39__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- opik/__init__.py +10 -3
- opik/api_objects/dataset/rest_operations.py +2 -0
- opik/api_objects/experiment/experiment.py +31 -5
- opik/api_objects/experiment/helpers.py +34 -10
- opik/api_objects/local_recording.py +8 -3
- opik/api_objects/opik_client.py +218 -46
- opik/api_objects/opik_query_language.py +9 -0
- opik/api_objects/prompt/__init__.py +11 -3
- opik/api_objects/prompt/base_prompt.py +69 -0
- opik/api_objects/prompt/base_prompt_template.py +29 -0
- opik/api_objects/prompt/chat/__init__.py +1 -0
- opik/api_objects/prompt/chat/chat_prompt.py +193 -0
- opik/api_objects/prompt/chat/chat_prompt_template.py +350 -0
- opik/api_objects/prompt/{chat_content_renderer_registry.py → chat/content_renderer_registry.py} +31 -34
- opik/api_objects/prompt/client.py +101 -30
- opik/api_objects/prompt/text/__init__.py +1 -0
- opik/api_objects/prompt/{prompt.py → text/prompt.py} +55 -32
- opik/api_objects/prompt/{prompt_template.py → text/prompt_template.py} +8 -5
- opik/cli/export.py +6 -2
- opik/config.py +0 -5
- opik/decorator/base_track_decorator.py +37 -40
- opik/evaluation/__init__.py +13 -2
- opik/evaluation/engine/engine.py +195 -223
- opik/evaluation/engine/helpers.py +8 -7
- opik/evaluation/engine/metrics_evaluator.py +237 -0
- opik/evaluation/evaluation_result.py +35 -1
- opik/evaluation/evaluator.py +309 -23
- opik/evaluation/models/litellm/util.py +78 -6
- opik/evaluation/report.py +14 -2
- opik/evaluation/rest_operations.py +6 -9
- opik/evaluation/test_case.py +2 -2
- opik/evaluation/types.py +9 -1
- opik/exceptions.py +17 -0
- opik/id_helpers.py +18 -0
- opik/integrations/adk/helpers.py +16 -7
- opik/integrations/adk/legacy_opik_tracer.py +7 -4
- opik/integrations/adk/opik_tracer.py +3 -1
- opik/integrations/adk/patchers/adk_otel_tracer/opik_adk_otel_tracer.py +7 -3
- opik/integrations/dspy/callback.py +1 -4
- opik/integrations/haystack/opik_connector.py +2 -2
- opik/integrations/haystack/opik_tracer.py +2 -4
- opik/integrations/langchain/opik_tracer.py +1 -4
- opik/integrations/llama_index/callback.py +2 -4
- opik/integrations/openai/agents/opik_tracing_processor.py +1 -2
- opik/integrations/openai/opik_tracker.py +1 -1
- opik/opik_context.py +7 -7
- opik/rest_api/__init__.py +123 -11
- opik/rest_api/dashboards/client.py +65 -2
- opik/rest_api/dashboards/raw_client.py +82 -0
- opik/rest_api/datasets/client.py +441 -2
- opik/rest_api/datasets/raw_client.py +1225 -505
- opik/rest_api/experiments/client.py +30 -2
- opik/rest_api/experiments/raw_client.py +26 -0
- opik/rest_api/optimizations/client.py +302 -0
- opik/rest_api/optimizations/raw_client.py +463 -0
- opik/rest_api/optimizations/types/optimization_update_status.py +3 -1
- opik/rest_api/prompts/__init__.py +2 -2
- opik/rest_api/prompts/client.py +34 -4
- opik/rest_api/prompts/raw_client.py +32 -2
- opik/rest_api/prompts/types/__init__.py +3 -1
- opik/rest_api/prompts/types/create_prompt_version_detail_template_structure.py +5 -0
- opik/rest_api/prompts/types/prompt_write_template_structure.py +5 -0
- opik/rest_api/traces/client.py +6 -6
- opik/rest_api/traces/raw_client.py +4 -4
- opik/rest_api/types/__init__.py +121 -11
- opik/rest_api/types/aggregation_data.py +1 -0
- opik/rest_api/types/automation_rule_evaluator.py +23 -1
- opik/rest_api/types/automation_rule_evaluator_llm_as_judge.py +2 -0
- opik/rest_api/types/automation_rule_evaluator_llm_as_judge_public.py +2 -0
- opik/rest_api/types/automation_rule_evaluator_llm_as_judge_write.py +2 -0
- opik/rest_api/types/{automation_rule_evaluator_object_public.py → automation_rule_evaluator_object_object_public.py} +32 -10
- opik/rest_api/types/automation_rule_evaluator_page_public.py +2 -2
- opik/rest_api/types/automation_rule_evaluator_public.py +23 -1
- opik/rest_api/types/automation_rule_evaluator_span_llm_as_judge.py +22 -0
- opik/rest_api/types/automation_rule_evaluator_span_llm_as_judge_public.py +22 -0
- opik/rest_api/types/automation_rule_evaluator_span_llm_as_judge_write.py +22 -0
- opik/rest_api/types/automation_rule_evaluator_trace_thread_llm_as_judge.py +2 -0
- opik/rest_api/types/automation_rule_evaluator_trace_thread_llm_as_judge_public.py +2 -0
- opik/rest_api/types/automation_rule_evaluator_trace_thread_llm_as_judge_write.py +2 -0
- opik/rest_api/types/automation_rule_evaluator_trace_thread_user_defined_metric_python.py +2 -0
- opik/rest_api/types/automation_rule_evaluator_trace_thread_user_defined_metric_python_public.py +2 -0
- opik/rest_api/types/automation_rule_evaluator_trace_thread_user_defined_metric_python_write.py +2 -0
- opik/rest_api/types/automation_rule_evaluator_update.py +23 -1
- opik/rest_api/types/automation_rule_evaluator_update_llm_as_judge.py +2 -0
- opik/rest_api/types/automation_rule_evaluator_update_span_llm_as_judge.py +22 -0
- opik/rest_api/types/automation_rule_evaluator_update_trace_thread_llm_as_judge.py +2 -0
- opik/rest_api/types/automation_rule_evaluator_update_trace_thread_user_defined_metric_python.py +2 -0
- opik/rest_api/types/automation_rule_evaluator_update_user_defined_metric_python.py +2 -0
- opik/rest_api/types/automation_rule_evaluator_user_defined_metric_python.py +2 -0
- opik/rest_api/types/automation_rule_evaluator_user_defined_metric_python_public.py +2 -0
- opik/rest_api/types/automation_rule_evaluator_user_defined_metric_python_write.py +2 -0
- opik/rest_api/types/automation_rule_evaluator_write.py +23 -1
- opik/rest_api/types/dashboard_page_public.py +1 -0
- opik/rest_api/types/dataset.py +2 -0
- opik/rest_api/types/dataset_item.py +1 -0
- opik/rest_api/types/dataset_item_compare.py +1 -0
- opik/rest_api/types/dataset_item_page_compare.py +1 -0
- opik/rest_api/types/dataset_item_page_public.py +1 -0
- opik/rest_api/types/dataset_item_public.py +1 -0
- opik/rest_api/types/dataset_public.py +2 -0
- opik/rest_api/types/dataset_public_status.py +5 -0
- opik/rest_api/types/dataset_status.py +5 -0
- opik/rest_api/types/dataset_version_diff.py +22 -0
- opik/rest_api/types/dataset_version_diff_stats.py +24 -0
- opik/rest_api/types/dataset_version_page_public.py +23 -0
- opik/rest_api/types/dataset_version_public.py +49 -0
- opik/rest_api/types/experiment.py +2 -0
- opik/rest_api/types/experiment_public.py +2 -0
- opik/rest_api/types/experiment_score.py +20 -0
- opik/rest_api/types/experiment_score_public.py +20 -0
- opik/rest_api/types/experiment_score_write.py +20 -0
- opik/rest_api/types/feedback_score_public.py +4 -0
- opik/rest_api/types/optimization.py +2 -0
- opik/rest_api/types/optimization_public.py +2 -0
- opik/rest_api/types/optimization_public_status.py +3 -1
- opik/rest_api/types/optimization_status.py +3 -1
- opik/rest_api/types/optimization_studio_config.py +27 -0
- opik/rest_api/types/optimization_studio_config_public.py +27 -0
- opik/rest_api/types/optimization_studio_config_write.py +27 -0
- opik/rest_api/types/optimization_studio_log.py +22 -0
- opik/rest_api/types/optimization_write.py +2 -0
- opik/rest_api/types/optimization_write_status.py +3 -1
- opik/rest_api/types/prompt.py +6 -0
- opik/rest_api/types/prompt_detail.py +6 -0
- opik/rest_api/types/prompt_detail_template_structure.py +5 -0
- opik/rest_api/types/prompt_public.py +6 -0
- opik/rest_api/types/prompt_public_template_structure.py +5 -0
- opik/rest_api/types/prompt_template_structure.py +5 -0
- opik/rest_api/types/prompt_version.py +2 -0
- opik/rest_api/types/prompt_version_detail.py +2 -0
- opik/rest_api/types/prompt_version_detail_template_structure.py +5 -0
- opik/rest_api/types/prompt_version_public.py +2 -0
- opik/rest_api/types/prompt_version_public_template_structure.py +5 -0
- opik/rest_api/types/prompt_version_template_structure.py +5 -0
- opik/rest_api/types/score_name.py +1 -0
- opik/rest_api/types/service_toggles_config.py +5 -0
- opik/rest_api/types/span_filter.py +23 -0
- opik/rest_api/types/span_filter_operator.py +21 -0
- opik/rest_api/types/span_filter_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/studio_evaluation.py +20 -0
- opik/rest_api/types/studio_evaluation_public.py +20 -0
- opik/rest_api/types/studio_evaluation_write.py +20 -0
- opik/rest_api/types/studio_llm_model.py +21 -0
- opik/rest_api/types/studio_llm_model_public.py +21 -0
- opik/rest_api/types/studio_llm_model_write.py +21 -0
- opik/rest_api/types/studio_message.py +20 -0
- opik/rest_api/types/studio_message_public.py +20 -0
- opik/rest_api/types/studio_message_write.py +20 -0
- opik/rest_api/types/studio_metric.py +21 -0
- opik/rest_api/types/studio_metric_public.py +21 -0
- opik/rest_api/types/studio_metric_write.py +21 -0
- opik/rest_api/types/studio_optimizer.py +21 -0
- opik/rest_api/types/studio_optimizer_public.py +21 -0
- opik/rest_api/types/studio_optimizer_write.py +21 -0
- opik/rest_api/types/studio_prompt.py +20 -0
- opik/rest_api/types/studio_prompt_public.py +20 -0
- opik/rest_api/types/studio_prompt_write.py +20 -0
- opik/rest_api/types/trace.py +6 -0
- opik/rest_api/types/trace_public.py +6 -0
- opik/rest_api/types/trace_thread_filter_write.py +23 -0
- opik/rest_api/types/trace_thread_filter_write_operator.py +21 -0
- opik/rest_api/types/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/synchronization.py +5 -6
- opik/{decorator/tracing_runtime_config.py → tracing_runtime_config.py} +6 -7
- {opik-1.9.26.dist-info → opik-1.9.39.dist-info}/METADATA +2 -1
- {opik-1.9.26.dist-info → opik-1.9.39.dist-info}/RECORD +177 -119
- opik/api_objects/prompt/chat_prompt_template.py +0 -200
- {opik-1.9.26.dist-info → opik-1.9.39.dist-info}/WHEEL +0 -0
- {opik-1.9.26.dist-info → opik-1.9.39.dist-info}/entry_points.txt +0 -0
- {opik-1.9.26.dist-info → opik-1.9.39.dist-info}/licenses/LICENSE +0 -0
- {opik-1.9.26.dist-info → opik-1.9.39.dist-info}/top_level.txt +0 -0
opik/rest_api/datasets/client.py
CHANGED
|
@@ -14,6 +14,9 @@ from ..types.dataset_item_write import DatasetItemWrite
|
|
|
14
14
|
from ..types.dataset_item_write_source import DatasetItemWriteSource
|
|
15
15
|
from ..types.dataset_page_public import DatasetPagePublic
|
|
16
16
|
from ..types.dataset_public import DatasetPublic
|
|
17
|
+
from ..types.dataset_version_diff import DatasetVersionDiff
|
|
18
|
+
from ..types.dataset_version_page_public import DatasetVersionPagePublic
|
|
19
|
+
from ..types.dataset_version_public import DatasetVersionPublic
|
|
17
20
|
from ..types.json_node import JsonNode
|
|
18
21
|
from ..types.page_columns import PageColumns
|
|
19
22
|
from ..types.project_stats_public import ProjectStatsPublic
|
|
@@ -789,6 +792,7 @@ class DatasetsClient:
|
|
|
789
792
|
*,
|
|
790
793
|
page: typing.Optional[int] = None,
|
|
791
794
|
size: typing.Optional[int] = None,
|
|
795
|
+
version: typing.Optional[str] = None,
|
|
792
796
|
filters: typing.Optional[str] = None,
|
|
793
797
|
truncate: typing.Optional[bool] = None,
|
|
794
798
|
request_options: typing.Optional[RequestOptions] = None,
|
|
@@ -804,6 +808,8 @@ class DatasetsClient:
|
|
|
804
808
|
|
|
805
809
|
size : typing.Optional[int]
|
|
806
810
|
|
|
811
|
+
version : typing.Optional[str]
|
|
812
|
+
|
|
807
813
|
filters : typing.Optional[str]
|
|
808
814
|
|
|
809
815
|
truncate : typing.Optional[bool]
|
|
@@ -823,7 +829,13 @@ class DatasetsClient:
|
|
|
823
829
|
client.datasets.get_dataset_items(id='id', )
|
|
824
830
|
"""
|
|
825
831
|
_response = self._raw_client.get_dataset_items(
|
|
826
|
-
id,
|
|
832
|
+
id,
|
|
833
|
+
page=page,
|
|
834
|
+
size=size,
|
|
835
|
+
version=version,
|
|
836
|
+
filters=filters,
|
|
837
|
+
truncate=truncate,
|
|
838
|
+
request_options=request_options,
|
|
827
839
|
)
|
|
828
840
|
return _response.data
|
|
829
841
|
|
|
@@ -897,6 +909,204 @@ class DatasetsClient:
|
|
|
897
909
|
) as r:
|
|
898
910
|
yield from r.data
|
|
899
911
|
|
|
912
|
+
def compare_dataset_versions(
|
|
913
|
+
self, id: str, *, request_options: typing.Optional[RequestOptions] = None
|
|
914
|
+
) -> DatasetVersionDiff:
|
|
915
|
+
"""
|
|
916
|
+
Compare the latest committed dataset version with the current draft state. This endpoint provides insights into changes made since the last version was committed. The comparison calculates additions, modifications, deletions, and unchanged items between the latest version snapshot and current draft.
|
|
917
|
+
|
|
918
|
+
Parameters
|
|
919
|
+
----------
|
|
920
|
+
id : str
|
|
921
|
+
|
|
922
|
+
request_options : typing.Optional[RequestOptions]
|
|
923
|
+
Request-specific configuration.
|
|
924
|
+
|
|
925
|
+
Returns
|
|
926
|
+
-------
|
|
927
|
+
DatasetVersionDiff
|
|
928
|
+
Diff computed successfully
|
|
929
|
+
|
|
930
|
+
Examples
|
|
931
|
+
--------
|
|
932
|
+
from Opik import OpikApi
|
|
933
|
+
client = OpikApi(api_key="YOUR_API_KEY", workspace_name="YOUR_WORKSPACE_NAME", )
|
|
934
|
+
client.datasets.compare_dataset_versions(id='id', )
|
|
935
|
+
"""
|
|
936
|
+
_response = self._raw_client.compare_dataset_versions(id, request_options=request_options)
|
|
937
|
+
return _response.data
|
|
938
|
+
|
|
939
|
+
def create_version_tag(
|
|
940
|
+
self, version_hash: str, id: str, *, tag: str, request_options: typing.Optional[RequestOptions] = None
|
|
941
|
+
) -> None:
|
|
942
|
+
"""
|
|
943
|
+
Add a tag to a specific dataset version for easy reference (e.g., 'baseline', 'v1.0', 'production')
|
|
944
|
+
|
|
945
|
+
Parameters
|
|
946
|
+
----------
|
|
947
|
+
version_hash : str
|
|
948
|
+
|
|
949
|
+
id : str
|
|
950
|
+
|
|
951
|
+
tag : str
|
|
952
|
+
|
|
953
|
+
request_options : typing.Optional[RequestOptions]
|
|
954
|
+
Request-specific configuration.
|
|
955
|
+
|
|
956
|
+
Returns
|
|
957
|
+
-------
|
|
958
|
+
None
|
|
959
|
+
|
|
960
|
+
Examples
|
|
961
|
+
--------
|
|
962
|
+
from Opik import OpikApi
|
|
963
|
+
client = OpikApi(api_key="YOUR_API_KEY", workspace_name="YOUR_WORKSPACE_NAME", )
|
|
964
|
+
client.datasets.create_version_tag(version_hash='versionHash', id='id', tag='tag', )
|
|
965
|
+
"""
|
|
966
|
+
_response = self._raw_client.create_version_tag(version_hash, id, tag=tag, request_options=request_options)
|
|
967
|
+
return _response.data
|
|
968
|
+
|
|
969
|
+
def list_dataset_versions(
|
|
970
|
+
self,
|
|
971
|
+
id: str,
|
|
972
|
+
*,
|
|
973
|
+
page: typing.Optional[int] = None,
|
|
974
|
+
size: typing.Optional[int] = None,
|
|
975
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
976
|
+
) -> DatasetVersionPagePublic:
|
|
977
|
+
"""
|
|
978
|
+
Get paginated list of versions for a dataset, ordered by creation time (newest first)
|
|
979
|
+
|
|
980
|
+
Parameters
|
|
981
|
+
----------
|
|
982
|
+
id : str
|
|
983
|
+
|
|
984
|
+
page : typing.Optional[int]
|
|
985
|
+
|
|
986
|
+
size : typing.Optional[int]
|
|
987
|
+
|
|
988
|
+
request_options : typing.Optional[RequestOptions]
|
|
989
|
+
Request-specific configuration.
|
|
990
|
+
|
|
991
|
+
Returns
|
|
992
|
+
-------
|
|
993
|
+
DatasetVersionPagePublic
|
|
994
|
+
Dataset versions
|
|
995
|
+
|
|
996
|
+
Examples
|
|
997
|
+
--------
|
|
998
|
+
from Opik import OpikApi
|
|
999
|
+
client = OpikApi(api_key="YOUR_API_KEY", workspace_name="YOUR_WORKSPACE_NAME", )
|
|
1000
|
+
client.datasets.list_dataset_versions(id='id', )
|
|
1001
|
+
"""
|
|
1002
|
+
_response = self._raw_client.list_dataset_versions(id, page=page, size=size, request_options=request_options)
|
|
1003
|
+
return _response.data
|
|
1004
|
+
|
|
1005
|
+
def create_dataset_version(
|
|
1006
|
+
self,
|
|
1007
|
+
id: str,
|
|
1008
|
+
*,
|
|
1009
|
+
tag: typing.Optional[str] = OMIT,
|
|
1010
|
+
change_description: typing.Optional[str] = OMIT,
|
|
1011
|
+
metadata: typing.Optional[typing.Dict[str, str]] = OMIT,
|
|
1012
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
1013
|
+
) -> None:
|
|
1014
|
+
"""
|
|
1015
|
+
Create a new immutable version of the dataset by snapshotting the current state
|
|
1016
|
+
|
|
1017
|
+
Parameters
|
|
1018
|
+
----------
|
|
1019
|
+
id : str
|
|
1020
|
+
|
|
1021
|
+
tag : typing.Optional[str]
|
|
1022
|
+
Optional tag for this version
|
|
1023
|
+
|
|
1024
|
+
change_description : typing.Optional[str]
|
|
1025
|
+
Optional description of changes in this version
|
|
1026
|
+
|
|
1027
|
+
metadata : typing.Optional[typing.Dict[str, str]]
|
|
1028
|
+
Optional user-defined metadata
|
|
1029
|
+
|
|
1030
|
+
request_options : typing.Optional[RequestOptions]
|
|
1031
|
+
Request-specific configuration.
|
|
1032
|
+
|
|
1033
|
+
Returns
|
|
1034
|
+
-------
|
|
1035
|
+
None
|
|
1036
|
+
|
|
1037
|
+
Examples
|
|
1038
|
+
--------
|
|
1039
|
+
from Opik import OpikApi
|
|
1040
|
+
client = OpikApi(api_key="YOUR_API_KEY", workspace_name="YOUR_WORKSPACE_NAME", )
|
|
1041
|
+
client.datasets.create_dataset_version(id='id', )
|
|
1042
|
+
"""
|
|
1043
|
+
_response = self._raw_client.create_dataset_version(
|
|
1044
|
+
id, tag=tag, change_description=change_description, metadata=metadata, request_options=request_options
|
|
1045
|
+
)
|
|
1046
|
+
return _response.data
|
|
1047
|
+
|
|
1048
|
+
def delete_version_tag(
|
|
1049
|
+
self, version_hash: str, tag: str, id: str, *, request_options: typing.Optional[RequestOptions] = None
|
|
1050
|
+
) -> None:
|
|
1051
|
+
"""
|
|
1052
|
+
Remove a tag from a dataset version. The version itself is not deleted, only the tag reference.
|
|
1053
|
+
|
|
1054
|
+
Parameters
|
|
1055
|
+
----------
|
|
1056
|
+
version_hash : str
|
|
1057
|
+
|
|
1058
|
+
tag : str
|
|
1059
|
+
|
|
1060
|
+
id : str
|
|
1061
|
+
|
|
1062
|
+
request_options : typing.Optional[RequestOptions]
|
|
1063
|
+
Request-specific configuration.
|
|
1064
|
+
|
|
1065
|
+
Returns
|
|
1066
|
+
-------
|
|
1067
|
+
None
|
|
1068
|
+
|
|
1069
|
+
Examples
|
|
1070
|
+
--------
|
|
1071
|
+
from Opik import OpikApi
|
|
1072
|
+
client = OpikApi(api_key="YOUR_API_KEY", workspace_name="YOUR_WORKSPACE_NAME", )
|
|
1073
|
+
client.datasets.delete_version_tag(version_hash='versionHash', tag='tag', id='id', )
|
|
1074
|
+
"""
|
|
1075
|
+
_response = self._raw_client.delete_version_tag(version_hash, tag, id, request_options=request_options)
|
|
1076
|
+
return _response.data
|
|
1077
|
+
|
|
1078
|
+
def restore_dataset_version(
|
|
1079
|
+
self, id: str, *, version_ref: str, request_options: typing.Optional[RequestOptions] = None
|
|
1080
|
+
) -> DatasetVersionPublic:
|
|
1081
|
+
"""
|
|
1082
|
+
Restores the dataset to a previous version state. All draft items are replaced with items from the specified version. If the version is not the latest, a new version snapshot is created. If the version is the latest, only draft items are replaced (revert functionality).
|
|
1083
|
+
|
|
1084
|
+
Parameters
|
|
1085
|
+
----------
|
|
1086
|
+
id : str
|
|
1087
|
+
|
|
1088
|
+
version_ref : str
|
|
1089
|
+
Version hash or tag to restore from
|
|
1090
|
+
|
|
1091
|
+
request_options : typing.Optional[RequestOptions]
|
|
1092
|
+
Request-specific configuration.
|
|
1093
|
+
|
|
1094
|
+
Returns
|
|
1095
|
+
-------
|
|
1096
|
+
DatasetVersionPublic
|
|
1097
|
+
Version restored successfully
|
|
1098
|
+
|
|
1099
|
+
Examples
|
|
1100
|
+
--------
|
|
1101
|
+
from Opik import OpikApi
|
|
1102
|
+
client = OpikApi(api_key="YOUR_API_KEY", workspace_name="YOUR_WORKSPACE_NAME", )
|
|
1103
|
+
client.datasets.restore_dataset_version(id='id', version_ref='version_ref', )
|
|
1104
|
+
"""
|
|
1105
|
+
_response = self._raw_client.restore_dataset_version(
|
|
1106
|
+
id, version_ref=version_ref, request_options=request_options
|
|
1107
|
+
)
|
|
1108
|
+
return _response.data
|
|
1109
|
+
|
|
900
1110
|
|
|
901
1111
|
class AsyncDatasetsClient:
|
|
902
1112
|
def __init__(self, *, client_wrapper: AsyncClientWrapper):
|
|
@@ -1721,6 +1931,7 @@ class AsyncDatasetsClient:
|
|
|
1721
1931
|
*,
|
|
1722
1932
|
page: typing.Optional[int] = None,
|
|
1723
1933
|
size: typing.Optional[int] = None,
|
|
1934
|
+
version: typing.Optional[str] = None,
|
|
1724
1935
|
filters: typing.Optional[str] = None,
|
|
1725
1936
|
truncate: typing.Optional[bool] = None,
|
|
1726
1937
|
request_options: typing.Optional[RequestOptions] = None,
|
|
@@ -1736,6 +1947,8 @@ class AsyncDatasetsClient:
|
|
|
1736
1947
|
|
|
1737
1948
|
size : typing.Optional[int]
|
|
1738
1949
|
|
|
1950
|
+
version : typing.Optional[str]
|
|
1951
|
+
|
|
1739
1952
|
filters : typing.Optional[str]
|
|
1740
1953
|
|
|
1741
1954
|
truncate : typing.Optional[bool]
|
|
@@ -1758,7 +1971,13 @@ class AsyncDatasetsClient:
|
|
|
1758
1971
|
asyncio.run(main())
|
|
1759
1972
|
"""
|
|
1760
1973
|
_response = await self._raw_client.get_dataset_items(
|
|
1761
|
-
id,
|
|
1974
|
+
id,
|
|
1975
|
+
page=page,
|
|
1976
|
+
size=size,
|
|
1977
|
+
version=version,
|
|
1978
|
+
filters=filters,
|
|
1979
|
+
truncate=truncate,
|
|
1980
|
+
request_options=request_options,
|
|
1762
1981
|
)
|
|
1763
1982
|
return _response.data
|
|
1764
1983
|
|
|
@@ -1835,3 +2054,223 @@ class AsyncDatasetsClient:
|
|
|
1835
2054
|
) as r:
|
|
1836
2055
|
async for data in r.data:
|
|
1837
2056
|
yield data
|
|
2057
|
+
|
|
2058
|
+
async def compare_dataset_versions(
|
|
2059
|
+
self, id: str, *, request_options: typing.Optional[RequestOptions] = None
|
|
2060
|
+
) -> DatasetVersionDiff:
|
|
2061
|
+
"""
|
|
2062
|
+
Compare the latest committed dataset version with the current draft state. This endpoint provides insights into changes made since the last version was committed. The comparison calculates additions, modifications, deletions, and unchanged items between the latest version snapshot and current draft.
|
|
2063
|
+
|
|
2064
|
+
Parameters
|
|
2065
|
+
----------
|
|
2066
|
+
id : str
|
|
2067
|
+
|
|
2068
|
+
request_options : typing.Optional[RequestOptions]
|
|
2069
|
+
Request-specific configuration.
|
|
2070
|
+
|
|
2071
|
+
Returns
|
|
2072
|
+
-------
|
|
2073
|
+
DatasetVersionDiff
|
|
2074
|
+
Diff computed successfully
|
|
2075
|
+
|
|
2076
|
+
Examples
|
|
2077
|
+
--------
|
|
2078
|
+
from Opik import AsyncOpikApi
|
|
2079
|
+
import asyncio
|
|
2080
|
+
client = AsyncOpikApi(api_key="YOUR_API_KEY", workspace_name="YOUR_WORKSPACE_NAME", )
|
|
2081
|
+
async def main() -> None:
|
|
2082
|
+
await client.datasets.compare_dataset_versions(id='id', )
|
|
2083
|
+
asyncio.run(main())
|
|
2084
|
+
"""
|
|
2085
|
+
_response = await self._raw_client.compare_dataset_versions(id, request_options=request_options)
|
|
2086
|
+
return _response.data
|
|
2087
|
+
|
|
2088
|
+
async def create_version_tag(
|
|
2089
|
+
self, version_hash: str, id: str, *, tag: str, request_options: typing.Optional[RequestOptions] = None
|
|
2090
|
+
) -> None:
|
|
2091
|
+
"""
|
|
2092
|
+
Add a tag to a specific dataset version for easy reference (e.g., 'baseline', 'v1.0', 'production')
|
|
2093
|
+
|
|
2094
|
+
Parameters
|
|
2095
|
+
----------
|
|
2096
|
+
version_hash : str
|
|
2097
|
+
|
|
2098
|
+
id : str
|
|
2099
|
+
|
|
2100
|
+
tag : str
|
|
2101
|
+
|
|
2102
|
+
request_options : typing.Optional[RequestOptions]
|
|
2103
|
+
Request-specific configuration.
|
|
2104
|
+
|
|
2105
|
+
Returns
|
|
2106
|
+
-------
|
|
2107
|
+
None
|
|
2108
|
+
|
|
2109
|
+
Examples
|
|
2110
|
+
--------
|
|
2111
|
+
from Opik import AsyncOpikApi
|
|
2112
|
+
import asyncio
|
|
2113
|
+
client = AsyncOpikApi(api_key="YOUR_API_KEY", workspace_name="YOUR_WORKSPACE_NAME", )
|
|
2114
|
+
async def main() -> None:
|
|
2115
|
+
await client.datasets.create_version_tag(version_hash='versionHash', id='id', tag='tag', )
|
|
2116
|
+
asyncio.run(main())
|
|
2117
|
+
"""
|
|
2118
|
+
_response = await self._raw_client.create_version_tag(
|
|
2119
|
+
version_hash, id, tag=tag, request_options=request_options
|
|
2120
|
+
)
|
|
2121
|
+
return _response.data
|
|
2122
|
+
|
|
2123
|
+
async def list_dataset_versions(
|
|
2124
|
+
self,
|
|
2125
|
+
id: str,
|
|
2126
|
+
*,
|
|
2127
|
+
page: typing.Optional[int] = None,
|
|
2128
|
+
size: typing.Optional[int] = None,
|
|
2129
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
2130
|
+
) -> DatasetVersionPagePublic:
|
|
2131
|
+
"""
|
|
2132
|
+
Get paginated list of versions for a dataset, ordered by creation time (newest first)
|
|
2133
|
+
|
|
2134
|
+
Parameters
|
|
2135
|
+
----------
|
|
2136
|
+
id : str
|
|
2137
|
+
|
|
2138
|
+
page : typing.Optional[int]
|
|
2139
|
+
|
|
2140
|
+
size : typing.Optional[int]
|
|
2141
|
+
|
|
2142
|
+
request_options : typing.Optional[RequestOptions]
|
|
2143
|
+
Request-specific configuration.
|
|
2144
|
+
|
|
2145
|
+
Returns
|
|
2146
|
+
-------
|
|
2147
|
+
DatasetVersionPagePublic
|
|
2148
|
+
Dataset versions
|
|
2149
|
+
|
|
2150
|
+
Examples
|
|
2151
|
+
--------
|
|
2152
|
+
from Opik import AsyncOpikApi
|
|
2153
|
+
import asyncio
|
|
2154
|
+
client = AsyncOpikApi(api_key="YOUR_API_KEY", workspace_name="YOUR_WORKSPACE_NAME", )
|
|
2155
|
+
async def main() -> None:
|
|
2156
|
+
await client.datasets.list_dataset_versions(id='id', )
|
|
2157
|
+
asyncio.run(main())
|
|
2158
|
+
"""
|
|
2159
|
+
_response = await self._raw_client.list_dataset_versions(
|
|
2160
|
+
id, page=page, size=size, request_options=request_options
|
|
2161
|
+
)
|
|
2162
|
+
return _response.data
|
|
2163
|
+
|
|
2164
|
+
async def create_dataset_version(
|
|
2165
|
+
self,
|
|
2166
|
+
id: str,
|
|
2167
|
+
*,
|
|
2168
|
+
tag: typing.Optional[str] = OMIT,
|
|
2169
|
+
change_description: typing.Optional[str] = OMIT,
|
|
2170
|
+
metadata: typing.Optional[typing.Dict[str, str]] = OMIT,
|
|
2171
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
2172
|
+
) -> None:
|
|
2173
|
+
"""
|
|
2174
|
+
Create a new immutable version of the dataset by snapshotting the current state
|
|
2175
|
+
|
|
2176
|
+
Parameters
|
|
2177
|
+
----------
|
|
2178
|
+
id : str
|
|
2179
|
+
|
|
2180
|
+
tag : typing.Optional[str]
|
|
2181
|
+
Optional tag for this version
|
|
2182
|
+
|
|
2183
|
+
change_description : typing.Optional[str]
|
|
2184
|
+
Optional description of changes in this version
|
|
2185
|
+
|
|
2186
|
+
metadata : typing.Optional[typing.Dict[str, str]]
|
|
2187
|
+
Optional user-defined metadata
|
|
2188
|
+
|
|
2189
|
+
request_options : typing.Optional[RequestOptions]
|
|
2190
|
+
Request-specific configuration.
|
|
2191
|
+
|
|
2192
|
+
Returns
|
|
2193
|
+
-------
|
|
2194
|
+
None
|
|
2195
|
+
|
|
2196
|
+
Examples
|
|
2197
|
+
--------
|
|
2198
|
+
from Opik import AsyncOpikApi
|
|
2199
|
+
import asyncio
|
|
2200
|
+
client = AsyncOpikApi(api_key="YOUR_API_KEY", workspace_name="YOUR_WORKSPACE_NAME", )
|
|
2201
|
+
async def main() -> None:
|
|
2202
|
+
await client.datasets.create_dataset_version(id='id', )
|
|
2203
|
+
asyncio.run(main())
|
|
2204
|
+
"""
|
|
2205
|
+
_response = await self._raw_client.create_dataset_version(
|
|
2206
|
+
id, tag=tag, change_description=change_description, metadata=metadata, request_options=request_options
|
|
2207
|
+
)
|
|
2208
|
+
return _response.data
|
|
2209
|
+
|
|
2210
|
+
async def delete_version_tag(
|
|
2211
|
+
self, version_hash: str, tag: str, id: str, *, request_options: typing.Optional[RequestOptions] = None
|
|
2212
|
+
) -> None:
|
|
2213
|
+
"""
|
|
2214
|
+
Remove a tag from a dataset version. The version itself is not deleted, only the tag reference.
|
|
2215
|
+
|
|
2216
|
+
Parameters
|
|
2217
|
+
----------
|
|
2218
|
+
version_hash : str
|
|
2219
|
+
|
|
2220
|
+
tag : str
|
|
2221
|
+
|
|
2222
|
+
id : str
|
|
2223
|
+
|
|
2224
|
+
request_options : typing.Optional[RequestOptions]
|
|
2225
|
+
Request-specific configuration.
|
|
2226
|
+
|
|
2227
|
+
Returns
|
|
2228
|
+
-------
|
|
2229
|
+
None
|
|
2230
|
+
|
|
2231
|
+
Examples
|
|
2232
|
+
--------
|
|
2233
|
+
from Opik import AsyncOpikApi
|
|
2234
|
+
import asyncio
|
|
2235
|
+
client = AsyncOpikApi(api_key="YOUR_API_KEY", workspace_name="YOUR_WORKSPACE_NAME", )
|
|
2236
|
+
async def main() -> None:
|
|
2237
|
+
await client.datasets.delete_version_tag(version_hash='versionHash', tag='tag', id='id', )
|
|
2238
|
+
asyncio.run(main())
|
|
2239
|
+
"""
|
|
2240
|
+
_response = await self._raw_client.delete_version_tag(version_hash, tag, id, request_options=request_options)
|
|
2241
|
+
return _response.data
|
|
2242
|
+
|
|
2243
|
+
async def restore_dataset_version(
|
|
2244
|
+
self, id: str, *, version_ref: str, request_options: typing.Optional[RequestOptions] = None
|
|
2245
|
+
) -> DatasetVersionPublic:
|
|
2246
|
+
"""
|
|
2247
|
+
Restores the dataset to a previous version state. All draft items are replaced with items from the specified version. If the version is not the latest, a new version snapshot is created. If the version is the latest, only draft items are replaced (revert functionality).
|
|
2248
|
+
|
|
2249
|
+
Parameters
|
|
2250
|
+
----------
|
|
2251
|
+
id : str
|
|
2252
|
+
|
|
2253
|
+
version_ref : str
|
|
2254
|
+
Version hash or tag to restore from
|
|
2255
|
+
|
|
2256
|
+
request_options : typing.Optional[RequestOptions]
|
|
2257
|
+
Request-specific configuration.
|
|
2258
|
+
|
|
2259
|
+
Returns
|
|
2260
|
+
-------
|
|
2261
|
+
DatasetVersionPublic
|
|
2262
|
+
Version restored successfully
|
|
2263
|
+
|
|
2264
|
+
Examples
|
|
2265
|
+
--------
|
|
2266
|
+
from Opik import AsyncOpikApi
|
|
2267
|
+
import asyncio
|
|
2268
|
+
client = AsyncOpikApi(api_key="YOUR_API_KEY", workspace_name="YOUR_WORKSPACE_NAME", )
|
|
2269
|
+
async def main() -> None:
|
|
2270
|
+
await client.datasets.restore_dataset_version(id='id', version_ref='version_ref', )
|
|
2271
|
+
asyncio.run(main())
|
|
2272
|
+
"""
|
|
2273
|
+
_response = await self._raw_client.restore_dataset_version(
|
|
2274
|
+
id, version_ref=version_ref, request_options=request_options
|
|
2275
|
+
)
|
|
2276
|
+
return _response.data
|