发布

  • [OPIK-2802] [P SDK] Implement straightforward solution to save prompts info with spans/traces (#3766)

    frostbyte_neo 发布于 2025-10-24 09:58:58 +00:00

    • [OPIK-2545] [P SDK] Add support for merging prompts into metadata
    • Introduced prompts parameter in merge_metadata to allow inclusion of prompt data when merging dictionaries.
    • Updated span and trace update logic to handle prompts as a key in metadata.
    • Added PromptInfoDict type definition to represent prompt-related information with attributes like name, prompt, and commit.
    • Enhanced update_span and update_trace functions 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_flow and test_track__trace_updated_with_prompts__happy_flow functions.
    • Ensured metadata updates include prompts using PromptInfoDict.
    • [OPIK-2802] Add PromptsTab and prompts-based UI integration in TraceDataViewer
    • Introduced the PromptsTab component to display prompt-related metadata in trace details.
    • Updated TraceDataViewer to integrate the PromptsTab and 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 PromptInfoDict with Prompt class and update prompt handling

    • Removed PromptInfoDict in favor of Prompt class for better structure and flexibility.
    • Updated merge_metadata, update_span, and update_trace to use Prompt and its conversion methods.
    • Adjusted unit tests to align with changes, replacing PromptInfoDict usage.
    • Added to_info_dict method to Prompt for seamless conversion to metadata-compatible dictionaries.
    • [OPIK-2802] [P SDK] Add internal API attributes to Prompt info dictionary
    • Updated to_info_dict method to include prompt_id and version_id from 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_id and workspaceName handling to dynamically generate links.
    • Updated UI to display the link with an external link icon when prompt_id is 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_context module 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_dict to restructure prompt data using a nested version field.
    • Refactored PromptsTab to use PromptWithLatestVersion for better prompt handling.
    • Added CustomUseInPlaygroundButton and integrated it with TryInPlaygroundButton.
    • 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 prompts tab when hasPrompts is false.
    • Ensured a consistent default to input tab when applicable.
    • [OPIK-2802] Remove redundant hasPrompts logic from PromptsTab
    • Simplified PromptsTab by removing unused hasPrompts calculation and fallback UI.
    • Retained focus on rendering prompts directly if available.
    • [OPIK-2802] Simplify merge_metadata by removing unused prompts argument
    • Updated merge_metadata calls in span_data.py and trace_data.py to remove the redundant prompts parameter.
    • 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>

    下载附件