human handoffs

This commit is contained in:
debu-2 2026-10-06 01:51:23 +05:30
parent 79188e0f59
commit 36a55930f9
35 changed files with 4039 additions and 139 deletions

View file

@ -0,0 +1,33 @@
from app.services.handoff_evaluator import evaluate_handoff
def test_handoff_requires_all_selected_filters():
email = {
"subject": "Payment approval required",
"snippet": "Please approve this invoice payment today.",
"body_text": "We need your approval for payment of $4,500.",
}
result = evaluate_handoff(
email=email,
labels=["Important", "Finance"],
email_types=["transactional"],
instructions="Forward when approval is required.",
)
assert result["would_handoff"] is True
assert result["label_matched"] is True
assert result["type_matched"] is True
def test_handoff_does_not_match_unrelated_instruction():
email = {
"subject": "Team lunch",
"snippet": "Where should we eat tomorrow?",
"body_text": "Let me know your preference.",
}
result = evaluate_handoff(
email=email,
labels=[],
email_types=[],
instructions="Forward when a refund requires approval.",
)
assert result["would_handoff"] is False