-
[OPIK-2426] [SDK] Implement a way to pass special opik arguments to tracked functions (#3324)
发布于
2025-09-22 16:05:03 +00:00 - [OPIK-2426] [P SDK] Add opik_args extraction and application in tracking decorators
- Added
helpers.pyto handle extraction and application ofopik_args. - Updated base tracking logic to use
opik_argsfor enhanced tracing and tagging. - Introduced tests for
opik_argsfunctionality, including nested and explicit use cases. - Enhanced tracking to merge
opik_argswith 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_argspropagation in both explicit and implicit cases for nested and asynchronous functions. - Refactored test setup with a reusable
opik_args_dictinitialization. - 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_argshandling and tests for clarity and maintainability
- Simplified the
extract_opik_argsfunction by removing the need to returncleaned_kwargs. - Introduced
TrackingStartOptionsto 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_argsextraction 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.pyfor reusability and clarity. - Removed redundant merge implementations from
helpers.py,trace_data.py, andspan_data.py. - Updated associated tests to ensure coverage for
data_helpers. - Added new unit tests in
test_data_helpers.pyto validate centralized logic.
- [OPIK-2426] [P SDK] Extend merge logic in
data_helpersto handle Pydantic models
- Updated
merge_metadata,merge_inputs, andmerge_outputsfunctions to support merging with Pydantic models. - Refactored
_merge_dictionariesinto_merge_dictionary_with_datato accommodate the new functionality. - Adjusted usage in
span_data.pyandtrace_data.pyfor compatibility with the refactored functions. - Minor type hint updates to improve clarity.
- [OPIK-2426] [P SDK] Extend tag merge logic in
span_dataandtrace_datausingdata_helpers
- Added calls to
data_helpers.merge_tagsinspan_data.pyandtrace_data.pyto support merging tag updates. - Ensured consistency with centralized merge logic.
- [OPIK-2426] [P SDK] Rename
schematooutput_schemain structured output compliance models and tests to get rid of Pydantic warning about shading internal field.
- Renamed
schematooutput_schemaacrossFewShotExampleStructuredOutputCompliancemodel, examples, and related files for better clarity. - Updated templates, tests, and validations accordingly.
Co-authored-by: Aliaksandr Kuzmik 98702584+alexkuzmik@users.noreply.github.com
下载附件