Class: LLM::Clients::Gemini
- Inherits:
-
Object
- Object
- LLM::Clients::Gemini
- Includes:
- HTTParty
- Defined in:
- lib/llm/clients/gemini.rb,
lib/llm/clients/gemini/request.rb,
lib/llm/clients/gemini/response.rb
Defined Under Namespace
Instance Method Summary collapse
- #chat(messages, options = {}) ⇒ Object
-
#initialize(llm:) ⇒ Gemini
constructor
A new instance of Gemini.
Constructor Details
#initialize(llm:) ⇒ Gemini
Returns a new instance of Gemini.
12 13 14 |
# File 'lib/llm/clients/gemini.rb', line 12 def initialize(llm:) @llm = llm end |
Instance Method Details
#chat(messages, options = {}) ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/llm/clients/gemini.rb', line 16 def chat(, = {}) req = Request.new(, ) return chat_streaming(req, [:on_message], [:on_complete]) if [:stream] resp = post_url( "/v1beta/models/#{llm.canonical_name}:generateContent", body: req.params.to_json ) Response.new(resp).to_normalized_response end |