Module: Braintrust::Contrib::Anthropic::Instrumentation::BetaMessages

Defined in:
lib/braintrust/contrib/anthropic/instrumentation/beta_messages.rb

Overview

Note:

Beta APIs are experimental and subject to change between SDK versions. This module includes defensive coding to handle response format changes.

Beta Messages instrumentation for Anthropic. Wraps client.beta.messages.create() and stream() methods to create spans.

Defined Under Namespace

Modules: InstanceMethods

Class Method Summary collapse

Class Method Details

.applied?(base) ⇒ Boolean

Returns:

  • (Boolean)


23
24
25
# File 'lib/braintrust/contrib/anthropic/instrumentation/beta_messages.rb', line 23

def self.applied?(base)
  base.ancestors.include?(InstanceMethods)
end

.included(base) ⇒ Object



19
20
21
# File 'lib/braintrust/contrib/anthropic/instrumentation/beta_messages.rb', line 19

def self.included(base)
  base.prepend(InstanceMethods) unless applied?(base)
end