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