发布

  • [issue-5081] [FE] Expose metadata in Python online evaluation rules (#5099)

    frostbyte_neo 发布于 2026-02-06 13:00:07 +00:00

    Added metadata parameter to default Python code templates for both
    trace and span evaluation rules. This allows users to access trace
    metadata (e.g., token counts) directly in their custom metrics.

    Changes:

    • Updated DEFAULT_PYTHON_CODE_TRACE_DATA to include metadata parameter
    • Updated DEFAULT_PYTHON_CODE_SPAN_DATA to include metadata parameter
    • Added metadata to default arguments mapping for both templates

    The backend infrastructure already supports metadata extraction via
    TraceSection.METADATA, but it wasn't exposed in the default templates.
    This change makes metadata immediately discoverable to users.

    Co-authored-by: Douglas Blank doug@comet.com
    Co-authored-by: Claude Sonnet 4.5 noreply@anthropic.com

    下载附件