Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions ex_app/lib/agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ def call_model(
Today is {CURRENT_DATE}.
Intuit the language the user is using (there is no tool for this, you will need to guess). Reply in the language intuited. Do not output the language you intuited.
Only use tools if you cannot answer the user without them.
Always check for the mail account id before requesting a folder list.
Only use the duckduckgo_results_json tool if the user explicitly asks for a web search.
You can check which conversations exist using the list_talk_conversations tool, if a conversation cannot be found.
You can check which calendars exist using the list_calendars tool, if a calendar can not be found.
Expand Down
31 changes: 26 additions & 5 deletions ex_app/lib/all_tools/mail.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,18 +49,39 @@ def send_email(subject: str, body: str, account_id: int, from_email: str, to_ema
def get_mail_account_list():
"""
Lists all available email accounts including their account id
:param subject: The subject of the email
:param body: The body of the email
:param account_id: The id of the account to send from
:param to_emails: The emails to send
"""

return nc.ocs('GET', '/ocs/v2.php/apps/mail/account/list')


@tool
@safe_tool
def get_mail_folder_list(account_id: int):
"""
Lists all mail folders for an account. You need to get the correct account id matching the request first before using this tool.
:param account_id: The id of the account to list as integer, obtainable via get_mail_account_list
"""

return nc.ocs('GET', '/ocs/v2.php/apps/mail/mailbox/list', json={'accountId': account_id})


@tool
@safe_tool
def list_mails(folder_id: int, n_mails: int = 30):
"""
Lists all messages in a mailbox folder. You need to get the correct folder id matching the request first before using this tool.
:param folder_id: The id of the folder to list as integer, obtainable via get_mail_folder_list
:param n_mails: The number of mails to receive. Optional, default is 30
:return: a list of mails/messages, including timestamps
"""
return nc.ocs('GET', '/ocs/v2.php/apps/mail/mailbox/messages/list', json={'mailboxId': folder_id, 'limit': n_mails})


return [
send_email,
get_mail_account_list
get_mail_account_list,
get_mail_folder_list,
list_mails,
]

def get_category_name():
Expand Down
Loading