Class: LLM::Tracer::Null

Inherits:
Tracer
  • Object
show all
Defined in:
lib/llm/tracer/null.rb

Overview

A no-op tracer that ignores all tracing callbacks.

Direct Known Subclasses

Eval::Tracer::Console, Eval::Tracer::JSON

Instance Method Summary collapse

Instance Method Details

#set_finish_metadata_proc(_proc = nil) ⇒ self

Parameters:

  • proc (Proc, nil) —

    (res) -> Hash or nil

Returns:

  • (self)


72
73
74
75
# File 'lib/llm/tracer/null.rb', line 72

def (_proc = nil)
  Thread.current[LLM::Tracer::FINISH_METADATA_PROC_KEY] = nil
  self
end

#on_request_finish ⇒ nil

Parameters:

  • operation (String)
  • res (LLM::Response)
  • span (Object, nil)
  • model (String)
  • outputs (Hash, nil) —

    Optional span attributes (e.g. gen_ai.output.messages) from llm.rb or caller.

  • metadata (Hash, nil) —

    Optional metadata from llm.rb or caller.

  • request_id (String) —

    The id of the request that can be matched back to #on_request_start

Returns:

  • (nil)


17
18
19
# File 'lib/llm/tracer/null.rb', line 17

def on_request_finish(**)
  nil
end

#on_request_error ⇒ nil

Parameters:

Returns:

  • (nil)


24
25
26
# File 'lib/llm/tracer/null.rb', line 24

def on_request_error(**)
  nil
end

#on_tool_start ⇒ nil

Parameters:

  • id (String) —

    The tool call ID assigned by the model/provider

  • name (String) —

    The tool (function) name.

  • arguments (Hash) —

    The parsed tool arguments.

  • model (String) —

    The model name

Returns:

  • (nil)


31
32
33
# File 'lib/llm/tracer/null.rb', line 31

def on_tool_start(**)
  nil
end

#on_tool_interrupt ⇒ nil

Parameters:

Returns:

  • (nil)


38
39
40
# File 'lib/llm/tracer/null.rb', line 38

def on_tool_interrupt(**)
  nil
end

#on_tool_finish ⇒ nil

Parameters:

Returns:

  • (nil)


45
46
47
# File 'lib/llm/tracer/null.rb', line 45

def on_tool_finish(**)
  nil
end

#on_tool_error ⇒ nil

Parameters:

Returns:

  • (nil)


52
53
54
# File 'lib/llm/tracer/null.rb', line 52

def on_tool_error(**)
  nil
end

#on_interrupt ⇒ nil

Parameters:

Returns:

  • (nil)


59
60
61
# File 'lib/llm/tracer/null.rb', line 59

def on_interrupt(**)
  nil
end

#on_exit ⇒ nil

Returns:

  • (nil)


65
66
67
# File 'lib/llm/tracer/null.rb', line 65

def on_exit
  nil
end

#on_request_start ⇒ nil

Parameters:

  • operation (String)
  • model (String)
  • inputs (Hash, nil) —

    Optional span attributes (e.g. gen_ai.input.messages) from llm.rb or caller.

  • request_id (String) —

    The id of the request. It is a UUIDv7, and it is shared by #on_request_start, #on_request_finish, and #on_request_error for the same request.

Returns:

  • (nil)


10
11
12
# File 'lib/llm/tracer/null.rb', line 10

def on_request_start(**)
  nil
end