Module: LLM::Function::Tracing

Included in:
LLM::Function
Defined in:
lib/llm/function/tracing.rb

Overview

The LLM::Function::Tracing module patches an LLM function (or tool) in order to add tracing support.

Instance Method Summary collapse

Instance Method Details

#callObject



8
9
10
11
12
13
14
15
16
17
# File 'lib/llm/function/tracing.rb', line 8

def call(...)
  return super unless @tracer
  span = @tracer.on_tool_start(id:, name:, arguments:, model:)
  result = super
  @tracer.on_tool_finish(result:, span:)
  result
rescue => ex
  @tracer.on_tool_error(ex:, span:)
  raise(ex)
end