human handoffs
This commit is contained in:
parent
79188e0f59
commit
36a55930f9
35 changed files with 4039 additions and 139 deletions
33
backend/tests/test_handoff_evaluator.py
Normal file
33
backend/tests/test_handoff_evaluator.py
Normal 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
|
||||
Loading…
Add table
Add a link
Reference in a new issue