For example, we have a hotel reservation chatbot with the following function/tool:
{
"name": "reserve_hotel",
"description": "Reserve a room for the user in the hotel",
"parameters": {
"type": "object",
"properties": {
"hotel": {
"type": "string",
"description": "Name of the hotel"
},
"location": {
"type": "string",
"description": "Location or branch of the hotel"
},
"fullName": {
"type": "string",
"description": "Full name of the user making reservation"
},
"email": {
"type": "string",
"description": "Email address of the user making the reservation"
},
"phoneNumber": {
"type": "string",
"description": "Contact number of the user making the reservation"
},
"numberOfGuests": {
"type": "integer",
"description": "Total number of people who will be staying in the room"
},
"checkInDate": {
"type": "string",
"description": "Date when the guests will arrive in 'YYYY-MM-DD' format"
},
"checkOutDate": {
"type": "string",
"description": "Date when the guests will leave in 'YYYY-MM-DD' format"
},
"roomType": {
"type": "string",
"description": "Type of room desired (e.g., single, double, suite)",
"enum": [
"single",
"double",
"suite"
]
},
"specialRequests": {
"type": "array",
"description": "Any specific requests like a room on a certain floor, near the elevator, extra bed, etc.",
"items": {
"type": "string"
}
}
},
"required": [
"hotel",
"location",
"fullName",
"email",
"phoneNumber",
"numberOfGuests",
"checkInDate",
"checkOutDate",
"roomType",
"specialRequests"
]
}
The output for this tool, if valid, will be added to the DB.
Check the following sample conversations. First one is pretty straightforward, where the required parameters are listed up front.
The second one we need to extract the required parameters from the user one by one. This can be done by proper validation of the tool output including how to handle hallucinations.