Skip to content

Commit

Permalink
Removed LLM from adapter of the assistant
Browse files Browse the repository at this point in the history
  • Loading branch information
qarol committed Oct 10, 2024
1 parent 0e02530 commit c61f9c9
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 14 deletions.
2 changes: 1 addition & 1 deletion lib/langchain/assistants/assistant.rb
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,7 @@ def chat_with_llm
tools: @tools,
tool_choice: tool_choice
)
@llm_adapter.chat(**params, &@block)
@llm.chat(**params, &@block)
end

# Run the tools automatically
Expand Down
10 changes: 5 additions & 5 deletions lib/langchain/assistants/llm/adapter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ class Adapter
def self.build(llm)
case llm
when Langchain::LLM::Anthropic
LLM::Adapters::Anthropic.new(llm)
LLM::Adapters::Anthropic.new
when Langchain::LLM::GoogleGemini, Langchain::LLM::GoogleVertexAI
LLM::Adapters::GoogleGemini.new(llm)
LLM::Adapters::GoogleGemini.new
when Langchain::LLM::MistralAI
LLM::Adapters::MistralAI.new(llm)
LLM::Adapters::MistralAI.new
when Langchain::LLM::Ollama
LLM::Adapters::Ollama.new(llm)
LLM::Adapters::Ollama.new
when Langchain::LLM::OpenAI
LLM::Adapters::OpenAI.new(llm)
LLM::Adapters::OpenAI.new
else
raise ArgumentError, "Unsupported LLM type: #{llm.class}"
end
Expand Down
8 changes: 0 additions & 8 deletions lib/langchain/assistants/llm/adapters/_base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,6 @@ class Assistant
module LLM
module Adapters
class Base
def initialize(llm)
@llm = llm
end

def build_chat_params(tools:, instructions:, messages:, tool_choice:)
raise NotImplementedError, "Subclasses must implement build_chat_params"
end
Expand All @@ -26,10 +22,6 @@ def tool_role
def support_system_message?
raise NotImplementedError, "Subclasses must implement set_instructions"
end

def chat(*args, **kwargs, &block)
@llm.chat(*args, **kwargs, &block)
end
end
end
end
Expand Down

0 comments on commit c61f9c9

Please sign in to comment.