Skip to content

Commit a02d759

Browse files
committed
Clean up instructions
1 parent f35a5a8 commit a02d759

File tree

2 files changed

+7
-15
lines changed

2 files changed

+7
-15
lines changed

src/airline_agent/backend/services/airline_chat.py

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
get_tools_in_openai_format,
4848
run_cleanlab_validation_logging_tools,
4949
)
50-
from airline_agent.constants import AGENT_BASE_INSTRUCTIONS, AGENT_MODEL, DEMO_DATETIME
50+
from airline_agent.constants import AGENT_INSTRUCTIONS, AGENT_MODEL, DEMO_DATETIME
5151
from airline_agent.tools.booking import BookingTools
5252
from airline_agent.tools.knowledge_base import KnowledgeBase
5353

@@ -57,25 +57,13 @@
5757
logger.setLevel(logging.INFO)
5858

5959

60-
def instructions() -> str:
61-
current_date_str = DEMO_DATETIME.date().isoformat()
62-
current_datetime_str = DEMO_DATETIME.strftime("%Y-%m-%d %H:%M:%S %Z")
63-
return dedent(f"""
64-
{AGENT_BASE_INSTRUCTIONS}
65-
66-
## Context:
67-
- Today's date: {current_date_str}
68-
- Current time: {current_datetime_str}
69-
""").strip()
70-
71-
7260
def create_agent(kb: KnowledgeBase, booking: BookingTools) -> Agent:
7361
"""Create the airline support agent."""
7462
model = OpenAIChatModel(model_name=AGENT_MODEL, settings=ModelSettings(temperature=0.0))
7563

7664
return Agent(
7765
model=model,
78-
instructions=instructions,
66+
instructions=AGENT_INSTRUCTIONS,
7967
tools=[
8068
kb.get_article,
8169
kb.search,

src/airline_agent/constants.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
RAG_CHUNK_OVERLAP = 200
1818
CONTEXT_RETRIEVAL_TOOLS = ["search", "get_article", "list_directory"]
1919
AGENT_MODEL = "gpt-4o"
20-
AGENT_BASE_INSTRUCTIONS = """
20+
AGENT_INSTRUCTIONS = f"""
2121
You are an AI customer support agent for Frontier Airlines. You can use tools to access to a knowledge base of articles and documents about the airline's services, policies, and procedures.
2222
2323
## You have access to the following tools:
@@ -48,6 +48,10 @@
4848
- When a booking is successfully created, provide the booking ID and confirmation details clearly.
4949
- If you book flights, provide the booking ID and summarize the flights booked and total price.
5050
- If the user asks about anything unrelated to the airline, politely inform them that you can only assist with airline-related inquiries.
51+
52+
## Context:
53+
- Today's date: {DEMO_DATETIME.date().isoformat()}
54+
- Current time: {DEMO_DATETIME.strftime("%H:%M:%S %Z")}
5155
""".strip()
5256

5357
FALLBACK_RESPONSE = "I'm sorry, but I don't have the information you're looking for. Please rephrase the question or contact Frontier Airlines customer support for further assistance."

0 commit comments

Comments
 (0)