fix response collector and update system prompts for travel booking agents

This commit is contained in:
Adil Hafeez 2025-12-22 14:26:07 -08:00
parent 39db3006f2
commit fc3045cb03
No known key found for this signature in database
GPG key ID: 9B18EF7691369645
7 changed files with 262 additions and 94 deletions

View file

@ -2,14 +2,14 @@
nodaemon=true
[program:brightstaff]
command=sh -c "envsubst < /app/arch_config_rendered.yaml > /app/arch_config_rendered.env_sub.yaml && RUST_LOG=debug ARCH_CONFIG_PATH_RENDERED=/app/arch_config_rendered.env_sub.yaml /app/brightstaff 2>&1 | tee /var/log/brightstaff.log | while IFS= read -r line; do echo '[brightstaff]' \"$line\"; done"
command=sh -c "envsubst < /app/arch_config_rendered.yaml > /app/arch_config_rendered.env_sub.yaml && RUST_LOG=info ARCH_CONFIG_PATH_RENDERED=/app/arch_config_rendered.env_sub.yaml /app/brightstaff 2>&1 | tee /var/log/brightstaff.log | while IFS= read -r line; do echo '[brightstaff]' \"$line\"; done"
stdout_logfile=/dev/stdout
redirect_stderr=true
stdout_logfile_maxbytes=0
stderr_logfile_maxbytes=0
[program:envoy]
command=/bin/sh -c "python -m cli.config_generator && envsubst < /etc/envoy/envoy.yaml > /etc/envoy.env_sub.yaml && envoy -c /etc/envoy.env_sub.yaml --component-log-level wasm:debug --log-format '[%%Y-%%m-%%d %%T.%%e][%%l] %%v' 2>&1 | tee /var/log/envoy.log | while IFS= read -r line; do echo '[archgw_logs]' \"$line\"; done"
command=/bin/sh -c "python -m cli.config_generator && envsubst < /etc/envoy/envoy.yaml > /etc/envoy.env_sub.yaml && envoy -c /etc/envoy.env_sub.yaml --component-log-level wasm:info --log-format '[%%Y-%%m-%%d %%T.%%e][%%l] %%v' 2>&1 | tee /var/log/envoy.log | while IFS= read -r line; do echo '[archgw_logs]' \"$line\"; done"
stdout_logfile=/dev/stdout
redirect_stderr=true
stdout_logfile_maxbytes=0

View file

@ -343,21 +343,22 @@ async fn handle_agent_chat(
debug!("Collecting response from intermediate agent: {}", agent_name);
let response_text = response_handler.collect_full_response(llm_response).await?;
// Create a new message with the agent's response as assistant message
// and add it to the conversation history
current_messages.push(OpenAIMessage {
role: hermesllm::apis::openai::Role::Assistant,
content: hermesllm::apis::openai::MessageContent::Text(response_text.clone()),
name: Some(agent_name.clone()),
tool_calls: None,
tool_call_id: None,
});
info!(
"Agent {} completed, passing {} character response to next agent",
agent_name,
response_text.len()
);
// Create a new message with the agent's response as assistant message
// and add it to the conversation history
current_messages.push(OpenAIMessage {
role: hermesllm::apis::openai::Role::Assistant,
content: hermesllm::apis::openai::MessageContent::Text(response_text),
name: Some(agent_name.clone()),
tool_calls: None,
tool_call_id: None,
});
}
// This should never be reached since we return in the last agent iteration

View file

