evalution
    Preparing search index...

    Function createTracerForPrompt

    • Wraps a Tracer so that every span it produces is tagged with the attributes that associate it with a prompt — the prompt's name (PROMPT_NAME_ATTRIBUTE), an optional global prompt ID (PROMPT_ID_ATTRIBUTE), and an 'LLM' span kind (SPAN_KIND_ATTRIBUTE). Attributes set explicitly on an individual span take precedence over these defaults.

      This depends only on @opentelemetry/api, so it can be re-used by SDK adapter packages (e.g. @evalution/vercel-ai-sdk) without pulling in the rest of evalution.

      Parameters

      • prompt: PromptSpanInfo

        The prompt to attribute spans to. name is a human-readable name; the optional id is a globally-unique prompt ID used to resolve runtime traces back to the prompt.

      • Optionaltracer: Tracer

        Tracer to wrap. Defaults to a tracer from the globally registered tracer provider.

      Returns Tracer

      A tracer that forwards to tracer while attaching the prompt attributes to each span it creates.