Module: LLM::Google::ResponseAdapter
- Defined in:
- lib/llm/providers/google/response_adapter.rb,
lib/llm/providers/google/response_adapter/file.rb,
lib/llm/providers/google/response_adapter/files.rb,
lib/llm/providers/google/response_adapter/image.rb,
lib/llm/providers/google/response_adapter/models.rb,
lib/llm/providers/google/response_adapter/embedding.rb,
lib/llm/providers/google/response_adapter/completion.rb,
lib/llm/providers/google/response_adapter/web_search.rb
Defined Under Namespace
Modules: Completion, Embedding, File, Files, Image, Models, WebSearch
Class Method Summary collapse
Class Method Details
.adapt(res, type:) ⇒ LLM::Response
21 22 23 24 |
# File 'lib/llm/providers/google/response_adapter.rb', line 21 def adapt(res, type:) response = (LLM::Response === res) ? res : LLM::Response.new(res) response.extend(select(type)) end |
.select(type) ⇒ 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.
28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/llm/providers/google/response_adapter.rb', line 28 def select(type) case type when :completion then LLM::Google::ResponseAdapter::Completion when :embedding then LLM::Google::ResponseAdapter::Embedding when :file then LLM::Google::ResponseAdapter::File when :files then LLM::Google::ResponseAdapter::Files when :image then LLM::Google::ResponseAdapter::Image when :models then LLM::Google::ResponseAdapter::Models when :web_search then LLM::Google::ResponseAdapter::WebSearch else raise ArgumentError, "Unknown response adapter type: #{type.inspect}" end end |