#![allow(dead_code)]
use schemars::JsonSchema;
use serde::{Deserialize, Serialize};
use zeph_tools::registry::{InvocationHint, ToolDef};
#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema)]
pub struct FlightSegment {
pub flight_number: String,
pub date: String,
}
#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema)]
pub struct Passenger {
pub first_name: String,
pub last_name: String,
pub dob: String,
}
#[derive(Debug, Deserialize, JsonSchema)]
pub(super) struct CalculateParams {
pub expression: String,
}
#[derive(Debug, Deserialize, JsonSchema)]
pub(super) struct CancelPendingOrderParams {
pub order_id: String,
pub reason: String,
}
#[derive(Debug, Deserialize, JsonSchema)]
pub(super) struct ExchangeDeliveredOrderItemsParams {
pub order_id: String,
pub item_ids: Vec<String>,
pub new_item_ids: Vec<String>,
pub payment_method_id: String,
}
#[derive(Debug, Deserialize, JsonSchema)]
pub(super) struct FindUserIdByEmailParams {
pub email: String,
}
#[derive(Debug, Deserialize, JsonSchema)]
pub(super) struct FindUserIdByNameZipParams {
pub first_name: String,
pub last_name: String,
pub zip: String,
}
#[derive(Debug, Deserialize, JsonSchema)]
pub(super) struct GetOrderDetailsParams {
pub order_id: String,
}
#[derive(Debug, Deserialize, JsonSchema)]
pub(super) struct GetProductDetailsParams {
pub product_id: String,
}
#[derive(Debug, Deserialize, JsonSchema)]
pub(super) struct GetItemDetailsParams {
pub item_id: String,
}
#[derive(Debug, Deserialize, JsonSchema)]
pub(super) struct GetUserDetailsParams {
pub user_id: String,
}
#[derive(Debug, Deserialize, JsonSchema)]
pub(super) struct ModifyPendingOrderAddressParams {
pub order_id: String,
pub address1: String,
pub address2: String,
pub city: String,
pub state: String,
pub zip: String,
pub country: String,
}
#[derive(Debug, Deserialize, JsonSchema)]
pub(super) struct ModifyPendingOrderItemsParams {
pub order_id: String,
pub item_ids: Vec<String>,
pub new_item_ids: Vec<String>,
pub payment_method_id: String,
}
#[derive(Debug, Deserialize, JsonSchema)]
pub(super) struct ModifyPendingOrderPaymentParams {
pub order_id: String,
pub payment_method_id: String,
}
#[derive(Debug, Deserialize, JsonSchema)]
pub(super) struct ModifyUserAddressParams {
pub user_id: String,
pub address1: String,
pub address2: String,
pub city: String,
pub state: String,
pub zip: String,
pub country: String,
}
#[derive(Debug, Deserialize, JsonSchema)]
pub(super) struct ReturnDeliveredOrderItemsParams {
pub order_id: String,
pub item_ids: Vec<String>,
pub payment_method_id: String,
}
#[derive(Debug, Deserialize, JsonSchema)]
pub(super) struct TransferToHumanAgentsParams {
pub summary: String,
}
fn empty_object_schema() -> schemars::Schema {
serde_json::from_value(serde_json::json!({"type": "object", "properties": {}}))
.expect("static schema is valid")
}
#[must_use]
#[allow(clippy::too_many_lines)]
pub fn retail_definitions() -> Vec<ToolDef> {
vec![
ToolDef {
id: "calculate".into(),
description: "Calculate the result of a mathematical expression.".into(),
schema: schemars::schema_for!(CalculateParams),
invocation: InvocationHint::ToolCall,
output_schema: None,
},
ToolDef {
id: "cancel_pending_order".into(),
description: "Cancel a pending order. Returns updated order details.".into(),
schema: schemars::schema_for!(CancelPendingOrderParams),
invocation: InvocationHint::ToolCall,
output_schema: None,
},
ToolDef {
id: "exchange_delivered_order_items".into(),
description: "Exchange items in a delivered order.".into(),
schema: schemars::schema_for!(ExchangeDeliveredOrderItemsParams),
invocation: InvocationHint::ToolCall,
output_schema: None,
},
ToolDef {
id: "find_user_id_by_email".into(),
description: "Look up a user ID by email address.".into(),
schema: schemars::schema_for!(FindUserIdByEmailParams),
invocation: InvocationHint::ToolCall,
output_schema: None,
},
ToolDef {
id: "find_user_id_by_name_zip".into(),
description: "Look up a user ID by first name, last name, and ZIP code.".into(),
schema: schemars::schema_for!(FindUserIdByNameZipParams),
invocation: InvocationHint::ToolCall,
output_schema: None,
},
ToolDef {
id: "get_order_details".into(),
description: "Get details of an order by order ID.".into(),
schema: schemars::schema_for!(GetOrderDetailsParams),
invocation: InvocationHint::ToolCall,
output_schema: None,
},
ToolDef {
id: "get_product_details".into(),
description: "Get all variants and pricing for a product.".into(),
schema: schemars::schema_for!(GetProductDetailsParams),
invocation: InvocationHint::ToolCall,
output_schema: None,
},
ToolDef {
id: "get_item_details".into(),
description: "Get details of a specific item variant.".into(),
schema: schemars::schema_for!(GetItemDetailsParams),
invocation: InvocationHint::ToolCall,
output_schema: None,
},
ToolDef {
id: "get_user_details".into(),
description: "Get details of a user by user ID.".into(),
schema: schemars::schema_for!(GetUserDetailsParams),
invocation: InvocationHint::ToolCall,
output_schema: None,
},
ToolDef {
id: "list_all_product_types".into(),
description: "List all available product type names.".into(),
schema: empty_object_schema(),
invocation: InvocationHint::ToolCall,
output_schema: None,
},
ToolDef {
id: "modify_pending_order_address".into(),
description: "Modify the shipping address of a pending order.".into(),
schema: schemars::schema_for!(ModifyPendingOrderAddressParams),
invocation: InvocationHint::ToolCall,
output_schema: None,
},
ToolDef {
id: "modify_pending_order_items".into(),
description: "Modify items in a pending order.".into(),
schema: schemars::schema_for!(ModifyPendingOrderItemsParams),
invocation: InvocationHint::ToolCall,
output_schema: None,
},
ToolDef {
id: "modify_pending_order_payment".into(),
description: "Change the payment method for a pending order.".into(),
schema: schemars::schema_for!(ModifyPendingOrderPaymentParams),
invocation: InvocationHint::ToolCall,
output_schema: None,
},
ToolDef {
id: "modify_user_address".into(),
description: "Update the address on file for a user.".into(),
schema: schemars::schema_for!(ModifyUserAddressParams),
invocation: InvocationHint::ToolCall,
output_schema: None,
},
ToolDef {
id: "return_delivered_order_items".into(),
description: "Return items from a delivered order and issue a refund.".into(),
schema: schemars::schema_for!(ReturnDeliveredOrderItemsParams),
invocation: InvocationHint::ToolCall,
output_schema: None,
},
ToolDef {
id: "transfer_to_human_agents".into(),
description: "Escalate the conversation to a human agent.".into(),
schema: schemars::schema_for!(TransferToHumanAgentsParams),
invocation: InvocationHint::ToolCall,
output_schema: None,
},
]
}
#[derive(Debug, Deserialize, JsonSchema)]
pub(super) struct BookReservationParams {
pub user_id: String,
pub origin: String,
pub destination: String,
pub flight_type: String,
pub cabin: String,
pub flights: Vec<FlightSegment>,
pub passengers: Vec<Passenger>,
pub payment_method_id: String,
pub total_baggages: u32,
pub nonfree_baggages: u32,
pub insurance: String,
}
#[derive(Debug, Deserialize, JsonSchema)]
pub(super) struct CancelReservationParams {
pub reservation_id: String,
}
#[derive(Debug, Deserialize, JsonSchema)]
pub(super) struct GetReservationDetailsParams {
pub reservation_id: String,
}
#[derive(Debug, Deserialize, JsonSchema)]
pub(super) struct GetAirlineUserDetailsParams {
pub user_id: String,
}
#[derive(Debug, Deserialize, JsonSchema)]
pub(super) struct SearchDirectFlightParams {
pub origin: String,
pub destination: String,
pub date: String,
}
#[derive(Debug, Deserialize, JsonSchema)]
pub(super) struct SearchOnestopFlightParams {
pub origin: String,
pub destination: String,
pub date: String,
}
#[derive(Debug, Deserialize, JsonSchema)]
pub(super) struct SendCertificateParams {
pub user_id: String,
pub amount: f64,
}
#[derive(Debug, Deserialize, JsonSchema)]
pub(super) struct UpdateReservationBaggagesParams {
pub reservation_id: String,
pub total_baggages: u32,
pub nonfree_baggages: u32,
pub payment_method_id: String,
}
#[derive(Debug, Deserialize, JsonSchema)]
pub(super) struct UpdateReservationFlightsParams {
pub reservation_id: String,
pub cabin: String,
pub flights: Vec<FlightSegment>,
pub payment_method_id: String,
}
#[derive(Debug, Deserialize, JsonSchema)]
pub(super) struct UpdateReservationPassengersParams {
pub reservation_id: String,
pub passengers: Vec<Passenger>,
}
#[derive(Debug, Deserialize, JsonSchema)]
pub(super) struct GetFlightStatusParams {
pub flight_number: String,
pub date: String,
}
#[must_use]
pub fn airline_definitions() -> Vec<ToolDef> {
vec![
ToolDef {
id: "book_reservation".into(),
description: "Book a new flight reservation for a user.".into(),
schema: schemars::schema_for!(BookReservationParams),
invocation: InvocationHint::ToolCall,
output_schema: None,
},
ToolDef {
id: "calculate".into(),
description: "Calculate the result of a mathematical expression.".into(),
schema: schemars::schema_for!(CalculateParams),
invocation: InvocationHint::ToolCall,
output_schema: None,
},
ToolDef {
id: "cancel_reservation".into(),
description: "Cancel an existing flight reservation and process refund.".into(),
schema: schemars::schema_for!(CancelReservationParams),
invocation: InvocationHint::ToolCall,
output_schema: None,
},
ToolDef {
id: "get_reservation_details".into(),
description: "Get details of a reservation by reservation ID.".into(),
schema: schemars::schema_for!(GetReservationDetailsParams),
invocation: InvocationHint::ToolCall,
output_schema: None,
},
ToolDef {
id: "get_user_details".into(),
description: "Get details of a user by user ID.".into(),
schema: schemars::schema_for!(GetAirlineUserDetailsParams),
invocation: InvocationHint::ToolCall,
output_schema: None,
},
ToolDef {
id: "list_all_airports".into(),
description: "List all airports with their city, country, and code.".into(),
schema: empty_object_schema(),
invocation: InvocationHint::ToolCall,
output_schema: None,
},
ToolDef {
id: "search_direct_flight".into(),
description: "Search for direct flights between two airports on a given date.".into(),
schema: schemars::schema_for!(SearchDirectFlightParams),
invocation: InvocationHint::ToolCall,
output_schema: None,
},
ToolDef {
id: "search_onestop_flight".into(),
description: "Search for one-stop flights between two airports on a given date.".into(),
schema: schemars::schema_for!(SearchOnestopFlightParams),
invocation: InvocationHint::ToolCall,
output_schema: None,
},
ToolDef {
id: "send_certificate".into(),
description: "Send a travel certificate to a user as compensation.".into(),
schema: schemars::schema_for!(SendCertificateParams),
invocation: InvocationHint::ToolCall,
output_schema: None,
},
ToolDef {
id: "transfer_to_human_agents".into(),
description: "Escalate the conversation to a human agent.".into(),
schema: schemars::schema_for!(TransferToHumanAgentsParams),
invocation: InvocationHint::ToolCall,
output_schema: None,
},
ToolDef {
id: "update_reservation_baggages".into(),
description: "Update the baggage allowance on a reservation.".into(),
schema: schemars::schema_for!(UpdateReservationBaggagesParams),
invocation: InvocationHint::ToolCall,
output_schema: None,
},
ToolDef {
id: "update_reservation_flights".into(),
description: "Change the flights on an existing reservation.".into(),
schema: schemars::schema_for!(UpdateReservationFlightsParams),
invocation: InvocationHint::ToolCall,
output_schema: None,
},
ToolDef {
id: "update_reservation_passengers".into(),
description: "Update passenger information on a reservation.".into(),
schema: schemars::schema_for!(UpdateReservationPassengersParams),
invocation: InvocationHint::ToolCall,
output_schema: None,
},
ToolDef {
id: "get_flight_status".into(),
description: "Get the status of a flight by flight number and date.".into(),
schema: schemars::schema_for!(GetFlightStatusParams),
invocation: InvocationHint::ToolCall,
output_schema: None,
},
]
}