Skip to content
Judgment Labs
Esc
↑↓navigate↵open⌘Jpreview
On this page

Anthropic Integration

If you use Anthropic models within your application, you can trace, monitor, and analyze them with Judgment. You can do this by either

  1. Judgeval Wrap: Add our wrap() around the initialization of your client
  2. OpenTelemetry: Use the AnthropicInstrumentor library to wrap Anthropic SDK calls and send Otel spans to Judgment.

Judgeval Wrap

from anthropic import Anthropic
from judgeval import Tracer, wrap

Tracer.init(project_name="anthropic_project")

anthropic_client = Anthropic()
wrapped_client = wrap(anthropic_client)  # Use wrapped_client from here on

OpenTelemetry

from judgeval import Tracer
# Make sure you installed the dependency: opentelemetry-instrumentation-anthropic
from opentelemetry.instrumentation.anthropic import AnthropicInstrumentor

Tracer.init(project_name="anthropic_project")
Tracer.registerOTELInstrumentation(AnthropicInstrumentor())

Was this page helpful?