Class: Payloop::Wrappers::RubyLLM
- Inherits:
-
Object
- Object
- Payloop::Wrappers::RubyLLM
- Defined in:
- lib/payloop/wrappers/ruby_llm.rb
Overview
Wrapper for RubyLLM (ruby_llm gem) Supports any provider available via RubyLLM (Anthropic, OpenAI, Google, etc.) Returns raw response and raw formatted query to backend so that the existing extractors can be used.
Instance Method Summary collapse
-
#initialize(config, collector, sentinel = nil) ⇒ RubyLLM
constructor
A new instance of RubyLLM.
- #register(client) ⇒ Object
Constructor Details
#initialize(config, collector, sentinel = nil) ⇒ RubyLLM
Returns a new instance of RubyLLM.
12 13 14 15 16 |
# File 'lib/payloop/wrappers/ruby_llm.rb', line 12 def initialize(config, collector, sentinel = nil) @config = config @collector = collector @sentinel = sentinel end |
Instance Method Details
#register(client) ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/payloop/wrappers/ruby_llm.rb', line 18 def register(client) validate_client!(client) # Prevent double registration return client if client.instance_variable_defined?(:@payloop_registered) # Store references in the client instance client.instance_variable_set(:@payloop_config, @config) client.instance_variable_set(:@payloop_collector, @collector) client.instance_variable_set(:@payloop_sentinel, @sentinel) client.instance_variable_set(:@payloop_registered, true) # Ask method handles both streaming and non-streaming cases unlike some others. wrap_ask_method(client) client end |