Class: Langchain::Assistant::LLM::Adapter

Inherits:
Object
  • Object
show all
Defined in:
lib/langchain/assistant/llm/adapter.rb

Overview

TODO: Fix the message truncation when context window is exceeded

Class Method Summary collapse

Class Method Details

.build(llm) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/langchain/assistant/llm/adapter.rb', line 8

def self.build(llm)
  case llm
  when Langchain::LLM::Anthropic
    LLM::Adapters::Anthropic.new
  when Langchain::LLM::GoogleGemini, Langchain::LLM::GoogleVertexAI
    LLM::Adapters::GoogleGemini.new
  when Langchain::LLM::MistralAI
    LLM::Adapters::MistralAI.new
  when Langchain::LLM::Ollama
    LLM::Adapters::Ollama.new
  when Langchain::LLM::OpenAI
    LLM::Adapters::OpenAI.new
  else
    raise ArgumentError, "Unsupported LLM type: #{llm.class}"
  end
end