Class: Payloop::Wrappers::Google
- Inherits:
-
Object
- Object
- Payloop::Wrappers::Google
- Defined in:
- lib/payloop/wrappers/google.rb
Overview
Wrapper for Google GenerativeAI Ruby client (google-genai library version 0.1)
Instance Method Summary collapse
-
#initialize(config, collector, sentinel = nil) ⇒ Google
constructor
A new instance of Google.
- #register(client) ⇒ Object
Constructor Details
#initialize(config, collector, sentinel = nil) ⇒ Google
Returns a new instance of Google.
9 10 11 12 13 |
# File 'lib/payloop/wrappers/google.rb', line 9 def initialize(config, collector, sentinel = nil) @config = config @collector = collector @sentinel = sentinel end |
Instance Method Details
#register(client) ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/payloop/wrappers/google.rb', line 15 def register(client) validate_client!(client) # Prevent double registration return client if client.instance_variable_defined?(:@payloop_registered) # Patch response class after client is validated (ensures gem is loaded) patch_response_class! # Store references in 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) # Wrap the generate_content method wrap_generate_content_method(client) client end |