Module: Braintrust::Trace::Contrib::Github::Crmne::RubyLLM
- Defined in:
- lib/braintrust/contrib/ruby_llm/deprecated.rb
Class Method Summary collapse
-
.unwrap(chat = nil) ⇒ RubyLLM::Chat?
Unwrap RubyLLM to disable Braintrust tracing.
-
.wrap(chat = nil, tracer_provider: nil) ⇒ RubyLLM::Chat?
Wrap RubyLLM to automatically create spans for chat requests.
Class Method Details
.unwrap(chat = nil) ⇒ RubyLLM::Chat?
Unwrap RubyLLM to disable Braintrust tracing. This is the legacy API - uses the Context pattern to disable tracing.
Note: Prepended modules cannot be truly removed in Ruby. This method sets ‘enabled: false` in the Context, which the instrumentation checks before creating spans.
33 34 35 36 37 38 39 |
# File 'lib/braintrust/contrib/ruby_llm/deprecated.rb', line 33 def self.unwrap(chat = nil) Log.warn("Braintrust::Trace::Contrib::Github::Crmne::RubyLLM.unwrap() is deprecated and will be removed in a future version.") target = chat || ::RubyLLM::Chat Braintrust::Contrib::Context.set!(target, enabled: false) chat end |
.wrap(chat = nil, tracer_provider: nil) ⇒ RubyLLM::Chat?
Wrap RubyLLM to automatically create spans for chat requests. This is the legacy API - delegates to the new contrib framework.
18 19 20 21 22 |
# File 'lib/braintrust/contrib/ruby_llm/deprecated.rb', line 18 def self.wrap(chat = nil, tracer_provider: nil) Log.warn("Braintrust::Trace::Contrib::Github::Crmne::RubyLLM.wrap() is deprecated and will be removed in a future version: use Braintrust.instrument!() instead.") Braintrust.instrument!(:ruby_llm, target: chat, tracer_provider: tracer_provider) chat end |