Class: LangGraphRB::LLMBase
- Inherits:
-
Object
- Object
- LangGraphRB::LLMBase
- Defined in:
- lib/langgraph_rb/llm_base.rb
Overview
Abstract base for chat LLM clients. Implementations must provide #call(messages, tools: nil) and may support #bind_tools.
Direct Known Subclasses
Instance Attribute Summary collapse
-
#model ⇒ Object
readonly
Returns the value of attribute model.
-
#temperature ⇒ Object
readonly
Returns the value of attribute temperature.
Instance Method Summary collapse
- #bind_tools(tools) ⇒ Object
- #bound_tools ⇒ Object
- #call(_messages, tools: nil) ⇒ Object
-
#initialize(model:, temperature: 0.0) ⇒ LLMBase
constructor
A new instance of LLMBase.
-
#set_observers(observers, node_name) ⇒ Object
Called by runtime to allow LLM client to emit tracing/telemetry events.
Constructor Details
#initialize(model:, temperature: 0.0) ⇒ LLMBase
9 10 11 12 13 14 15 |
# File 'lib/langgraph_rb/llm_base.rb', line 9 def initialize(model:, temperature: 0.0) @model = model @temperature = temperature @bound_tools = [] @observers = [] @node_name = nil end |
Instance Attribute Details
#model ⇒ Object (readonly)
Returns the value of attribute model.
7 8 9 |
# File 'lib/langgraph_rb/llm_base.rb', line 7 def model @model end |
#temperature ⇒ Object (readonly)
Returns the value of attribute temperature.
7 8 9 |
# File 'lib/langgraph_rb/llm_base.rb', line 7 def temperature @temperature end |
Instance Method Details
#bind_tools(tools) ⇒ Object
23 24 25 26 |
# File 'lib/langgraph_rb/llm_base.rb', line 23 def bind_tools(tools) @bound_tools = Array(tools) self end |
#bound_tools ⇒ Object
28 29 30 |
# File 'lib/langgraph_rb/llm_base.rb', line 28 def bound_tools @bound_tools end |
#call(_messages, tools: nil) ⇒ Object
32 33 34 |
# File 'lib/langgraph_rb/llm_base.rb', line 32 def call(, tools: nil) raise NotImplementedError, "Subclasses must implement #call(messages, tools: nil)" end |
#set_observers(observers, node_name) ⇒ Object
Called by runtime to allow LLM client to emit tracing/telemetry events
18 19 20 21 |
# File 'lib/langgraph_rb/llm_base.rb', line 18 def set_observers(observers, node_name) @observers = Array(observers) @node_name = node_name end |