import { a as TokenUsage, t as EstimateCostOptions } from "./cost-CiXR1eKW.cjs"; import { p as GenAiOperationName } from "./semconv-BdR5pWDh.cjs"; import { a as GenAiResponseInput, i as GenAiRequestInput, l as GenAiWorkflowInput, n as GenAiAttributeMap, s as GenAiToolInput, t as GenAiAgentInput } from "./attributes-DDx3HQe8.cjs"; import { TraceContext } from "autotel"; //#region src/trace.d.ts /** Configuration for {@link traceGenAI}. */ export interface TraceGenAIConfig extends GenAiRequestInput { /** Operation kind; defaults to `chat`. */ operation?: GenAiOperationName | (string & {}); /** Agent metadata used for agent span names and attributes. */ agent?: GenAiAgentInput; /** Tool metadata used for tool span names and attributes. */ tool?: GenAiToolInput; /** Workflow metadata used for workflow span names and attributes. */ workflow?: GenAiWorkflowInput; /** Override the computed canonical span name. */ spanName?: string; /** Extra attributes to set on the span (any namespace). */ attributes?: GenAiAttributeMap; /** * Record the canonical GenAI metrics alongside the span. On by default, and * a no-op without a registered `MeterProvider`. Set `false` when something * upstream already emits `gen_ai.client.*` and you would double-count. */ metrics?: boolean; } /** * Build a traced GenAI factory. Pass a factory `(ctx) => (...args) => result`; * the returned function runs that handler inside a span carrying the canonical * request attributes. */ export declare function traceGenAI(config: TraceGenAIConfig): (factory: (ctx: TraceContext) => (...args: TArgs) => Promise) => ((...args: TArgs) => Promise); /** Alias for {@link traceGenAI}, kept for LLM-call ergonomics. */ export declare const traceLLM: typeof traceGenAI; /** Record canonical `gen_ai.response.*` attributes on the active span. */ export declare function recordGenAiResponse(ctx: Pick, input: GenAiResponseInput): void; /** * Record canonical `gen_ai.usage.*` token attributes and the estimated * `gen_ai.usage.cost.usd`. Returns the estimated cost (or `undefined` when the * model has no known pricing). Pass `recordCost: false` to skip cost estimation. */ export declare function recordGenAiUsage(ctx: Pick, model: string, usage: TokenUsage, options?: EstimateCostOptions & { recordCost?: boolean; }): number | undefined; //#endregion