opik 1.9.39__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 +42 -0
- opik/rest_api/datasets/client.py +321 -123
- opik/rest_api/datasets/raw_client.py +470 -145
- 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 +50 -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.py +2 -0
- 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_public.py +2 -0
- opik/rest_api/types/dataset_version_public.py +10 -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 +9 -0
- opik/rest_api/types/experiment_public.py +9 -0
- opik/rest_api/types/group_content_with_aggregations.py +1 -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.39.dist-info → opik-1.9.86.dist-info}/METADATA +7 -7
- {opik-1.9.39.dist-info → opik-1.9.86.dist-info}/RECORD +193 -142
- opik/cli/export.py +0 -791
- opik/cli/import_command.py +0 -575
- {opik-1.9.39.dist-info → opik-1.9.86.dist-info}/WHEEL +0 -0
- {opik-1.9.39.dist-info → opik-1.9.86.dist-info}/entry_points.txt +0 -0
- {opik-1.9.39.dist-info → opik-1.9.86.dist-info}/licenses/LICENSE +0 -0
- {opik-1.9.39.dist-info → opik-1.9.86.dist-info}/top_level.txt +0 -0
opik/rest_api/datasets/client.py
CHANGED
|
@@ -5,6 +5,7 @@ import typing
|
|
|
5
5
|
from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
|
|
6
6
|
from ..core.request_options import RequestOptions
|
|
7
7
|
from ..types.dataset_expansion_response import DatasetExpansionResponse
|
|
8
|
+
from ..types.dataset_item_changes_public import DatasetItemChangesPublic
|
|
8
9
|
from ..types.dataset_item_filter import DatasetItemFilter
|
|
9
10
|
from ..types.dataset_item_page_compare import DatasetItemPageCompare
|
|
10
11
|
from ..types.dataset_item_page_public import DatasetItemPagePublic
|
|
@@ -45,12 +46,59 @@ class DatasetsClient:
|
|
|
45
46
|
"""
|
|
46
47
|
return self._raw_client
|
|
47
48
|
|
|
49
|
+
def apply_dataset_item_changes(
|
|
50
|
+
self,
|
|
51
|
+
id: str,
|
|
52
|
+
*,
|
|
53
|
+
request: DatasetItemChangesPublic,
|
|
54
|
+
override: typing.Optional[bool] = None,
|
|
55
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
56
|
+
) -> DatasetVersionPublic:
|
|
57
|
+
"""
|
|
58
|
+
Apply delta changes (add, edit, delete) to a dataset version with conflict detection.
|
|
59
|
+
|
|
60
|
+
This endpoint:
|
|
61
|
+
- Creates a new version with the applied changes
|
|
62
|
+
- Validates that baseVersion matches the latest version (unless override=true)
|
|
63
|
+
- Returns 409 Conflict if baseVersion is stale and override is not set
|
|
64
|
+
|
|
65
|
+
Use `override=true` query parameter to force version creation even with stale baseVersion.
|
|
66
|
+
|
|
67
|
+
Parameters
|
|
68
|
+
----------
|
|
69
|
+
id : str
|
|
70
|
+
|
|
71
|
+
request : DatasetItemChangesPublic
|
|
72
|
+
|
|
73
|
+
override : typing.Optional[bool]
|
|
74
|
+
|
|
75
|
+
request_options : typing.Optional[RequestOptions]
|
|
76
|
+
Request-specific configuration.
|
|
77
|
+
|
|
78
|
+
Returns
|
|
79
|
+
-------
|
|
80
|
+
DatasetVersionPublic
|
|
81
|
+
Version created successfully
|
|
82
|
+
|
|
83
|
+
Examples
|
|
84
|
+
--------
|
|
85
|
+
from Opik import OpikApi
|
|
86
|
+
client = OpikApi(api_key="YOUR_API_KEY", workspace_name="YOUR_WORKSPACE_NAME", )
|
|
87
|
+
client.datasets.apply_dataset_item_changes(id='id', request={'key': 'value'
|
|
88
|
+
}, )
|
|
89
|
+
"""
|
|
90
|
+
_response = self._raw_client.apply_dataset_item_changes(
|
|
91
|
+
id, request=request, override=override, request_options=request_options
|
|
92
|
+
)
|
|
93
|
+
return _response.data
|
|
94
|
+
|
|
48
95
|
def batch_update_dataset_items(
|
|
49
96
|
self,
|
|
50
97
|
*,
|
|
51
98
|
update: DatasetItemUpdate,
|
|
52
99
|
ids: typing.Optional[typing.Sequence[str]] = OMIT,
|
|
53
100
|
filters: typing.Optional[typing.Sequence[DatasetItemFilter]] = OMIT,
|
|
101
|
+
dataset_id: typing.Optional[str] = OMIT,
|
|
54
102
|
merge_tags: typing.Optional[bool] = OMIT,
|
|
55
103
|
request_options: typing.Optional[RequestOptions] = None,
|
|
56
104
|
) -> None:
|
|
@@ -66,6 +114,9 @@ class DatasetsClient:
|
|
|
66
114
|
|
|
67
115
|
filters : typing.Optional[typing.Sequence[DatasetItemFilter]]
|
|
68
116
|
|
|
117
|
+
dataset_id : typing.Optional[str]
|
|
118
|
+
Dataset ID. Required when using 'filters', optional when using 'ids'.
|
|
119
|
+
|
|
69
120
|
merge_tags : typing.Optional[bool]
|
|
70
121
|
If true, merge tags with existing tags instead of replacing them. Default: false. When using 'filters', this is automatically set to true.
|
|
71
122
|
|
|
@@ -84,7 +135,12 @@ class DatasetsClient:
|
|
|
84
135
|
client.datasets.batch_update_dataset_items(update=DatasetItemUpdate(), )
|
|
85
136
|
"""
|
|
86
137
|
_response = self._raw_client.batch_update_dataset_items(
|
|
87
|
-
update=update,
|
|
138
|
+
update=update,
|
|
139
|
+
ids=ids,
|
|
140
|
+
filters=filters,
|
|
141
|
+
dataset_id=dataset_id,
|
|
142
|
+
merge_tags=merge_tags,
|
|
143
|
+
request_options=request_options,
|
|
88
144
|
)
|
|
89
145
|
return _response.data
|
|
90
146
|
|
|
@@ -198,6 +254,7 @@ class DatasetsClient:
|
|
|
198
254
|
items: typing.Sequence[DatasetItemWrite],
|
|
199
255
|
dataset_name: typing.Optional[str] = OMIT,
|
|
200
256
|
dataset_id: typing.Optional[str] = OMIT,
|
|
257
|
+
batch_group_id: typing.Optional[str] = OMIT,
|
|
201
258
|
request_options: typing.Optional[RequestOptions] = None,
|
|
202
259
|
) -> None:
|
|
203
260
|
"""
|
|
@@ -213,6 +270,9 @@ class DatasetsClient:
|
|
|
213
270
|
dataset_id : typing.Optional[str]
|
|
214
271
|
If null, dataset_name must be provided
|
|
215
272
|
|
|
273
|
+
batch_group_id : typing.Optional[str]
|
|
274
|
+
Optional batch group ID to group multiple batches into a single dataset version. If null, mutates the latest version instead of creating a new one.
|
|
275
|
+
|
|
216
276
|
request_options : typing.Optional[RequestOptions]
|
|
217
277
|
Request-specific configuration.
|
|
218
278
|
|
|
@@ -229,7 +289,11 @@ class DatasetsClient:
|
|
|
229
289
|
}, )], )
|
|
230
290
|
"""
|
|
231
291
|
_response = self._raw_client.create_or_update_dataset_items(
|
|
232
|
-
items=items,
|
|
292
|
+
items=items,
|
|
293
|
+
dataset_name=dataset_name,
|
|
294
|
+
dataset_id=dataset_id,
|
|
295
|
+
batch_group_id=batch_group_id,
|
|
296
|
+
request_options=request_options,
|
|
233
297
|
)
|
|
234
298
|
return _response.data
|
|
235
299
|
|
|
@@ -465,14 +529,34 @@ class DatasetsClient:
|
|
|
465
529
|
return _response.data
|
|
466
530
|
|
|
467
531
|
def delete_dataset_items(
|
|
468
|
-
self,
|
|
532
|
+
self,
|
|
533
|
+
*,
|
|
534
|
+
item_ids: typing.Optional[typing.Sequence[str]] = OMIT,
|
|
535
|
+
dataset_id: typing.Optional[str] = OMIT,
|
|
536
|
+
filters: typing.Optional[typing.Sequence[DatasetItemFilter]] = OMIT,
|
|
537
|
+
batch_group_id: typing.Optional[str] = OMIT,
|
|
538
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
469
539
|
) -> None:
|
|
470
540
|
"""
|
|
471
|
-
Delete dataset items
|
|
541
|
+
Delete dataset items using one of two modes:
|
|
542
|
+
1. **Delete by IDs**: Provide 'item_ids' to delete specific items by their IDs
|
|
543
|
+
2. **Delete by filters**: Provide 'dataset_id' with optional 'filters' to delete items matching criteria
|
|
544
|
+
|
|
545
|
+
When using filters, an empty 'filters' array will delete all items in the specified dataset.
|
|
472
546
|
|
|
473
547
|
Parameters
|
|
474
548
|
----------
|
|
475
|
-
item_ids : typing.Sequence[str]
|
|
549
|
+
item_ids : typing.Optional[typing.Sequence[str]]
|
|
550
|
+
List of dataset item IDs to delete (max 1000). Use this to delete specific items by their IDs. Mutually exclusive with 'dataset_id' and 'filters'.
|
|
551
|
+
|
|
552
|
+
dataset_id : typing.Optional[str]
|
|
553
|
+
Dataset ID to scope the deletion. Required when using 'filters'. Mutually exclusive with 'item_ids'.
|
|
554
|
+
|
|
555
|
+
filters : typing.Optional[typing.Sequence[DatasetItemFilter]]
|
|
556
|
+
Filters to select dataset items to delete within the specified dataset. Must be used with 'dataset_id'. Mutually exclusive with 'item_ids'. Empty array means 'delete all items in the dataset'.
|
|
557
|
+
|
|
558
|
+
batch_group_id : typing.Optional[str]
|
|
559
|
+
Optional batch group ID to group multiple delete operations into a single dataset version. If null, mutates the latest version instead of creating a new one.
|
|
476
560
|
|
|
477
561
|
request_options : typing.Optional[RequestOptions]
|
|
478
562
|
Request-specific configuration.
|
|
@@ -485,9 +569,15 @@ class DatasetsClient:
|
|
|
485
569
|
--------
|
|
486
570
|
from Opik import OpikApi
|
|
487
571
|
client = OpikApi(api_key="YOUR_API_KEY", workspace_name="YOUR_WORKSPACE_NAME", )
|
|
488
|
-
client.datasets.delete_dataset_items(
|
|
572
|
+
client.datasets.delete_dataset_items()
|
|
489
573
|
"""
|
|
490
|
-
_response = self._raw_client.delete_dataset_items(
|
|
574
|
+
_response = self._raw_client.delete_dataset_items(
|
|
575
|
+
item_ids=item_ids,
|
|
576
|
+
dataset_id=dataset_id,
|
|
577
|
+
filters=filters,
|
|
578
|
+
batch_group_id=batch_group_id,
|
|
579
|
+
request_options=request_options,
|
|
580
|
+
)
|
|
491
581
|
return _response.data
|
|
492
582
|
|
|
493
583
|
def delete_datasets_batch(
|
|
@@ -880,6 +970,7 @@ class DatasetsClient:
|
|
|
880
970
|
dataset_name: str,
|
|
881
971
|
last_retrieved_id: typing.Optional[str] = OMIT,
|
|
882
972
|
steam_limit: typing.Optional[int] = OMIT,
|
|
973
|
+
dataset_version: typing.Optional[str] = OMIT,
|
|
883
974
|
request_options: typing.Optional[RequestOptions] = None,
|
|
884
975
|
) -> typing.Iterator[bytes]:
|
|
885
976
|
"""
|
|
@@ -893,6 +984,8 @@ class DatasetsClient:
|
|
|
893
984
|
|
|
894
985
|
steam_limit : typing.Optional[int]
|
|
895
986
|
|
|
987
|
+
dataset_version : typing.Optional[str]
|
|
988
|
+
|
|
896
989
|
request_options : typing.Optional[RequestOptions]
|
|
897
990
|
Request-specific configuration. You can pass in configuration such as `chunk_size`, and more to customize the request and response.
|
|
898
991
|
|
|
@@ -905,6 +998,7 @@ class DatasetsClient:
|
|
|
905
998
|
dataset_name=dataset_name,
|
|
906
999
|
last_retrieved_id=last_retrieved_id,
|
|
907
1000
|
steam_limit=steam_limit,
|
|
1001
|
+
dataset_version=dataset_version,
|
|
908
1002
|
request_options=request_options,
|
|
909
1003
|
) as r:
|
|
910
1004
|
yield from r.data
|
|
@@ -966,127 +1060,127 @@ class DatasetsClient:
|
|
|
966
1060
|
_response = self._raw_client.create_version_tag(version_hash, id, tag=tag, request_options=request_options)
|
|
967
1061
|
return _response.data
|
|
968
1062
|
|
|
969
|
-
def
|
|
970
|
-
self,
|
|
971
|
-
|
|
972
|
-
*,
|
|
973
|
-
page: typing.Optional[int] = None,
|
|
974
|
-
size: typing.Optional[int] = None,
|
|
975
|
-
request_options: typing.Optional[RequestOptions] = None,
|
|
976
|
-
) -> DatasetVersionPagePublic:
|
|
1063
|
+
def delete_version_tag(
|
|
1064
|
+
self, version_hash: str, tag: str, id: str, *, request_options: typing.Optional[RequestOptions] = None
|
|
1065
|
+
) -> None:
|
|
977
1066
|
"""
|
|
978
|
-
|
|
1067
|
+
Remove a tag from a dataset version. The version itself is not deleted, only the tag reference.
|
|
979
1068
|
|
|
980
1069
|
Parameters
|
|
981
1070
|
----------
|
|
982
|
-
|
|
1071
|
+
version_hash : str
|
|
983
1072
|
|
|
984
|
-
|
|
1073
|
+
tag : str
|
|
985
1074
|
|
|
986
|
-
|
|
1075
|
+
id : str
|
|
987
1076
|
|
|
988
1077
|
request_options : typing.Optional[RequestOptions]
|
|
989
1078
|
Request-specific configuration.
|
|
990
1079
|
|
|
991
1080
|
Returns
|
|
992
1081
|
-------
|
|
993
|
-
|
|
994
|
-
Dataset versions
|
|
1082
|
+
None
|
|
995
1083
|
|
|
996
1084
|
Examples
|
|
997
1085
|
--------
|
|
998
1086
|
from Opik import OpikApi
|
|
999
1087
|
client = OpikApi(api_key="YOUR_API_KEY", workspace_name="YOUR_WORKSPACE_NAME", )
|
|
1000
|
-
client.datasets.
|
|
1088
|
+
client.datasets.delete_version_tag(version_hash='versionHash', tag='tag', id='id', )
|
|
1001
1089
|
"""
|
|
1002
|
-
_response = self._raw_client.
|
|
1090
|
+
_response = self._raw_client.delete_version_tag(version_hash, tag, id, request_options=request_options)
|
|
1003
1091
|
return _response.data
|
|
1004
1092
|
|
|
1005
|
-
def
|
|
1093
|
+
def list_dataset_versions(
|
|
1006
1094
|
self,
|
|
1007
1095
|
id: str,
|
|
1008
1096
|
*,
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
metadata: typing.Optional[typing.Dict[str, str]] = OMIT,
|
|
1097
|
+
page: typing.Optional[int] = None,
|
|
1098
|
+
size: typing.Optional[int] = None,
|
|
1012
1099
|
request_options: typing.Optional[RequestOptions] = None,
|
|
1013
|
-
) ->
|
|
1100
|
+
) -> DatasetVersionPagePublic:
|
|
1014
1101
|
"""
|
|
1015
|
-
|
|
1102
|
+
Get paginated list of versions for a dataset, ordered by creation time (newest first)
|
|
1016
1103
|
|
|
1017
1104
|
Parameters
|
|
1018
1105
|
----------
|
|
1019
1106
|
id : str
|
|
1020
1107
|
|
|
1021
|
-
|
|
1022
|
-
Optional tag for this version
|
|
1023
|
-
|
|
1024
|
-
change_description : typing.Optional[str]
|
|
1025
|
-
Optional description of changes in this version
|
|
1108
|
+
page : typing.Optional[int]
|
|
1026
1109
|
|
|
1027
|
-
|
|
1028
|
-
Optional user-defined metadata
|
|
1110
|
+
size : typing.Optional[int]
|
|
1029
1111
|
|
|
1030
1112
|
request_options : typing.Optional[RequestOptions]
|
|
1031
1113
|
Request-specific configuration.
|
|
1032
1114
|
|
|
1033
1115
|
Returns
|
|
1034
1116
|
-------
|
|
1035
|
-
|
|
1117
|
+
DatasetVersionPagePublic
|
|
1118
|
+
Dataset versions
|
|
1036
1119
|
|
|
1037
1120
|
Examples
|
|
1038
1121
|
--------
|
|
1039
1122
|
from Opik import OpikApi
|
|
1040
1123
|
client = OpikApi(api_key="YOUR_API_KEY", workspace_name="YOUR_WORKSPACE_NAME", )
|
|
1041
|
-
client.datasets.
|
|
1124
|
+
client.datasets.list_dataset_versions(id='id', )
|
|
1042
1125
|
"""
|
|
1043
|
-
_response = self._raw_client.
|
|
1044
|
-
id, tag=tag, change_description=change_description, metadata=metadata, request_options=request_options
|
|
1045
|
-
)
|
|
1126
|
+
_response = self._raw_client.list_dataset_versions(id, page=page, size=size, request_options=request_options)
|
|
1046
1127
|
return _response.data
|
|
1047
1128
|
|
|
1048
|
-
def
|
|
1049
|
-
self,
|
|
1050
|
-
) ->
|
|
1129
|
+
def restore_dataset_version(
|
|
1130
|
+
self, id: str, *, version_ref: str, request_options: typing.Optional[RequestOptions] = None
|
|
1131
|
+
) -> DatasetVersionPublic:
|
|
1051
1132
|
"""
|
|
1052
|
-
|
|
1133
|
+
Restores the dataset to a previous version state by creating a new version with items copied from the specified version. If the version is already the latest, returns it as-is (no-op).
|
|
1053
1134
|
|
|
1054
1135
|
Parameters
|
|
1055
1136
|
----------
|
|
1056
|
-
version_hash : str
|
|
1057
|
-
|
|
1058
|
-
tag : str
|
|
1059
|
-
|
|
1060
1137
|
id : str
|
|
1061
1138
|
|
|
1139
|
+
version_ref : str
|
|
1140
|
+
Version hash or tag to restore from
|
|
1141
|
+
|
|
1062
1142
|
request_options : typing.Optional[RequestOptions]
|
|
1063
1143
|
Request-specific configuration.
|
|
1064
1144
|
|
|
1065
1145
|
Returns
|
|
1066
1146
|
-------
|
|
1067
|
-
|
|
1147
|
+
DatasetVersionPublic
|
|
1148
|
+
Version restored successfully
|
|
1068
1149
|
|
|
1069
1150
|
Examples
|
|
1070
1151
|
--------
|
|
1071
1152
|
from Opik import OpikApi
|
|
1072
1153
|
client = OpikApi(api_key="YOUR_API_KEY", workspace_name="YOUR_WORKSPACE_NAME", )
|
|
1073
|
-
client.datasets.
|
|
1154
|
+
client.datasets.restore_dataset_version(id='id', version_ref='version_ref', )
|
|
1074
1155
|
"""
|
|
1075
|
-
_response = self._raw_client.
|
|
1156
|
+
_response = self._raw_client.restore_dataset_version(
|
|
1157
|
+
id, version_ref=version_ref, request_options=request_options
|
|
1158
|
+
)
|
|
1076
1159
|
return _response.data
|
|
1077
1160
|
|
|
1078
|
-
def
|
|
1079
|
-
self,
|
|
1161
|
+
def update_dataset_version(
|
|
1162
|
+
self,
|
|
1163
|
+
version_hash: str,
|
|
1164
|
+
id: str,
|
|
1165
|
+
*,
|
|
1166
|
+
change_description: typing.Optional[str] = OMIT,
|
|
1167
|
+
tags_to_add: typing.Optional[typing.Sequence[str]] = OMIT,
|
|
1168
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
1080
1169
|
) -> DatasetVersionPublic:
|
|
1081
1170
|
"""
|
|
1082
|
-
|
|
1171
|
+
Update a dataset version's change_description and/or add new tags
|
|
1083
1172
|
|
|
1084
1173
|
Parameters
|
|
1085
1174
|
----------
|
|
1175
|
+
version_hash : str
|
|
1176
|
+
|
|
1086
1177
|
id : str
|
|
1087
1178
|
|
|
1088
|
-
|
|
1089
|
-
|
|
1179
|
+
change_description : typing.Optional[str]
|
|
1180
|
+
Optional description of changes in this version
|
|
1181
|
+
|
|
1182
|
+
tags_to_add : typing.Optional[typing.Sequence[str]]
|
|
1183
|
+
Optional list of tags to add to this version
|
|
1090
1184
|
|
|
1091
1185
|
request_options : typing.Optional[RequestOptions]
|
|
1092
1186
|
Request-specific configuration.
|
|
@@ -1094,16 +1188,20 @@ class DatasetsClient:
|
|
|
1094
1188
|
Returns
|
|
1095
1189
|
-------
|
|
1096
1190
|
DatasetVersionPublic
|
|
1097
|
-
Version
|
|
1191
|
+
Version updated successfully
|
|
1098
1192
|
|
|
1099
1193
|
Examples
|
|
1100
1194
|
--------
|
|
1101
1195
|
from Opik import OpikApi
|
|
1102
1196
|
client = OpikApi(api_key="YOUR_API_KEY", workspace_name="YOUR_WORKSPACE_NAME", )
|
|
1103
|
-
client.datasets.
|
|
1197
|
+
client.datasets.update_dataset_version(version_hash='versionHash', id='id', )
|
|
1104
1198
|
"""
|
|
1105
|
-
_response = self._raw_client.
|
|
1106
|
-
|
|
1199
|
+
_response = self._raw_client.update_dataset_version(
|
|
1200
|
+
version_hash,
|
|
1201
|
+
id,
|
|
1202
|
+
change_description=change_description,
|
|
1203
|
+
tags_to_add=tags_to_add,
|
|
1204
|
+
request_options=request_options,
|
|
1107
1205
|
)
|
|
1108
1206
|
return _response.data
|
|
1109
1207
|
|
|
@@ -1123,12 +1221,62 @@ class AsyncDatasetsClient:
|
|
|
1123
1221
|
"""
|
|
1124
1222
|
return self._raw_client
|
|
1125
1223
|
|
|
1224
|
+
async def apply_dataset_item_changes(
|
|
1225
|
+
self,
|
|
1226
|
+
id: str,
|
|
1227
|
+
*,
|
|
1228
|
+
request: DatasetItemChangesPublic,
|
|
1229
|
+
override: typing.Optional[bool] = None,
|
|
1230
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
1231
|
+
) -> DatasetVersionPublic:
|
|
1232
|
+
"""
|
|
1233
|
+
Apply delta changes (add, edit, delete) to a dataset version with conflict detection.
|
|
1234
|
+
|
|
1235
|
+
This endpoint:
|
|
1236
|
+
- Creates a new version with the applied changes
|
|
1237
|
+
- Validates that baseVersion matches the latest version (unless override=true)
|
|
1238
|
+
- Returns 409 Conflict if baseVersion is stale and override is not set
|
|
1239
|
+
|
|
1240
|
+
Use `override=true` query parameter to force version creation even with stale baseVersion.
|
|
1241
|
+
|
|
1242
|
+
Parameters
|
|
1243
|
+
----------
|
|
1244
|
+
id : str
|
|
1245
|
+
|
|
1246
|
+
request : DatasetItemChangesPublic
|
|
1247
|
+
|
|
1248
|
+
override : typing.Optional[bool]
|
|
1249
|
+
|
|
1250
|
+
request_options : typing.Optional[RequestOptions]
|
|
1251
|
+
Request-specific configuration.
|
|
1252
|
+
|
|
1253
|
+
Returns
|
|
1254
|
+
-------
|
|
1255
|
+
DatasetVersionPublic
|
|
1256
|
+
Version created successfully
|
|
1257
|
+
|
|
1258
|
+
Examples
|
|
1259
|
+
--------
|
|
1260
|
+
from Opik import AsyncOpikApi
|
|
1261
|
+
import asyncio
|
|
1262
|
+
client = AsyncOpikApi(api_key="YOUR_API_KEY", workspace_name="YOUR_WORKSPACE_NAME", )
|
|
1263
|
+
async def main() -> None:
|
|
1264
|
+
await client.datasets.apply_dataset_item_changes(id='id', request={'key': 'value'
|
|
1265
|
+
}, )
|
|
1266
|
+
asyncio.run(main())
|
|
1267
|
+
"""
|
|
1268
|
+
_response = await self._raw_client.apply_dataset_item_changes(
|
|
1269
|
+
id, request=request, override=override, request_options=request_options
|
|
1270
|
+
)
|
|
1271
|
+
return _response.data
|
|
1272
|
+
|
|
1126
1273
|
async def batch_update_dataset_items(
|
|
1127
1274
|
self,
|
|
1128
1275
|
*,
|
|
1129
1276
|
update: DatasetItemUpdate,
|
|
1130
1277
|
ids: typing.Optional[typing.Sequence[str]] = OMIT,
|
|
1131
1278
|
filters: typing.Optional[typing.Sequence[DatasetItemFilter]] = OMIT,
|
|
1279
|
+
dataset_id: typing.Optional[str] = OMIT,
|
|
1132
1280
|
merge_tags: typing.Optional[bool] = OMIT,
|
|
1133
1281
|
request_options: typing.Optional[RequestOptions] = None,
|
|
1134
1282
|
) -> None:
|
|
@@ -1144,6 +1292,9 @@ class AsyncDatasetsClient:
|
|
|
1144
1292
|
|
|
1145
1293
|
filters : typing.Optional[typing.Sequence[DatasetItemFilter]]
|
|
1146
1294
|
|
|
1295
|
+
dataset_id : typing.Optional[str]
|
|
1296
|
+
Dataset ID. Required when using 'filters', optional when using 'ids'.
|
|
1297
|
+
|
|
1147
1298
|
merge_tags : typing.Optional[bool]
|
|
1148
1299
|
If true, merge tags with existing tags instead of replacing them. Default: false. When using 'filters', this is automatically set to true.
|
|
1149
1300
|
|
|
@@ -1165,7 +1316,12 @@ class AsyncDatasetsClient:
|
|
|
1165
1316
|
asyncio.run(main())
|
|
1166
1317
|
"""
|
|
1167
1318
|
_response = await self._raw_client.batch_update_dataset_items(
|
|
1168
|
-
update=update,
|
|
1319
|
+
update=update,
|
|
1320
|
+
ids=ids,
|
|
1321
|
+
filters=filters,
|
|
1322
|
+
dataset_id=dataset_id,
|
|
1323
|
+
merge_tags=merge_tags,
|
|
1324
|
+
request_options=request_options,
|
|
1169
1325
|
)
|
|
1170
1326
|
return _response.data
|
|
1171
1327
|
|
|
@@ -1285,6 +1441,7 @@ class AsyncDatasetsClient:
|
|
|
1285
1441
|
items: typing.Sequence[DatasetItemWrite],
|
|
1286
1442
|
dataset_name: typing.Optional[str] = OMIT,
|
|
1287
1443
|
dataset_id: typing.Optional[str] = OMIT,
|
|
1444
|
+
batch_group_id: typing.Optional[str] = OMIT,
|
|
1288
1445
|
request_options: typing.Optional[RequestOptions] = None,
|
|
1289
1446
|
) -> None:
|
|
1290
1447
|
"""
|
|
@@ -1300,6 +1457,9 @@ class AsyncDatasetsClient:
|
|
|
1300
1457
|
dataset_id : typing.Optional[str]
|
|
1301
1458
|
If null, dataset_name must be provided
|
|
1302
1459
|
|
|
1460
|
+
batch_group_id : typing.Optional[str]
|
|
1461
|
+
Optional batch group ID to group multiple batches into a single dataset version. If null, mutates the latest version instead of creating a new one.
|
|
1462
|
+
|
|
1303
1463
|
request_options : typing.Optional[RequestOptions]
|
|
1304
1464
|
Request-specific configuration.
|
|
1305
1465
|
|
|
@@ -1319,7 +1479,11 @@ class AsyncDatasetsClient:
|
|
|
1319
1479
|
asyncio.run(main())
|
|
1320
1480
|
"""
|
|
1321
1481
|
_response = await self._raw_client.create_or_update_dataset_items(
|
|
1322
|
-
items=items,
|
|
1482
|
+
items=items,
|
|
1483
|
+
dataset_name=dataset_name,
|
|
1484
|
+
dataset_id=dataset_id,
|
|
1485
|
+
batch_group_id=batch_group_id,
|
|
1486
|
+
request_options=request_options,
|
|
1323
1487
|
)
|
|
1324
1488
|
return _response.data
|
|
1325
1489
|
|
|
@@ -1580,14 +1744,34 @@ class AsyncDatasetsClient:
|
|
|
1580
1744
|
return _response.data
|
|
1581
1745
|
|
|
1582
1746
|
async def delete_dataset_items(
|
|
1583
|
-
self,
|
|
1747
|
+
self,
|
|
1748
|
+
*,
|
|
1749
|
+
item_ids: typing.Optional[typing.Sequence[str]] = OMIT,
|
|
1750
|
+
dataset_id: typing.Optional[str] = OMIT,
|
|
1751
|
+
filters: typing.Optional[typing.Sequence[DatasetItemFilter]] = OMIT,
|
|
1752
|
+
batch_group_id: typing.Optional[str] = OMIT,
|
|
1753
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
1584
1754
|
) -> None:
|
|
1585
1755
|
"""
|
|
1586
|
-
Delete dataset items
|
|
1756
|
+
Delete dataset items using one of two modes:
|
|
1757
|
+
1. **Delete by IDs**: Provide 'item_ids' to delete specific items by their IDs
|
|
1758
|
+
2. **Delete by filters**: Provide 'dataset_id' with optional 'filters' to delete items matching criteria
|
|
1759
|
+
|
|
1760
|
+
When using filters, an empty 'filters' array will delete all items in the specified dataset.
|
|
1587
1761
|
|
|
1588
1762
|
Parameters
|
|
1589
1763
|
----------
|
|
1590
|
-
item_ids : typing.Sequence[str]
|
|
1764
|
+
item_ids : typing.Optional[typing.Sequence[str]]
|
|
1765
|
+
List of dataset item IDs to delete (max 1000). Use this to delete specific items by their IDs. Mutually exclusive with 'dataset_id' and 'filters'.
|
|
1766
|
+
|
|
1767
|
+
dataset_id : typing.Optional[str]
|
|
1768
|
+
Dataset ID to scope the deletion. Required when using 'filters'. Mutually exclusive with 'item_ids'.
|
|
1769
|
+
|
|
1770
|
+
filters : typing.Optional[typing.Sequence[DatasetItemFilter]]
|
|
1771
|
+
Filters to select dataset items to delete within the specified dataset. Must be used with 'dataset_id'. Mutually exclusive with 'item_ids'. Empty array means 'delete all items in the dataset'.
|
|
1772
|
+
|
|
1773
|
+
batch_group_id : typing.Optional[str]
|
|
1774
|
+
Optional batch group ID to group multiple delete operations into a single dataset version. If null, mutates the latest version instead of creating a new one.
|
|
1591
1775
|
|
|
1592
1776
|
request_options : typing.Optional[RequestOptions]
|
|
1593
1777
|
Request-specific configuration.
|
|
@@ -1602,10 +1786,16 @@ class AsyncDatasetsClient:
|
|
|
1602
1786
|
import asyncio
|
|
1603
1787
|
client = AsyncOpikApi(api_key="YOUR_API_KEY", workspace_name="YOUR_WORKSPACE_NAME", )
|
|
1604
1788
|
async def main() -> None:
|
|
1605
|
-
await client.datasets.delete_dataset_items(
|
|
1789
|
+
await client.datasets.delete_dataset_items()
|
|
1606
1790
|
asyncio.run(main())
|
|
1607
1791
|
"""
|
|
1608
|
-
_response = await self._raw_client.delete_dataset_items(
|
|
1792
|
+
_response = await self._raw_client.delete_dataset_items(
|
|
1793
|
+
item_ids=item_ids,
|
|
1794
|
+
dataset_id=dataset_id,
|
|
1795
|
+
filters=filters,
|
|
1796
|
+
batch_group_id=batch_group_id,
|
|
1797
|
+
request_options=request_options,
|
|
1798
|
+
)
|
|
1609
1799
|
return _response.data
|
|
1610
1800
|
|
|
1611
1801
|
async def delete_datasets_batch(
|
|
@@ -2025,6 +2215,7 @@ class AsyncDatasetsClient:
|
|
|
2025
2215
|
dataset_name: str,
|
|
2026
2216
|
last_retrieved_id: typing.Optional[str] = OMIT,
|
|
2027
2217
|
steam_limit: typing.Optional[int] = OMIT,
|
|
2218
|
+
dataset_version: typing.Optional[str] = OMIT,
|
|
2028
2219
|
request_options: typing.Optional[RequestOptions] = None,
|
|
2029
2220
|
) -> typing.AsyncIterator[bytes]:
|
|
2030
2221
|
"""
|
|
@@ -2038,6 +2229,8 @@ class AsyncDatasetsClient:
|
|
|
2038
2229
|
|
|
2039
2230
|
steam_limit : typing.Optional[int]
|
|
2040
2231
|
|
|
2232
|
+
dataset_version : typing.Optional[str]
|
|
2233
|
+
|
|
2041
2234
|
request_options : typing.Optional[RequestOptions]
|
|
2042
2235
|
Request-specific configuration. You can pass in configuration such as `chunk_size`, and more to customize the request and response.
|
|
2043
2236
|
|
|
@@ -2050,6 +2243,7 @@ class AsyncDatasetsClient:
|
|
|
2050
2243
|
dataset_name=dataset_name,
|
|
2051
2244
|
last_retrieved_id=last_retrieved_id,
|
|
2052
2245
|
steam_limit=steam_limit,
|
|
2246
|
+
dataset_version=dataset_version,
|
|
2053
2247
|
request_options=request_options,
|
|
2054
2248
|
) as r:
|
|
2055
2249
|
async for data in r.data:
|
|
@@ -2120,32 +2314,26 @@ class AsyncDatasetsClient:
|
|
|
2120
2314
|
)
|
|
2121
2315
|
return _response.data
|
|
2122
2316
|
|
|
2123
|
-
async def
|
|
2124
|
-
self,
|
|
2125
|
-
|
|
2126
|
-
*,
|
|
2127
|
-
page: typing.Optional[int] = None,
|
|
2128
|
-
size: typing.Optional[int] = None,
|
|
2129
|
-
request_options: typing.Optional[RequestOptions] = None,
|
|
2130
|
-
) -> DatasetVersionPagePublic:
|
|
2317
|
+
async def delete_version_tag(
|
|
2318
|
+
self, version_hash: str, tag: str, id: str, *, request_options: typing.Optional[RequestOptions] = None
|
|
2319
|
+
) -> None:
|
|
2131
2320
|
"""
|
|
2132
|
-
|
|
2321
|
+
Remove a tag from a dataset version. The version itself is not deleted, only the tag reference.
|
|
2133
2322
|
|
|
2134
2323
|
Parameters
|
|
2135
2324
|
----------
|
|
2136
|
-
|
|
2325
|
+
version_hash : str
|
|
2137
2326
|
|
|
2138
|
-
|
|
2327
|
+
tag : str
|
|
2139
2328
|
|
|
2140
|
-
|
|
2329
|
+
id : str
|
|
2141
2330
|
|
|
2142
2331
|
request_options : typing.Optional[RequestOptions]
|
|
2143
2332
|
Request-specific configuration.
|
|
2144
2333
|
|
|
2145
2334
|
Returns
|
|
2146
2335
|
-------
|
|
2147
|
-
|
|
2148
|
-
Dataset versions
|
|
2336
|
+
None
|
|
2149
2337
|
|
|
2150
2338
|
Examples
|
|
2151
2339
|
--------
|
|
@@ -2153,45 +2341,38 @@ class AsyncDatasetsClient:
|
|
|
2153
2341
|
import asyncio
|
|
2154
2342
|
client = AsyncOpikApi(api_key="YOUR_API_KEY", workspace_name="YOUR_WORKSPACE_NAME", )
|
|
2155
2343
|
async def main() -> None:
|
|
2156
|
-
await client.datasets.
|
|
2344
|
+
await client.datasets.delete_version_tag(version_hash='versionHash', tag='tag', id='id', )
|
|
2157
2345
|
asyncio.run(main())
|
|
2158
2346
|
"""
|
|
2159
|
-
_response = await self._raw_client.
|
|
2160
|
-
id, page=page, size=size, request_options=request_options
|
|
2161
|
-
)
|
|
2347
|
+
_response = await self._raw_client.delete_version_tag(version_hash, tag, id, request_options=request_options)
|
|
2162
2348
|
return _response.data
|
|
2163
2349
|
|
|
2164
|
-
async def
|
|
2350
|
+
async def list_dataset_versions(
|
|
2165
2351
|
self,
|
|
2166
2352
|
id: str,
|
|
2167
2353
|
*,
|
|
2168
|
-
|
|
2169
|
-
|
|
2170
|
-
metadata: typing.Optional[typing.Dict[str, str]] = OMIT,
|
|
2354
|
+
page: typing.Optional[int] = None,
|
|
2355
|
+
size: typing.Optional[int] = None,
|
|
2171
2356
|
request_options: typing.Optional[RequestOptions] = None,
|
|
2172
|
-
) ->
|
|
2357
|
+
) -> DatasetVersionPagePublic:
|
|
2173
2358
|
"""
|
|
2174
|
-
|
|
2359
|
+
Get paginated list of versions for a dataset, ordered by creation time (newest first)
|
|
2175
2360
|
|
|
2176
2361
|
Parameters
|
|
2177
2362
|
----------
|
|
2178
2363
|
id : str
|
|
2179
2364
|
|
|
2180
|
-
|
|
2181
|
-
Optional tag for this version
|
|
2182
|
-
|
|
2183
|
-
change_description : typing.Optional[str]
|
|
2184
|
-
Optional description of changes in this version
|
|
2365
|
+
page : typing.Optional[int]
|
|
2185
2366
|
|
|
2186
|
-
|
|
2187
|
-
Optional user-defined metadata
|
|
2367
|
+
size : typing.Optional[int]
|
|
2188
2368
|
|
|
2189
2369
|
request_options : typing.Optional[RequestOptions]
|
|
2190
2370
|
Request-specific configuration.
|
|
2191
2371
|
|
|
2192
2372
|
Returns
|
|
2193
2373
|
-------
|
|
2194
|
-
|
|
2374
|
+
DatasetVersionPagePublic
|
|
2375
|
+
Dataset versions
|
|
2195
2376
|
|
|
2196
2377
|
Examples
|
|
2197
2378
|
--------
|
|
@@ -2199,34 +2380,34 @@ class AsyncDatasetsClient:
|
|
|
2199
2380
|
import asyncio
|
|
2200
2381
|
client = AsyncOpikApi(api_key="YOUR_API_KEY", workspace_name="YOUR_WORKSPACE_NAME", )
|
|
2201
2382
|
async def main() -> None:
|
|
2202
|
-
await client.datasets.
|
|
2383
|
+
await client.datasets.list_dataset_versions(id='id', )
|
|
2203
2384
|
asyncio.run(main())
|
|
2204
2385
|
"""
|
|
2205
|
-
_response = await self._raw_client.
|
|
2206
|
-
id,
|
|
2386
|
+
_response = await self._raw_client.list_dataset_versions(
|
|
2387
|
+
id, page=page, size=size, request_options=request_options
|
|
2207
2388
|
)
|
|
2208
2389
|
return _response.data
|
|
2209
2390
|
|
|
2210
|
-
async def
|
|
2211
|
-
self,
|
|
2212
|
-
) ->
|
|
2391
|
+
async def restore_dataset_version(
|
|
2392
|
+
self, id: str, *, version_ref: str, request_options: typing.Optional[RequestOptions] = None
|
|
2393
|
+
) -> DatasetVersionPublic:
|
|
2213
2394
|
"""
|
|
2214
|
-
|
|
2395
|
+
Restores the dataset to a previous version state by creating a new version with items copied from the specified version. If the version is already the latest, returns it as-is (no-op).
|
|
2215
2396
|
|
|
2216
2397
|
Parameters
|
|
2217
2398
|
----------
|
|
2218
|
-
version_hash : str
|
|
2219
|
-
|
|
2220
|
-
tag : str
|
|
2221
|
-
|
|
2222
2399
|
id : str
|
|
2223
2400
|
|
|
2401
|
+
version_ref : str
|
|
2402
|
+
Version hash or tag to restore from
|
|
2403
|
+
|
|
2224
2404
|
request_options : typing.Optional[RequestOptions]
|
|
2225
2405
|
Request-specific configuration.
|
|
2226
2406
|
|
|
2227
2407
|
Returns
|
|
2228
2408
|
-------
|
|
2229
|
-
|
|
2409
|
+
DatasetVersionPublic
|
|
2410
|
+
Version restored successfully
|
|
2230
2411
|
|
|
2231
2412
|
Examples
|
|
2232
2413
|
--------
|
|
@@ -2234,24 +2415,37 @@ class AsyncDatasetsClient:
|
|
|
2234
2415
|
import asyncio
|
|
2235
2416
|
client = AsyncOpikApi(api_key="YOUR_API_KEY", workspace_name="YOUR_WORKSPACE_NAME", )
|
|
2236
2417
|
async def main() -> None:
|
|
2237
|
-
await client.datasets.
|
|
2418
|
+
await client.datasets.restore_dataset_version(id='id', version_ref='version_ref', )
|
|
2238
2419
|
asyncio.run(main())
|
|
2239
2420
|
"""
|
|
2240
|
-
_response = await self._raw_client.
|
|
2421
|
+
_response = await self._raw_client.restore_dataset_version(
|
|
2422
|
+
id, version_ref=version_ref, request_options=request_options
|
|
2423
|
+
)
|
|
2241
2424
|
return _response.data
|
|
2242
2425
|
|
|
2243
|
-
async def
|
|
2244
|
-
self,
|
|
2426
|
+
async def update_dataset_version(
|
|
2427
|
+
self,
|
|
2428
|
+
version_hash: str,
|
|
2429
|
+
id: str,
|
|
2430
|
+
*,
|
|
2431
|
+
change_description: typing.Optional[str] = OMIT,
|
|
2432
|
+
tags_to_add: typing.Optional[typing.Sequence[str]] = OMIT,
|
|
2433
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
2245
2434
|
) -> DatasetVersionPublic:
|
|
2246
2435
|
"""
|
|
2247
|
-
|
|
2436
|
+
Update a dataset version's change_description and/or add new tags
|
|
2248
2437
|
|
|
2249
2438
|
Parameters
|
|
2250
2439
|
----------
|
|
2440
|
+
version_hash : str
|
|
2441
|
+
|
|
2251
2442
|
id : str
|
|
2252
2443
|
|
|
2253
|
-
|
|
2254
|
-
|
|
2444
|
+
change_description : typing.Optional[str]
|
|
2445
|
+
Optional description of changes in this version
|
|
2446
|
+
|
|
2447
|
+
tags_to_add : typing.Optional[typing.Sequence[str]]
|
|
2448
|
+
Optional list of tags to add to this version
|
|
2255
2449
|
|
|
2256
2450
|
request_options : typing.Optional[RequestOptions]
|
|
2257
2451
|
Request-specific configuration.
|
|
@@ -2259,7 +2453,7 @@ class AsyncDatasetsClient:
|
|
|
2259
2453
|
Returns
|
|
2260
2454
|
-------
|
|
2261
2455
|
DatasetVersionPublic
|
|
2262
|
-
Version
|
|
2456
|
+
Version updated successfully
|
|
2263
2457
|
|
|
2264
2458
|
Examples
|
|
2265
2459
|
--------
|
|
@@ -2267,10 +2461,14 @@ class AsyncDatasetsClient:
|
|
|
2267
2461
|
import asyncio
|
|
2268
2462
|
client = AsyncOpikApi(api_key="YOUR_API_KEY", workspace_name="YOUR_WORKSPACE_NAME", )
|
|
2269
2463
|
async def main() -> None:
|
|
2270
|
-
await client.datasets.
|
|
2464
|
+
await client.datasets.update_dataset_version(version_hash='versionHash', id='id', )
|
|
2271
2465
|
asyncio.run(main())
|
|
2272
2466
|
"""
|
|
2273
|
-
_response = await self._raw_client.
|
|
2274
|
-
|
|
2467
|
+
_response = await self._raw_client.update_dataset_version(
|
|
2468
|
+
version_hash,
|
|
2469
|
+
id,
|
|
2470
|
+
change_description=change_description,
|
|
2471
|
+
tags_to_add=tags_to_add,
|
|
2472
|
+
request_options=request_options,
|
|
2275
2473
|
)
|
|
2276
2474
|
return _response.data
|