Class: LLM::Repl::Stream Private
- Inherits:
-
Stream
- Object
- Stream
- LLM::Repl::Stream
- Defined in:
- lib/llm/repl/stream.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
The LLM::Repl::Stream class manages the stream for the LLM::Repl class. This class has defined hooks that receive text, tool calls, and tool returns.
Instance Method Summary collapse
- #initialize(repl) ⇒ LLM::Repl::Stream constructor private
- #on_content(chars) ⇒ void private
- #on_tool_call(tool, error) ⇒ void private
- #on_tool_return(_tool, result) ⇒ void private
Constructor Details
#initialize(repl) ⇒ LLM::Repl::Stream
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
14 15 16 |
# File 'lib/llm/repl/stream.rb', line 14 def initialize(repl) @repl = repl end |
Instance Method Details
#on_content(chars) ⇒ void
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
This method returns an undefined value.
22 23 24 |
# File 'lib/llm/repl/stream.rb', line 22 def on_content(chars) @repl.write(chars) end |
#on_tool_call(tool, error) ⇒ void
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
This method returns an undefined value.
30 31 32 33 34 35 36 |
# File 'lib/llm/repl/stream.rb', line 30 def on_tool_call(tool, error) if error @repl.status = "tool error: #{tool.name}" else @repl.status = "tool: #{tool.name}" end end |
#on_tool_return(_tool, result) ⇒ void
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
This method returns an undefined value.
42 43 44 |
# File 'lib/llm/repl/stream.rb', line 42 def on_tool_return(_tool, result) @repl.status = "tool done: #{result.name}" end |