Class: Assistant::ConversationMemoryToolBuilder

Inherits:
Object
  • Object
show all
Defined in:
app/services/assistant/conversation_memory_tool_builder.rb

Overview

Builds RubyLLM::Tool subclasses for conversation memory.
Provides list_my_conversations and search_my_conversations tools.

Usage (via ChatToolBuilder):
tools = Assistant::ConversationMemoryToolBuilder.tools(user_id: uid, account: acct)

Class Method Summary collapse

Class Method Details

.tools(user_id:, account:) ⇒ Array<RubyLLM::Tool>

Returns list and search conversation tools.

Parameters:

  • user_id (Integer)

    the user's id

  • account (Account)

    the user's current account

Returns:

  • (Array<RubyLLM::Tool>)

    list and search conversation tools



15
16
17
18
19
20
21
22
# File 'app/services/assistant/conversation_memory_tool_builder.rb', line 15

def tools(user_id:, account:)
  return [] if user_id.blank?

  build_tools(user_id: user_id, account: )
rescue StandardError => e
  Rails.logger.warn("[ConversationMemoryToolBuilder] Failed to build tools: #{e.message}")
  []
end