This commit is contained in:
Brandon Hancock
2025-01-09 16:17:14 -05:00
parent 91144a692a
commit 389d5a9982
6 changed files with 595 additions and 5 deletions

View File

@@ -17,16 +17,17 @@ class InternalAgentTool(BaseAgentTool):
"role_name,should_match",
[
("Futel Official Infopoint", True), # exact match
# (' "Futel Official Infopoint" ', True), # extra quotes and spaces
# ("Futel Official Infopoint\n", True), # trailing newline
# ('"Futel Official Infopoint"', True), # embedded quotes
# (" FUTEL\nOFFICIAL INFOPOINT ", True), # multiple whitespace and newline
(' "Futel Official Infopoint" ', True), # extra quotes and spaces
("Futel Official Infopoint\n", True), # trailing newline
('"Futel Official Infopoint"', True), # embedded quotes
(" FUTEL\nOFFICIAL INFOPOINT ", True), # multiple whitespace and newline
("futel official infopoint", True), # lowercase
("FUTEL OFFICIAL INFOPOINT", True), # uppercase
("Non Existent Agent", False), # non-existent agent
(None, False), # None agent name
],
)
@pytest.mark.vcr(filter_headers=["authorization"])
def test_agent_tool_role_matching(role_name, should_match):
"""Test that agent tools can match roles regardless of case, whitespace, and special characters."""
# Create test agent
@@ -44,7 +45,6 @@ def test_agent_tool_role_matching(role_name, should_match):
# Test role matching
result = agent_tool._execute(agent_name=role_name, task="Test task", context=None)
print("TEST RESULT: ", result)
if should_match:
assert (