Skip to content

Commit 9c3d1db

Browse files
Enhanced FAQ lookup tool in main.py
Added additional keywords and implemented case insensitivity to improve the tool's ability to handle a wider range of user questions.
1 parent bc71e8b commit 9c3d1db

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

examples/customer_service/main.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,21 +39,22 @@ class AirlineAgentContext(BaseModel):
3939
name_override="faq_lookup_tool", description_override="Lookup frequently asked questions."
4040
)
4141
async def faq_lookup_tool(question: str) -> str:
42-
if "bag" in question or "baggage" in question:
42+
question_lower = question.lower()
43+
if any(keyword in question_lower for keyword in ["bag", "baggage", "luggage", "carry-on","hand luggage","hand carry"]):
4344
return (
4445
"You are allowed to bring one bag on the plane. "
4546
"It must be under 50 pounds and 22 inches x 14 inches x 9 inches."
4647
)
47-
elif "seats" in question or "plane" in question:
48+
elif any(keyword in question_lower for keyword in ["seat", "seats", "seating", "plane"]):
4849
return (
4950
"There are 120 seats on the plane. "
5051
"There are 22 business class seats and 98 economy seats. "
5152
"Exit rows are rows 4 and 16. "
5253
"Rows 5-8 are Economy Plus, with extra legroom. "
5354
)
54-
elif "wifi" in question:
55+
elif any(keyword in question_lower for keyword in ["wifi", "internet", "wireless", "connectivity", "network", "online"]):
5556
return "We have free wifi on the plane, join Airline-Wifi"
56-
return "I'm sorry, I don't know the answer to that question."
57+
return "I'm sorry, I don't know the answer to that question."
5758

5859

5960
@function_tool

0 commit comments

Comments
 (0)