-
[OPIK-2802] [P SDK] Implement straightforward solution to save prompts info with spans/traces (#3766)
发布于
2025-10-24 09:58:58 +00:00 - [OPIK-2545] [P SDK] Add support for merging prompts into metadata
- Introduced
promptsparameter inmerge_metadatato allow inclusion of prompt data when merging dictionaries. - Updated span and trace update logic to handle
promptsas a key in metadata. - Added
PromptInfoDicttype definition to represent prompt-related information with attributes likename,prompt, andcommit. - Enhanced
update_spanandupdate_tracefunctions to account for prompts and include them in metadata updates.
- [OPIK-2802] [P SDK] Add unit tests for prompts integration in spans and traces
- Added tests to verify prompt data is correctly included in span and trace metadata.
- Introduced
test_track__span_updated_with_prompts__happy_flowandtest_track__trace_updated_with_prompts__happy_flowfunctions. - Ensured metadata updates include prompts using
PromptInfoDict.
- [OPIK-2802] Add PromptsTab and prompts-based UI integration in TraceDataViewer
- Introduced the
PromptsTabcomponent to display prompt-related metadata in trace details. - Updated
TraceDataViewerto integrate thePromptsTaband dynamically show the tab when prompts are available. - Enhanced metadata parsing logic to detect and display prompts data.
-
[OPIK-2802] Fixed typo in docstring
-
[OPIK-2802] Fixed ESLinter errors
-
[OPIK-2802] [P SDK] Replace
PromptInfoDictwithPromptclass and update prompt handling
- Removed
PromptInfoDictin favor ofPromptclass for better structure and flexibility. - Updated
merge_metadata,update_span, andupdate_traceto usePromptand its conversion methods. - Adjusted unit tests to align with changes, replacing
PromptInfoDictusage. - Added
to_info_dictmethod toPromptfor seamless conversion to metadata-compatible dictionaries.
- [OPIK-2802] [P SDK] Add internal API attributes to
Promptinfo dictionary
- Updated
to_info_dictmethod to includeprompt_idandversion_idfrom internal API attributes. - Ensured backward compatibility by checking attribute existence before inclusion.
- [OPIK-2802] Add link to prompt library in PromptsTab
- Enhanced PromptsTab component with links to the prompt library for better navigation.
- Added
prompt_idandworkspaceNamehandling to dynamically generate links. - Updated UI to display the link with an external link icon when
prompt_idis available.
- [OPIK-2802] Remove the commit hash display from the PromptsTab and add prompt usage documentation
- Removed the commit hash display from the PromptsTab for improved UI clarity.
- Added detailed documentation on associating prompts with traces and spans in the prompt management section.
- Included examples for using
opik_contextmodule and its trace/span updating methods.
-
Optimised images with calibre/image-actions
-
[OPIK-2802] Fixed prompt title
-
[OPIK-2802] Changed a link to a button
-
[OPIK-2802] Added a button with a link
Use in Playground -
[OPIK-2802] Refactor the prompt structure and improve PromptsTab functionality
- Updated
to_info_dictto restructure prompt data using a nestedversionfield. - Refactored PromptsTab to use
PromptWithLatestVersionfor better prompt handling. - Added
CustomUseInPlaygroundButtonand integrated it withTryInPlaygroundButton. - Improved prompts metadata parsing and rendering logic for enhanced UI clarity.
- [OPIK-2802] Update tab selection to handle missing prompts and graphs
- Added fallback logic for
promptstab whenhasPromptsis false. - Ensured a consistent default to
inputtab when applicable.
- [OPIK-2802] Remove redundant
hasPromptslogic from PromptsTab
- Simplified PromptsTab by removing unused
hasPromptscalculation and fallback UI. - Retained focus on rendering prompts directly if available.
- [OPIK-2802] Simplify
merge_metadataby removing unusedpromptsargument
- Updated
merge_metadatacalls inspan_data.pyandtrace_data.pyto remove the redundantpromptsparameter. - Focused on improving code clarity and streamlining metadata merging logic.
-
[OPIK-2802] Fixed ESLinter issues
-
[OPIK-2802] Fixed ESLinter issues
-
[OPIK-2802] Fixed ESLinter and updated PromptsTab button props
- Resolved ESLinter issues by cleaning up unused variables.
- Adjusted button props to set a consistent size and simplified variant handling.
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
下载附件