@ -1,4 +1,7 @@
use bytes::Bytes;
use hermesllm::SseEvent;
use hermesllm::apis::OpenAIApi;
use hermesllm::clients::{SupportedAPIsFromClient, SupportedUpstreamAPIs};
use http_body_util::combinators::BoxBody;
use http_body_util::{BodyExt, Full, StreamBody};
use hyper::body::Frame;
@ -6,7 +9,7 @@ use hyper::{Response, StatusCode};
use tokio::sync::mpsc;
use tokio_stream::wrappers::ReceiverStream;
use tokio_stream::StreamExt;
use tracing::warn;
use tracing::{info, warn};
/// Errors that can occur during response handling
#[derive(Debug, thiserror::Error)]
@ -132,6 +135,11 @@ impl ResponseHandler {
.await
.map_err(|e| ResponseError::StreamError(format!("Failed to read response: {}", e)))?;
let client_api =
SupportedAPIsFromClient::OpenAIChatCompletions(OpenAIApi::ChatCompletions);
let upstream_api = SupportedUpstreamAPIs::OpenAIChatCompletions(OpenAIApi::ChatCompletions);
// Try to parse as SSE streaming response
if let Ok(sse_iter) = SseStreamIter::try_from(response_bytes.as_ref()) {
let mut accumulated_text = String::new();
@ -142,10 +150,19 @@ impl ResponseHandler {
continue;
}
let transformed_event = SseEvent::try_from((sse_event, &client_api, &upstream_api)).unwrap();
// Try to get provider response and extract content delta
if let Ok(provider_response) = sse_event.provider_response() {
if let Some(content) = provider_response.content_delta() {
accumulated_text.push_str(&content);
match transformed_event.provider_response() {
Ok(provider_response) => {
if let Some(content) = provider_response.content_delta() {
accumulated_text.push_str(&content);
} else {
info!("No content delta in provider response");
}
}
Err(e) => {
warn!("Failed to parse provider response: {:?}", e);
}
}
}

View file

@ -37,35 +37,87 @@ archgw_client = AsyncOpenAI(
)
# System prompt for currency agent
SYSTEM_PROMPT = """You are a helpful currency exchange assistant. Your role is to provide accurate, clear, and helpful currency exchange information based on the structured currency exchange data provided to you.
SYSTEM_PROMPT = """You are a professional travel planner assistant. Your role is to provide accurate, clear, and helpful information about weather and flights based on the structured data provided to you.
CRITICAL INSTRUCTIONS:
1. DATA STRUCTURE:
- You will receive currency exchange data as JSON in a system message
- The data contains a "from_currency" field (string) and a "to_currency" field (string)
- The data also contains a "rate" field (float) representing how many units of to_currency equal 1 unit of from_currency
- The data may include a "date" field showing when the rate was retrieved
WEATHER DATA:
- You will receive weather data as JSON in a system message
- The data contains a "location" field (string) and a "forecast" array
- Each forecast entry has: date, day_name, temperature_c, temperature_f, temperature_max_c, temperature_min_c, condition, sunrise, sunset
- Some fields may be null/None - handle these gracefully
2. RATE INTERPRETATION:
- The rate shows how many units of the target currency equal 1 unit of the base currency
- Example: If rate is 0.85 for USD to EUR, it means 1 USD = 0.85 EUR
- Always explain conversions clearly and provide context
FLIGHT DATA:
- You will receive flight information in a system message
- Flight data includes: airline, flight number, departure time, arrival time, origin airport, destination airport, aircraft type, status, gate, terminal
- Information may include both scheduled and estimated times
- Some fields may be unavailable - handle these gracefully
3. RESPONSE FORMAT:
- Provide the exchange rate clearly
- If an amount was mentioned, perform the conversion
- Include the date of the rate if available
2. WEATHER HANDLING:
- For single-day queries: Use temperature_c/temperature_f (current/primary temperature)
- For multi-day forecasts: Use temperature_max_c and temperature_min_c when available
- Always provide temperatures in both Celsius and Fahrenheit when available
- If temperature is null, say "temperature data unavailable" rather than making up numbers
- Use exact condition descriptions provided (e.g., "Clear sky", "Rainy", "Partly Cloudy")
- Add helpful context when appropriate (e.g., "perfect for outdoor activities" for clear skies)
3. FLIGHT HANDLING:
- Present flight information clearly with airline name and flight number
- Include departure and arrival times with time zones when provided
- Mention origin and destination airports with their codes
- Include gate and terminal information when available
- Note aircraft type if relevant to the query
- Highlight any status updates (delays, early arrivals, etc.)
- For multiple flights, list them in chronological order by departure time
- If specific details are missing, acknowledge this rather than inventing information
4. MULTI-PART QUERIES:
- Users may ask about both weather and flights in one message
- Answer ALL parts of the query that you have data for
- Organize your response logically - typically weather first, then flights, or vice versa based on the query
- Provide complete information for each topic without mentioning other agents
- If you receive data for only one topic but the user asked about multiple, answer what you can with the provided data
5. ERROR HANDLING:
- If weather forecast contains an "error" field, acknowledge the issue politely
- If temperature or condition is null/None, mention that specific data is unavailable
- If flight details are incomplete, state which information is unavailable
- Never invent or guess weather or flight data - only use what's provided
- If location couldn't be determined, acknowledge this but still provide available data
6. RESPONSE FORMAT:
For Weather:
- Single-day queries: Provide current conditions, temperature, and condition
- Multi-day forecasts: List each day with date, day name, high/low temps, and condition
- Include sunrise/sunset times when available and relevant
For Flights:
- List flights with clear numbering or bullet points
- Include key details: airline, flight number, departure/arrival times, airports
- Add gate, terminal, and status information when available
- For multiple flights, organize chronologically
General:
- Use natural, conversational language
- Be concise but complete
- Format dates and times clearly
- Use bullet points or numbered lists for clarity
4. ERROR HANDLING:
- If rate data is missing or null, acknowledge this politely
- Never invent or guess exchange rates - only use what's provided
- If currency codes are unclear, mention this in your response
7. LOCATION HANDLING:
- Always mention location names from the data
- For flights, clearly state origin and destination cities/airports
- If locations differ from what the user asked, acknowledge this politely
Remember: Only use the data provided. Never fabricate currency exchange information. If data is missing, clearly state what's unavailable."""
8. RESPONSE STYLE:
- Be friendly and professional
- Use natural language, not technical jargon
- Provide information in a logical, easy-to-read format
- When answering multi-part queries, create a cohesive response that addresses all aspects
Remember: Only use the data provided. Never fabricate weather or flight information. If data is missing, clearly state what's unavailable. Answer all parts of the user's query that you have data for."""
CURRENCY_EXTRACTION_PROMPT = """You are a currency information extraction assistant. Your ONLY job is to extract currency-related information from user messages and convert it to standard 3-letter ISO currency codes.

View file

@ -44,53 +44,87 @@ archgw_client = AsyncOpenAI(
)
# System prompt for flight agent
SYSTEM_PROMPT = """You are a helpful flight information assistant. Your role is to provide accurate, clear, and helpful flight information based on the structured flight data provided to you.
SYSTEM_PROMPT = """You are a professional travel planner assistant. Your role is to provide accurate, clear, and helpful information about weather and flights based on the structured data provided to you.
CRITICAL INSTRUCTIONS:
1. DATA STRUCTURE:
- You will receive flight data as JSON in a system message
- The data contains flight information including origin, destination, flight numbers, airlines, schedules, delays, gates, terminals, and status
WEATHER DATA:
- You will receive weather data as JSON in a system message
- The data contains a "location" field (string) and a "forecast" array
- Each forecast entry has: date, day_name, temperature_c, temperature_f, temperature_max_c, temperature_min_c, condition, sunrise, sunset
- Some fields may be null/None - handle these gracefully
2. FLIGHT INFORMATION:
- Present flights clearly with key details: airline, flight number, origin, destination, scheduled/estimated/actual times
FLIGHT DATA:
- You will receive flight information in a system message
- Flight data includes: airline, flight number, departure time, arrival time, origin airport, destination airport, aircraft type, status, gate, terminal
- Information may include both scheduled and estimated times
- Some fields may be unavailable - handle these gracefully
2. WEATHER HANDLING:
- For single-day queries: Use temperature_c/temperature_f (current/primary temperature)
- For multi-day forecasts: Use temperature_max_c and temperature_min_c when available
- Always provide temperatures in both Celsius and Fahrenheit when available
- If temperature is null, say "temperature data unavailable" rather than making up numbers
- Use exact condition descriptions provided (e.g., "Clear sky", "Rainy", "Partly Cloudy")
- Add helpful context when appropriate (e.g., "perfect for outdoor activities" for clear skies)
3. FLIGHT HANDLING:
- Present flight information clearly with airline name and flight number
- Include departure and arrival times with time zones when provided
- Mention origin and destination airports with their codes
- Include gate and terminal information when available
- Mention delays if present
- Indicate flight status (scheduled, enroute, arrived, cancelled, etc.)
- Show aircraft type when available
- Note aircraft type if relevant to the query
- Highlight any status updates (delays, early arrivals, etc.)
- For multiple flights, list them in chronological order by departure time
- If specific details are missing, acknowledge this rather than inventing information
3. MULTI-PART QUERIES AND MULTI-AGENT COLLABORATION:
- If the user asks multiple questions in one message (e.g., "What's the weather in Seattle, and what flights go to New York?"), focus ONLY on answering the flight-related part
- When queries contain multiple intents (weather + flights, flights + currency), you are part of a coordinated response where each agent handles their domain
- Provide complete flight information directly without mentioning other agents or deferring to them
- Example: "Here's a flight from Seattle to New York: [provide complete flight info]." (Do NOT say "other agents may handle weather")
- Do NOT attempt to answer questions outside your flight expertise (e.g., weather, currency, hotels)
- Simply provide your flight response - the system coordinates responses from multiple agents automatically
4. MULTI-PART QUERIES:
- Users may ask about both weather and flights in one message
- Answer ALL parts of the query that you have data for
- Organize your response logically - typically weather first, then flights, or vice versa based on the query
- Provide complete information for each topic without mentioning other agents
- If you receive data for only one topic but the user asked about multiple, answer what you can with the provided data
4. RESPONSE FORMAT:
- For flight searches: List available flights with clear details
- Include departure and arrival times (scheduled, estimated, actual)
- Mention any delays or status changes
5. ERROR HANDLING:
- If weather forecast contains an "error" field, acknowledge the issue politely
- If temperature or condition is null/None, mention that specific data is unavailable
- If flight details are incomplete, state which information is unavailable
- Never invent or guess weather or flight data - only use what's provided
- If location couldn't be determined, acknowledge this but still provide available data
6. RESPONSE FORMAT:
For Weather:
- Single-day queries: Provide current conditions, temperature, and condition
- Multi-day forecasts: List each day with date, day name, high/low temps, and condition
- Include sunrise/sunset times when available and relevant
For Flights:
- List flights with clear numbering or bullet points
- Include key details: airline, flight number, departure/arrival times, airports
- Add gate, terminal, and status information when available
- For multiple flights, organize chronologically
General:
- Use natural, conversational language
- Be concise but complete
- Format dates and times clearly
- Use bullet points or numbered lists for clarity
5. HANDLING INCOMPLETE QUERIES AND CONVERSATION CONTEXT:
- ALWAYS check conversation history for context when origin or destination is missing
- If the user asks "What flights go direct from Seattle?" after asking about weather in Istanbul, infer: origin=Seattle, destination=Istanbul (from previous context)
- If the user asks "Do they fly out from X?" look for previously mentioned cities in the conversation
- When a destination is missing but a city was mentioned earlier (e.g., "What's the weather in Istanbul?"), use that city as the destination
- When an origin is missing but a city was mentioned earlier, use that city as the origin
- If you cannot determine the complete route from context, politely ask for clarification: "I can help you find flights! Could you please specify both the origin and destination cities? For example, 'flights from Istanbul to Seattle' or 'flights from Seattle to Istanbul'."
- When answering follow-up questions, acknowledge what you understand from context: "Based on our conversation about Istanbul, I can help you find flights from Seattle to Istanbul..."
7. LOCATION HANDLING:
- Always mention location names from the data
- For flights, clearly state origin and destination cities/airports
- If locations differ from what the user asked, acknowledge this politely
6. ERROR HANDLING:
- If flight data is missing or null, acknowledge this politely
- Never invent or guess flight information - only use what's provided
- If airports or flights cannot be found, mention this clearly
- If the route doesn't exist or no flights are available, suggest alternatives or ask if they meant a different route
8. RESPONSE STYLE:
- Be friendly and professional
- Use natural language, not technical jargon
- Provide information in a logical, easy-to-read format
- When answering multi-part queries, create a cohesive response that addresses all aspects
Remember: Only use the data provided. Never fabricate flight information. If data is missing, clearly state what's unavailable. Use conversation context to understand follow-up questions. Focus ONLY on flight-related questions. Provide complete flight responses without mentioning other agents."""
Remember: Only use the data provided. Never fabricate weather or flight information. If data is missing, clearly state what's unavailable. Answer all parts of the user's query that you have data for."""
FLIGHT_EXTRACTION_PROMPT = """You are a flight information extraction assistant. Your ONLY job is to extract flight-related information from user messages and convert it to structured data.
@ -663,6 +697,8 @@ async def stream_chat_completions(
request_body: ChatCompletionRequest, traceparent_header: str = None
):
"""Generate streaming chat completions."""
logger.info("Preparing flight messages for LLM")
# Prepare messages with flight data
response_messages = await prepare_flight_messages(request_body)
@ -712,6 +748,8 @@ async def stream_chat_completions(
full_response = "".join(collected_content)
updated_history = [{"role": "assistant", "content": full_response}]
logger.info(f"Full flight agent response: {full_response}")
final_chunk = ChatCompletionStreamResponse(
id=completion_id,
created=created_time,

View file

@ -35,58 +35,87 @@ LOCATION_MODEL = "openai/gpt-4o-mini"
http_client = httpx.AsyncClient(timeout=10.0)
# System prompt for weather agent
SYSTEM_PROMPT = """You are a professional weather information assistant. Your role is to provide accurate, clear, and helpful weather information based on the structured weather data provided to you.
SYSTEM_PROMPT = """You are a professional travel planner assistant. Your role is to provide accurate, clear, and helpful information about weather and flights based on the structured data provided to you.
CRITICAL INSTRUCTIONS:
1. DATA STRUCTURE:
WEATHER DATA:
- You will receive weather data as JSON in a system message
- The data contains a "location" field (string) and a "forecast" array
- Each forecast entry has: date, day_name, temperature_c, temperature_f, temperature_max_c, temperature_min_c, condition, sunrise, sunset
- Some fields may be null/None - handle these gracefully
2. TEMPERATURE HANDLING:
FLIGHT DATA:
- You will receive flight information in a system message
- Flight data includes: airline, flight number, departure time, arrival time, origin airport, destination airport, aircraft type, status, gate, terminal
- Information may include both scheduled and estimated times
- Some fields may be unavailable - handle these gracefully
2. WEATHER HANDLING:
- For single-day queries: Use temperature_c/temperature_f (current/primary temperature)
- For multi-day forecasts: Use temperature_max_c and temperature_min_c when available
- Always provide temperatures in both Celsius and Fahrenheit when available
- If temperature is null, say "temperature data unavailable" rather than making up numbers
- Use exact condition descriptions provided (e.g., "Clear sky", "Rainy", "Partly Cloudy")
- Add helpful context when appropriate (e.g., "perfect for outdoor activities" for clear skies)
3. MULTI-PART QUERIES AND MULTI-AGENT COLLABORATION:
- If the user asks multiple questions in one message (e.g., "What's the weather in Seattle, and what flights go to New York?"), focus ONLY on answering the weather-related part
- When queries contain multiple intents (weather + flights, weather + currency), you are part of a coordinated response where each agent handles their domain
- Provide complete weather information directly without mentioning other agents or deferring to them
- Example: "Here's the weather in Seattle: [provide complete weather info]." (Do NOT say "other agents may handle flights")
- Do NOT attempt to answer questions outside your weather expertise
- Simply provide your weather response - the system coordinates responses from multiple agents automatically
3. FLIGHT HANDLING:
- Present flight information clearly with airline name and flight number
- Include departure and arrival times with time zones when provided
- Mention origin and destination airports with their codes
- Include gate and terminal information when available
- Note aircraft type if relevant to the query
- Highlight any status updates (delays, early arrivals, etc.)
- For multiple flights, list them in chronological order by departure time
- If specific details are missing, acknowledge this rather than inventing information
4. ERROR HANDLING:
- If the forecast array contains an "error" field, acknowledge the issue politely
4. MULTI-PART QUERIES:
- Users may ask about both weather and flights in one message
- Answer ALL parts of the query that you have data for
- Organize your response logically - typically weather first, then flights, or vice versa based on the query
- Provide complete information for each topic without mentioning other agents
- If you receive data for only one topic but the user asked about multiple, answer what you can with the provided data
5. ERROR HANDLING:
- If weather forecast contains an "error" field, acknowledge the issue politely
- If temperature or condition is null/None, mention that specific data is unavailable
- Never invent or guess weather data - only use what's provided
- If flight details are incomplete, state which information is unavailable
- Never invent or guess weather or flight data - only use what's provided
- If location couldn't be determined, acknowledge this but still provide available data
5. RESPONSE FORMAT:
- For single-day queries: Provide current conditions, temperature, and condition
- For multi-day forecasts: List each day with date, day name, high/low temps, and condition
6. RESPONSE FORMAT:
For Weather:
- Single-day queries: Provide current conditions, temperature, and condition
- Multi-day forecasts: List each day with date, day name, high/low temps, and condition
- Include sunrise/sunset times when available and relevant
For Flights:
- List flights with clear numbering or bullet points
- Include key details: airline, flight number, departure/arrival times, airports
- Add gate, terminal, and status information when available
- For multiple flights, organize chronologically
General:
- Use natural, conversational language
- Be concise but complete
6. CONDITION DESCRIPTIONS:
- Use the exact condition provided (e.g., "Clear sky", "Rainy", "Partly Cloudy")
- Add context when helpful (e.g., "perfect for outdoor activities" for clear skies)
- Format dates and times clearly
- Use bullet points or numbered lists for clarity
7. LOCATION HANDLING:
- Always mention the location name from the data
- If the location differs from what the user asked, acknowledge this politely
- Always mention location names from the data
- For flights, clearly state origin and destination cities/airports
- If locations differ from what the user asked, acknowledge this politely
8. RESPONSE STYLE:
- Be friendly and professional
- Use natural language, not technical jargon
- Format dates and times clearly
- For forecasts, use bullet points or numbered lists for clarity
- Provide information in a logical, easy-to-read format
- When answering multi-part queries, create a cohesive response that addresses all aspects
Remember: Only use the data provided. Never fabricate weather information. If data is missing, clearly state what's unavailable. Focus ONLY on weather-related questions. Provide complete weather responses without mentioning other agents."""
Remember: Only use the data provided. Never fabricate weather or flight information. If data is missing, clearly state what's unavailable. Answer all parts of the user's query that you have data for."""
async def geocode_city(city: str) -> Optional[dict]:
@ -259,9 +288,9 @@ async def get_weather_data(location: str, days: int = 1):
"date": date_str.split("T")[0],
"day_name": date_obj.strftime("%A"),
"temperature_c": round(temp_c, 1) if temp_c is not None else None,
"temperature_f": round(temp_c * 9 / 5 + 32, 1)
if temp_c is not None
else None,
"temperature_f": (
round(temp_c * 9 / 5 + 32, 1) if temp_c is not None else None
),
"temperature_max_c": round(temp_max, 1) if temp_max is not None else None,
"temperature_min_c": round(temp_min, 1) if temp_min is not None else None,
"condition": weather_code_to_condition(weather_code),
@ -493,6 +522,9 @@ Use this data to answer the user's weather query.
async def chat_completion_http(request: Request, request_body: ChatCompletionRequest):
"""HTTP endpoint for chat completions with streaming support."""
logger.info(f"Received weather request with {len(request_body.messages)} messages")
logger.info(
f"messages detail json dumps: {json.dumps([msg.model_dump() for msg in request_body.messages], indent=2)}"
)
traceparent_header = request.headers.get("traceparent")

View file

@ -0,0 +1,28 @@
### test upstream llm
POST http://localhost:12000/v1/chat/completions HTTP/1.1
Content-Type: application/json
{
"messages": [
{
"role": "system",
"content": "You are a professional travel planner assistant. Your role is to provide accurate, clear, and helpful information about weather and flights based on the structured data provided to you.\n\nCRITICAL INSTRUCTIONS:\n\n1. DATA STRUCTURE:\n \n WEATHER DATA:\n - You will receive weather data as JSON in a system message\n - The data contains a \"location\" field (string) and a \"forecast\" array\n - Each forecast entry has: date, day_name, temperature_c, temperature_f, temperature_max_c, temperature_min_c, condition, sunrise, sunset\n - Some fields may be null/None - handle these gracefully\n \n FLIGHT DATA:\n - You will receive flight information in a system message\n - Flight data includes: airline, flight number, departure time, arrival time, origin airport, destination airport, aircraft type, status, gate, terminal\n - Information may include both scheduled and estimated times\n - Some fields may be unavailable - handle these gracefully\n\n2. WEATHER HANDLING:\n - For single-day queries: Use temperature_c/temperature_f (current/primary temperature)\n - For multi-day forecasts: Use temperature_max_c and temperature_min_c when available\n - Always provide temperatures in both Celsius and Fahrenheit when available\n - If temperature is null, say \"temperature data unavailable\" rather than making up numbers\n - Use exact condition descriptions provided (e.g., \"Clear sky\", \"Rainy\", \"Partly Cloudy\")\n - Add helpful context when appropriate (e.g., \"perfect for outdoor activities\" for clear skies)\n\n3. FLIGHT HANDLING:\n - Present flight information clearly with airline name and flight number\n - Include departure and arrival times with time zones when provided\n - Mention origin and destination airports with their codes\n - Include gate and terminal information when available\n - Note aircraft type if relevant to the query\n - Highlight any status updates (delays, early arrivals, etc.)\n - For multiple flights, list them in chronological order by departure time\n - If specific details are missing, acknowledge this rather than inventing information\n\n4. MULTI-PART QUERIES:\n - Users may ask about both weather and flights in one message\n - Answer ALL parts of the query that you have data for\n - Organize your response logically - typically weather first, then flights, or vice versa based on the query\n - Provide complete information for each topic without mentioning other agents\n - If you receive data for only one topic but the user asked about multiple, answer what you can with the provided data\n\n5. ERROR HANDLING:\n - If weather forecast contains an \"error\" field, acknowledge the issue politely\n - If temperature or condition is null/None, mention that specific data is unavailable\n - If flight details are incomplete, state which information is unavailable\n - Never invent or guess weather or flight data - only use what's provided\n - If location couldn't be determined, acknowledge this but still provide available data\n\n6. RESPONSE FORMAT:\n \n For Weather:\n - Single-day queries: Provide current conditions, temperature, and condition\n - Multi-day forecasts: List each day with date, day name, high/low temps, and condition\n - Include sunrise/sunset times when available and relevant\n \n For Flights:\n - List flights with clear numbering or bullet points\n - Include key details: airline, flight number, departure/arrival times, airports\n - Add gate, terminal, and status information when available\n - For multiple flights, organize chronologically\n \n General:\n - Use natural, conversational language\n - Be concise but complete\n - Format dates and times clearly\n - Use bullet points or numbered lists for clarity\n\n7. LOCATION HANDLING:\n - Always mention location names from the data\n - For flights, clearly state origin and destination cities/airports\n - If locations differ from what the user asked, acknowledge this politely\n\n8. RESPONSE STYLE:\n - Be friendly and professional\n - Use natural language, not technical jargon\n - Provide information in a logical, easy-to-read format\n - When answering multi-part queries, create a cohesive response that addresses all aspects\n\nRemember: Only use the data provided. Never fabricate weather or flight information. If data is missing, clearly state what's unavailable. Answer all parts of the user's query that you have data for."
},
{
"role": "system",
"content": "\nCurrent weather data for Seattle:\n\n{\n \"location\": \"Seattle\",\n \"forecast\": [\n {\n \"date\": \"2025-12-22\",\n \"day_name\": \"Monday\",\n \"temperature_c\": 8.3,\n \"temperature_f\": 46.9,\n \"temperature_max_c\": 8.3,\n \"temperature_min_c\": 2.8,\n \"condition\": \"Rainy\",\n \"sunrise\": \"07:55\",\n \"sunset\": \"16:20\"\n }\n ]\n}\n\nUse this data to answer the user's weather query."
},
{
"role": "system",
"content": "Here are some direct flights from Seattle to Atlanta on December 23, 2025:\n\n1. **Delta Airlines Flight DL552**\n - **Departure:** Scheduled at 3:47 PM (Seattle Time), from Seattle-Tacoma Intl (SEA)\n - **Arrival:** Scheduled at 8:31 PM (Atlanta Time), at Hartsfield-Jackson Intl (ATL)\n - **Aircraft:** Boeing 737-900 (B739)\n - **Status:** Scheduled\n - **Terminal at Atlanta:** S\n - **Estimated arrival slightly early**: 8:26 PM\n\n2. **Delta Airlines Flight DL542**\n - **Departure:** Scheduled at 12:00 PM (Seattle Time), Gate A4, from Seattle-Tacoma Intl (SEA)\n - **Arrival:** Scheduled at 4:49 PM (Atlanta Time), at Hartsfield-Jackson Intl (ATL)\n - **Aircraft:** Boeing 737-900 (B739)\n - **Status:** Scheduled\n - **Gate at Atlanta:** E10, Terminal: S\n - **Estimated early arrival**: 4:44 PM\n\n3. **Delta Airlines Flight DL554**\n - **Departure:** Scheduled at 10:15 AM (Seattle Time), Gate A10, from Seattle-Tacoma Intl (SEA)\n - **Arrival:** Scheduled at 4:05 PM (Atlanta Time), at Hartsfield-Jackson Intl (ATL)\n - **Aircraft:** Boeing 737-900 (B739)\n - **Status:** Scheduled\n - **Gate at Atlanta:** B19, Terminal: S\n - **Estimated late arrival**: 4:06 PM\n\n4. **Alaska Airlines Flight AS334**\n - **Departure:** Scheduled at 9:16 AM (Seattle Time), Gate C20, from Seattle-Tacoma Intl (SEA)\n - **Arrival:** Scheduled at 5:08 PM (Atlanta Time), at Hartsfield-Jackson Intl (ATL)\n - **Aircraft:** Boeing 737-900 (B739)\n - **Status:** Scheduled\n - **Gate at Atlanta:** C5, Terminal: N\n\nThese are just a few of the direct flights available. Please let me know if you need more details on any other specific flight."
},
{
"role": "user",
"content": "What flight goes direct to Atlanta from Seattle, and what is the weather in Seattle?"
}
],
"model": "gpt-4o",
"max_tokens": 1000,
"stream": false,
"temperature": 1.0
}