fix: tool declaration
This commit is contained in:
@@ -1,19 +1,10 @@
|
||||
class Captain::Tools::AddLabelToConversationTool < Captain::Tools::BaseAgentTool
|
||||
def name
|
||||
'add_label_to_conversation'
|
||||
end
|
||||
description 'Add a label to a conversation'
|
||||
param :conversation_id, type: 'integer', desc: 'The ID of the conversation'
|
||||
param :label_name, type: 'string', desc: 'The name of the label to add'
|
||||
|
||||
def display_name
|
||||
'Add Label to Conversation'
|
||||
end
|
||||
|
||||
def description
|
||||
'Add a label to a conversation'
|
||||
end
|
||||
|
||||
def execute(arguments = {})
|
||||
conversation_id = arguments[:conversation_id]
|
||||
label_name = arguments[:label_name]&.strip&.downcase
|
||||
def perform(_tool_context, conversation_id:, label_name:)
|
||||
label_name = label_name&.strip&.downcase
|
||||
|
||||
return error_response('Conversation ID is required') if conversation_id.blank?
|
||||
return error_response('Label name is required') if label_name.blank?
|
||||
@@ -31,23 +22,6 @@ class Captain::Tools::AddLabelToConversationTool < Captain::Tools::BaseAgentTool
|
||||
success_response(conversation, label_name)
|
||||
end
|
||||
|
||||
def json_schema
|
||||
{
|
||||
type: 'object',
|
||||
properties: {
|
||||
conversation_id: {
|
||||
type: 'integer',
|
||||
description: 'The ID of the conversation'
|
||||
},
|
||||
label_name: {
|
||||
type: 'string',
|
||||
description: 'The name of the label to add'
|
||||
}
|
||||
},
|
||||
required: %w[conversation_id label_name]
|
||||
}
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def find_conversation(conversation_id)
|
||||
|
||||
@@ -1,18 +1,11 @@
|
||||
class Captain::Tools::SearchContactTool < Captain::Tools::BaseAgentTool
|
||||
def name
|
||||
'search_contact'
|
||||
end
|
||||
description 'Search for a contact by email, phone number, or identifier'
|
||||
param :query, type: 'string', desc: 'Email, phone number, or identifier to search for'
|
||||
|
||||
def display_name
|
||||
'Search Contact'
|
||||
end
|
||||
def perform(_tool_context, query:)
|
||||
log_tool_usage('search_contact', { query: query })
|
||||
|
||||
def description
|
||||
'Search for a contact by email, phone number, or identifier'
|
||||
end
|
||||
|
||||
def execute(arguments = {})
|
||||
query = arguments[:query]&.strip
|
||||
query = query&.strip
|
||||
return error_response('Query is required') if query.blank?
|
||||
|
||||
contact = find_contact(query)
|
||||
@@ -24,19 +17,6 @@ class Captain::Tools::SearchContactTool < Captain::Tools::BaseAgentTool
|
||||
end
|
||||
end
|
||||
|
||||
def json_schema
|
||||
{
|
||||
type: 'object',
|
||||
properties: {
|
||||
query: {
|
||||
type: 'string',
|
||||
description: 'Email, phone number, or identifier to search for'
|
||||
}
|
||||
},
|
||||
required: ['query']
|
||||
}
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def find_contact(query)
|
||||
|
||||
Reference in New Issue
Block a user