Module: LLM::Ollama::ResponseAdapter
- Defined in:
- lib/llm/providers/ollama/response_adapter.rb,
lib/llm/providers/ollama/response_adapter/models.rb,
lib/llm/providers/ollama/response_adapter/embedding.rb,
lib/llm/providers/ollama/response_adapter/completion.rb
Defined Under Namespace
Modules: Completion, Embedding, Models
Class Method Summary collapse
Class Method Details
.adapt(res, type:) ⇒ LLM::Response
17 18 19 20 |
# File 'lib/llm/providers/ollama/response_adapter.rb', line 17 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.
24 25 26 27 28 29 30 31 32 |
# File 'lib/llm/providers/ollama/response_adapter.rb', line 24 def select(type) case type when :completion then LLM::Ollama::ResponseAdapter::Completion when :embedding then LLM::Ollama::ResponseAdapter::Embedding when :models then LLM::Ollama::ResponseAdapter::Models else raise ArgumentError, "Unknown response adapter type: #{type.inspect}" end end |