发布

  • [OPIK-2426] [SDK] Implement a way to pass special opik arguments to tracked functions (#3324)

    frostbyte_neo 发布于 2025-09-22 16:05:03 +00:00

    • [OPIK-2426] [P SDK] Add opik_args extraction and application in tracking decorators
    • Added helpers.py to handle extraction and application of opik_args.
    • Updated base tracking logic to use opik_args for enhanced tracing and tagging.
    • Introduced tests for opik_args functionality, including nested and explicit use cases.
    • Enhanced tracking to merge opik_args with start span and trace parameters.
    • [OPIK-2426] [P SDK] Add tests for explicit and implicit opik_args in nested and async functions
    • Introduced new tests to validate opik_args propagation in both explicit and implicit cases for nested and asynchronous functions.
    • Refactored test setup with a reusable opik_args_dict initialization.
    • Added helper methods to streamline expected trace tree generation and validation.
    • Removed redundant or outdated test cases for simplification.
    • [OPIK-2429] [P SDK] Refactor opik_args handling and tests for clarity and maintainability
    • Simplified the extract_opik_args function by removing the need to return cleaned_kwargs.
    • Introduced TrackingStartOptions to consolidate start span arguments and related tracing headers.
    • Updated tracking decorators to use the unified start options object.
    • Adjusted test cases to reflect the simplified opik_args extraction and application logic.
    • Improved consistency in variable naming across tests and implementation.
    • [OPIK-2429] [P SDK] Added documentation describing usage of opik_args

    • [OPIK-2429] [P SDK] Added type hints to the documentation for better clarity.

    • [OPIK-2429] [P SDK] Fix to the documentation formatting.

    • [OPIK-2429] [P SDK] Updated docstrings.

    • [OPIK-2429] [P SDK] Updated documentation to provide earlier reference to the available opik_args feature.

    • [OPIK-2426] [P SDK] Refactor metadata, tags, and input/output merge logic with data_helpers

    • Centralized merge logic for metadata, tags, inputs, and outputs into data_helpers.py for reusability and clarity.
    • Removed redundant merge implementations from helpers.py, trace_data.py, and span_data.py.
    • Updated associated tests to ensure coverage for data_helpers.
    • Added new unit tests in test_data_helpers.py to validate centralized logic.
    • [OPIK-2426] [P SDK] Extend merge logic in data_helpers to handle Pydantic models
    • Updated merge_metadata, merge_inputs, and merge_outputs functions to support merging with Pydantic models.
    • Refactored _merge_dictionaries into _merge_dictionary_with_data to accommodate the new functionality.
    • Adjusted usage in span_data.py and trace_data.py for compatibility with the refactored functions.
    • Minor type hint updates to improve clarity.
    • [OPIK-2426] [P SDK] Extend tag merge logic in span_data and trace_data using data_helpers
    • Added calls to data_helpers.merge_tags in span_data.py and trace_data.py to support merging tag updates.
    • Ensured consistency with centralized merge logic.
    • [OPIK-2426] [P SDK] Rename schema to output_schema in structured output compliance models and tests to get rid of Pydantic warning about shading internal field.
    • Renamed schema to output_schema across FewShotExampleStructuredOutputCompliance model, examples, and related files for better clarity.
    • Updated templates, tests, and validations accordingly.

    Co-authored-by: Aliaksandr Kuzmik 98702584+alexkuzmik@users.noreply.github.com

    下载附件