Module: Foam::Otel::LLM::RubyLLMShim::ProviderPatch

Defined in:
lib/foam/otel/llm/ruby_llm_shim.rb

Instance Method Summary collapse

Instance Method Details

#complete(messages, **kwargs, &block) ⇒ Object



117
118
119
120
121
122
123
124
125
126
# File 'lib/foam/otel/llm/ruby_llm_shim.rb', line 117

def complete(messages, **kwargs, &block)
  provider = RubyLLMShim.provider_name(self)
  Foam::Otel::LLM.observe(
    provider: provider,
    request: Foam::Otel::LLM.safe_request(provider: provider) do
      RubyLLMShim.request(self, messages, kwargs[:model])
    end,
    response_extractor: RubyLLMShim::RESPONSE
  ) { super(messages, **kwargs, &block) }
end