发布

  • [OPIK-4148] [P SDK] Implement support for dataset versions management in the sdk api (#5061)

    frostbyte_neo 发布于 2026-02-05 15:07:19 +00:00

    • [OPIK-4148] [SDK] Add DatasetVersion support for dataset version management
    • Add DatasetExportOperations base class with shared to_pandas/to_json methods
    • Add DatasetVersion class for read-only access to specific dataset versions
    • Add Dataset.get_dataset_version() method to retrieve versions by name
    • Move stream_dataset_items and find_version_by_name to rest_operations
    • Add DatasetVersionNotFound exception

    Co-authored-by: Cursor cursoragent@cursor.com

    • [OPIK-4148] [SDK] Add get_current_version_name and get_version_view methods with e2e tests
    • Add get_current_version_name() to Dataset for retrieving current version
    • Rename get_dataset_version() to get_version_view() for clarity
    • Fix DatasetVersion streaming to use version_hash instead of version_name
    • Add e2e tests for version name changes after mutations
    • Add e2e tests for get_version_view functionality

    Co-authored-by: Cursor cursoragent@cursor.com

    • [OPIK-4148] [SDK] Support DatasetVersion in evaluate functions
    • Update evaluate, evaluate_prompt, evaluate_optimization_trial to accept
      Union[Dataset, DatasetVersion]
    • Add name, id, dataset_items_count properties to DatasetVersion for
      compatibility with evaluation engine
    • Update DatasetVersion.internal_api__stream_items_as_dataclasses to
      accept dataset_item_ids and filter_string parameters
    • Add e2e test verifying evaluate works with DatasetVersion

    Co-authored-by: Cursor cursoragent@cursor.com

    • [OPIK-4148] [SDK] Move evaluate DatasetVersion test to evaluation namespace

    Move test_evaluate__with_dataset_version__evaluates_version_items_only
    from test_dataset.py to tests/e2e/evaluation/test_evaluate_dataset_version.py

    Co-authored-by: Cursor cursoragent@cursor.com

    • Fix lint errors

    • [OPIK-4148] [SDK] Add get_version_info method and pass version ID to experiments

    Add unified get_version_info() method to DatasetExportOperations base class
    that returns DatasetVersionPublic from REST API. Both Dataset and DatasetVersion
    implement this method, enabling evaluate functions to pass the dataset version
    ID when creating experiments.

    Co-authored-by: Cursor cursoragent@cursor.com

    • Update the docs

    • Pass dataset version id to experiment

    • Fix lint errors

    • Update sdks/python/tests/e2e/evaluation/test_evaluate_dataset_version.py

    Co-authored-by: baz-reviewer[bot] <174234987+baz-reviewer[bot]@users.noreply.github.com>

    • [OPIK-4148] [SDK] Fix unit tests for dataset version support

    Update mock datasets to include get_version_info method and update
    create_experiment assertions to include dataset_version_id parameter.

    Co-authored-by: Cursor cursoragent@cursor.com

    • [OPIK-4148] [SDK] Address PR review comments
    • Add TODO(OPIK-4149) for find_version_by_name to use dedicated BE endpoint
    • Move get_items method to DatasetExportOperations base class to share between Dataset and DatasetVersion
    • Merge test_get_current_version_name__version_changes_after_mutations into test_get_version_view__returns_items_from_specific_version

    Co-authored-by: Cursor cursoragent@cursor.com

    • [OPIK-4148] [SDK] Use retrieve_dataset_version endpoint

    Replace pagination-based version lookup with the new dedicated
    retrieve_dataset_version REST API endpoint for better performance.

    Co-authored-by: Cursor cursoragent@cursor.com

    • Update sdks/python/src/opik/api_objects/dataset/rest_operations.py

    Co-authored-by: baz-reviewer[bot] <174234987+baz-reviewer[bot]@users.noreply.github.com>


    Co-authored-by: Cursor cursoragent@cursor.com
    Co-authored-by: baz-reviewer[bot] <174234987+baz-reviewer[bot]@users.noreply.github.com>

    下载附件