Class: Langchain::Assistant::LLM::Adapters::Base
- Inherits:
-
Object
- Object
- Langchain::Assistant::LLM::Adapters::Base
- Defined in:
- lib/langchain/assistant/llm/adapters/base.rb
Direct Known Subclasses
Instance Method Summary collapse
-
#build_chat_params(messages:, instructions:, tools:, tool_choice:, parallel_tool_calls:) ⇒ Hash
Build the chat parameters for the LLM.
-
#build_message(role:, content: nil, image_url: nil, tool_calls: [], tool_call_id: nil) ⇒ Messages::Base
Build a message for the LLM.
-
#extract_tool_call_args(tool_call:) ⇒ Array
Extract the tool call information from the tool call hash.
-
#support_system_message? ⇒ Boolean
Does this adapter accept messages with role=“system”?.
-
#tool_role ⇒ String
Role name used to return the tool output.
Instance Method Details
#build_chat_params(messages:, instructions:, tools:, tool_choice:, parallel_tool_calls:) ⇒ Hash
Build the chat parameters for the LLM
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
42 43 44 |
# File 'lib/langchain/assistant/llm/adapters/base.rb', line 42 def (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
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”?
49 50 51 |
# File 'lib/langchain/assistant/llm/adapters/base.rb', line 49 def raise NotImplementedError, "Subclasses must implement support_system_message?" end |
#tool_role ⇒ String
Role name used to return the tool output
56 57 58 |
# File 'lib/langchain/assistant/llm/adapters/base.rb', line 56 def tool_role raise NotImplementedError, "Subclasses must implement tool_role" end |