Module: Braintrust::Trace::Anthropic

Defined in:
lib/braintrust/contrib/anthropic/deprecated.rb

Class Method Summary collapse

Class Method Details

.wrap(client, tracer_provider: nil) ⇒ Anthropic::Client

Wrap an Anthropic::Client to automatically create spans for messages. This is the legacy API - delegates to the new contrib framework.

Parameters:

  • client (Anthropic::Client)

    the Anthropic client to wrap

  • tracer_provider (OpenTelemetry::SDK::Trace::TracerProvider) (defaults to: nil)

    the tracer provider

Returns:

  • (Anthropic::Client)

    the wrapped client



17
18
19
20
21
# File 'lib/braintrust/contrib/anthropic/deprecated.rb', line 17

def self.wrap(client, tracer_provider: nil)
  Log.warn("Braintrust::Trace::Anthropic.wrap() is deprecated and will be removed in a future version: use Braintrust.instrument!() instead.")
  Braintrust.instrument!(:anthropic, target: client, tracer_provider: tracer_provider)
  client
end