Module: RubyLLM::Instrumentation

Defined in:
lib/ruby_llm/instrumentation.rb,
lib/ruby_llm/instrumentation/chat.rb,
lib/ruby_llm/instrumentation/image.rb,
lib/ruby_llm/instrumentation/railtie.rb,
lib/ruby_llm/instrumentation/version.rb,
lib/ruby_llm/instrumentation/embedding.rb,
lib/ruby_llm/instrumentation/moderation.rb,
lib/ruby_llm/instrumentation/transcription.rb

Defined Under Namespace

Modules: Chat, Embedding, Image, Moderation, Transcription Classes: Railtie

Constant Summary collapse

METADATA_KEY =
:ruby_llm_instrumentation_metadata
VERSION =
"0.3.1"

Class Method Summary collapse

Class Method Details

.current_metadata ⇒ Object



24
25
26
# File 'lib/ruby_llm/instrumentation.rb', line 24

def 
  Thread.current[METADATA_KEY] || {}
end

.with(metadata = {}) ⇒ Object



16
17
18
19
20
21
22
# File 'lib/ruby_llm/instrumentation.rb', line 16

def with( = {})
   = Thread.current[METADATA_KEY]
  Thread.current[METADATA_KEY] = ( || {}).merge()
  yield
ensure
  Thread.current[METADATA_KEY] = 
end