Class: LLM::Tracer::Null

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

Overview

A no-op tracer that ignores all tracing callbacks.

Constant Summary

Constants inherited from LLM::Tracer

FINISH_METADATA_PROC_KEY

Instance Method Summary collapse

Methods inherited from LLM::Tracer

#consume_extra_inputs, #consume_extra_outputs, #consume_request_metadata, #current_extra, #flush!, #initialize, #inspect, #merge_extra, #set_request_metadata, #spans, #start_trace, #stop_trace

Constructor Details

This class inherits a constructor from LLM::Tracer

Instance Method Details

#on_tool_startnil

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_request_finishnil

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 (emitted as langsmith.metadata.*) from llm.rb or caller.

Returns:

  • (nil)


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

def on_request_finish(**)
  nil
end

#on_request_errornil

Parameters:

Returns:

  • (nil)


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

def on_request_error(**)
  nil
end

#on_request_startnil

Parameters:

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

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

Returns:

  • (nil)


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

def on_request_start(**)
  nil
end

#on_tool_finishnil

Parameters:

Returns:

  • (nil)


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

def on_tool_finish(**)
  nil
end

#on_tool_errornil

Parameters:

  • ex (Exception)

    The raised error.

  • span (Object, nil)

    The span/context object returned by #on_tool_start.

Returns:

  • (nil)


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

def on_tool_error(**)
  nil
end

#set_finish_metadata_proc(_proc = nil) ⇒ self

Parameters:

  • proc (Proc, nil)

    (res) -> Hash or nil

Returns:

  • (self)


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

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