Class: Langchain::Assistant::LLM::Adapters::Base

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

Direct Known Subclasses

Anthropic, GoogleGemini, MistralAI, Ollama, OpenAI

Instance Method Summary collapse

Instance Method Details

#build_chat_params(messages:, instructions:, tools:, tool_choice:, parallel_tool_calls:) ⇒ Hash

Build the chat parameters for the LLM

Raises:

  • (NotImplementedError)


16
17
18
19
20
21
22
23
24
# File 'lib/langchain/assistant/llm/adapters/base.rb', line 16

def build_chat_params(
  messages:,
  instructions:,
  tools:,
  tool_choice:,
  parallel_tool_calls:
)
  raise NotImplementedError, "Subclasses must implement build_chat_params"
end

#build_message(role:, content: nil, image_url: nil, tool_calls: [], tool_call_id: nil) ⇒ Messages::Base

Build a message for the LLM

Raises:

  • (NotImplementedError)


42
43
44
# File 'lib/langchain/assistant/llm/adapters/base.rb', line 42

def build_message(role:, content: nil, image_url: nil, tool_calls: [], tool_call_id: nil)
  raise NotImplementedError, "Subclasses must implement build_message"
end

#extract_tool_call_args(tool_call:) ⇒ Array

Extract the tool call information from the tool call hash

Raises:

  • (NotImplementedError)


30
31
32
# File 'lib/langchain/assistant/llm/adapters/base.rb', line 30

def extract_tool_call_args(tool_call:)
  raise NotImplementedError, "Subclasses must implement extract_tool_call_args"
end

#support_system_message?Boolean

Does this adapter accept messages with role="system"?

Raises:

  • (NotImplementedError)


49
50
51
# File 'lib/langchain/assistant/llm/adapters/base.rb', line 49

def support_system_message?
  raise NotImplementedError, "Subclasses must implement support_system_message?"
end

#tool_roleString

Role name used to return the tool output

Raises:

  • (NotImplementedError)


56
57
58
# File 'lib/langchain/assistant/llm/adapters/base.rb', line 56

def tool_role
  raise NotImplementedError, "Subclasses must implement tool_role"
end