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/models.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, Models, WebSearch
Class Method Summary collapse
Class Method Details
.adapt(res, type:) ⇒ LLM::Response
19 20 21 22 |
# File 'lib/llm/providers/anthropic/response_adapter.rb', line 19 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.
26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/llm/providers/anthropic/response_adapter.rb', line 26 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 :models then LLM::Anthropic::ResponseAdapter::Models when :web_search then LLM::Anthropic::ResponseAdapter::WebSearch else raise ArgumentError, "Unknown response adapter type: #{type.inspect}" end end |