Class: Phronomy::LLMAdapter::RubyLLM
- Defined in:
- lib/phronomy/llm_adapter/ruby_llm.rb
Overview
LLM adapter that delegates to the RubyLLM blocking client.
This is the default adapter used by Phronomy agents. It wraps
chat.ask (and its streaming variant) so that the blocking HTTP
call runs inside BlockingAdapterPool rather than on the EventLoop
thread or the caller's thread directly.
Instance Method Summary collapse
-
#complete(chat, message, config: {}) ⇒ Object
private
Delegates to
chat.ask(message)orchat.completewhen message is nil. -
#stream(chat, message, config: {}) {|chunk| ... } ⇒ Object
private
Delegates to
chat.ask(message) { |chunk| block.call(chunk) }orchat.complete(&block)when message is nil.
Methods inherited from Base
#complete_async, #stream_async
Instance Method Details
#complete(chat, message, config: {}) ⇒ Object
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.
Delegates to chat.ask(message) or chat.complete when message is nil.
Passing nil for message is used by the ReAct loop for continuation
turns where the user message has already been added to the chat history
(e.g. after a tool result) and the LLM should continue without a new
user turn.
29 30 31 |
# File 'lib/phronomy/llm_adapter/ruby_llm.rb', line 29 def complete(chat, , config: {}) ? chat.ask() : chat.complete end |
#stream(chat, message, config: {}) {|chunk| ... } ⇒ Object
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.
Delegates to chat.ask(message) { |chunk| block.call(chunk) } or
chat.complete(&block) when message is nil.
42 43 44 |
# File 'lib/phronomy/llm_adapter/ruby_llm.rb', line 42 def stream(chat, , config: {}, &block) ? chat.ask(, &block) : chat.complete(&block) end |