* fix(chat): add user-local time context * fix(chat): route calendar follow-up phrasing * refactor(chat): log tool intent routing reasons * test(chat): align user time prompt shim --------- Co-authored-by: Alex Kenley <Alex.Kenley@threatvectorsecurity.com>
57 lines
2.6 KiB
Python
57 lines
2.6 KiB
Python
from src.action_intents import classify_tool_intent, message_needs_tools
|
|
|
|
|
|
def test_calendar_entry_request_promotes_to_agent():
|
|
assert message_needs_tools("Can you add an entry to my calendar?")
|
|
intent = classify_tool_intent("Can you add an entry to my calendar?")
|
|
assert intent.needs_tools
|
|
assert intent.category == "calendar"
|
|
|
|
|
|
def test_calendar_imperative_variants_promote_to_agent():
|
|
assert message_needs_tools("add lunch with Sam to my calendar tomorrow at noon")
|
|
assert message_needs_tools("schedule a call with Mina next Friday")
|
|
assert message_needs_tools("put dentist appointment on my calendar")
|
|
assert message_needs_tools("Alright. Recreate that same appointment")
|
|
assert message_needs_tools("Okay delete that doctor appointment from the calendar")
|
|
assert message_needs_tools("have another go at adding a test entry to the calendar")
|
|
assert message_needs_tools(
|
|
"Okay so you should be able to create that calendar event for tomorrow at 1:30 p.m. right for me to go to the hardware store"
|
|
)
|
|
assert message_needs_tools(
|
|
"make it an appointment at 12pm for me to visit the doctor it's tomorrow the 2nd of June 2026"
|
|
)
|
|
|
|
|
|
def test_note_todo_and_reminder_actions_promote_to_agent():
|
|
assert message_needs_tools("add milk to my todo list")
|
|
assert message_needs_tools("take a note that the server needs checking")
|
|
assert message_needs_tools("set a reminder to call Pat at 4pm")
|
|
|
|
|
|
def test_email_and_ui_actions_promote_to_agent():
|
|
assert message_needs_tools("reply to that email")
|
|
assert message_needs_tools("mark those emails as read")
|
|
assert message_needs_tools("open my calendar")
|
|
assert message_needs_tools("turn off web search")
|
|
|
|
|
|
def test_research_action_promotes_to_agent():
|
|
assert message_needs_tools("research cost effective local models")
|
|
assert message_needs_tools("can you look into GPU hosting options")
|
|
|
|
|
|
def test_explanatory_calendar_questions_stay_plain_chat():
|
|
assert not message_needs_tools("How do I add an entry to my calendar?")
|
|
assert not message_needs_tools("What about the built-in Odysseus calendar, is that linked to email?")
|
|
assert not message_needs_tools("Can you explain how calendar reminders work?")
|
|
intent = classify_tool_intent("How do I add an entry to my calendar?")
|
|
assert not intent.needs_tools
|
|
assert intent.reason == "explanatory feature question"
|
|
|
|
|
|
def test_router_reports_non_calendar_categories():
|
|
assert classify_tool_intent("reply to that email").category == "email"
|
|
assert classify_tool_intent("open my calendar").category == "ui"
|
|
assert classify_tool_intent("research cost effective local models").category == "research"
|