Track LLM errors in your endpoint

// Create generation object
const generation = trace.generation({
    id: "generation-id",
    name: "customer-support--gather-information",
    // Additional fields
});

// Track error
generation.error({
    message: "Rate limit exceeded. Please try again later.",
    type: "RateLimitError",
    code: "429",
});
Learn how to track complete LLM flows in the LLM logging guide.

Track errors from tool calls

const traceToolCall = trace.toolCall({
    id: "tool-call-id",
    name: "tool-call-name",
});

traceToolCall.error({
    message: "Service is currently unavailable. Please try again later.",
    type: "ServiceUnavailableError",
    code: "503",
});
Explore more on tool call tracking in the Tool calls logging guide.
Error