BilldogEng.Llm (BilldogEng v1.0.0-beta.1)

Copy Markdown View Source

LLM observability — capture a model invocation as a trace span.

Wraps POST /llm/trace. The wire payload is camelCase (matching the edge function's Zod schema) and authenticates with X-BillDog-API-Key.

Mirrors the Node SDK llm.ts.

Summary

Functions

Record a single LLM trace span.

Functions

capture_trace(client, params)

@spec capture_trace(
  BilldogEng.t(),
  keyword()
) :: {:ok, term()} | {:error, BilldogEng.Error.t()}

Record a single LLM trace span.

Required params (keyword list): :trace_id, :span_id, :model, :input_text, :output_text.

Optional: :parent_span_id, :prompt_tokens, :completion_tokens, :duration_ms, :cost_usd, :properties, :metadata, :timestamp (ISO-8601; defaults to now).