Maxim Logo
How toLog your application

Track errors in traces

Learn how to effectively track and log errors from LLM results and Tool calls in your AI application traces to improve performance and reliability.

Track LLM errors in your workflow

// 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.

On this page