Module: LLM::Anthropic::ResponseAdapter
- Defined in:
- lib/llm/providers/anthropic/response_adapter.rb,
lib/llm/providers/anthropic/response_adapter/file.rb,
lib/llm/providers/anthropic/response_adapter/completion.rb,
lib/llm/providers/anthropic/response_adapter/enumerable.rb,
lib/llm/providers/anthropic/response_adapter/web_search.rb
Defined Under Namespace
Modules: Completion, Enumerable, File, WebSearch
Class Method Summary collapse
Class Method Details
.adapt(res, type:) ⇒ LLM::Response
18 19 20 21 |
# File 'lib/llm/providers/anthropic/response_adapter.rb', line 18 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.
25 26 27 28 29 30 31 32 33 34 |
# File 'lib/llm/providers/anthropic/response_adapter.rb', line 25 def select(type) case type when :completion then LLM::Anthropic::ResponseAdapter::Completion when :enumerable then LLM::Anthropic::ResponseAdapter::Enumerable when :file then LLM::Anthropic::ResponseAdapter::File when :web_search then LLM::Anthropic::ResponseAdapter::WebSearch else raise ArgumentError, "Unknown response adapter type: #{type.inspect}" end end |