Files
X-Financial/server/tests/test_steward_intent_agent.py

31 lines
1.1 KiB
Python
Raw Normal View History

from app.services.steward_intent_agent import (
STEWARD_INTENT_FUNCTION_NAME,
StewardIntentAgent,
)
def test_steward_intent_tool_schema_supports_pending_flow_confirmation() -> None:
schema = StewardIntentAgent._build_intent_tool_schema(
["expense_type", "time_range", "location", "reason", "transport_mode"]
)
function_schema = schema["function"]
assert function_schema["name"] == STEWARD_INTENT_FUNCTION_NAME
properties = function_schema["parameters"]["properties"]
pending_schema = properties["pending_flow_confirmation"]
candidate_schema = pending_schema["properties"]["candidate_flows"]["items"]
assert "pending_flow_confirmation" in properties
assert pending_schema["properties"]["status"]["enum"] == ["none", "pending"]
assert candidate_schema["properties"]["flow_id"]["enum"] == [
"travel_application",
"travel_reimbursement",
]
assert candidate_schema["properties"]["missing_fields"]["items"]["enum"] == [
"expense_type",
"time_range",
"location",
"reason",
"transport_mode",
]