How do I create a chatbot like this [travel agent] and is it complicated to do?

I need to create a chatGPT bot that will sit in the corner of a browser and users can interact with it and be able to book hotels.

A visitor should be able to have a simple conversation, detailing times they want to travel, location and things like number of guests and so on.

GPT should then dig into a database (I have MYSQL at the moment but can swap to anything required) and suggest some hotels that they might like.

If they need to, a real advisor should be brought into the conversation.

This sounds straightforward forward but I’m really struggling to decide whether I need a 3rd party solution or use one of the methods on youtube like ’ [How to integrate OpenAI GPT3 with a Databases - Crash Course] etc. Which seem way to complicated.

I am a pretty good PHP coder and have experience with open AI’s API. But have no idea where to go from here.

EDIT: Some great replies here that will serve as a good starting point. Thanks for the help!

1 Like

The OpenAI cookbook has some pretty decent examples of how to work with database. You should start there. Also , with the fact that these things still hallucinate i’d say be very careful with integration, you might end up stuck with some confused or angry customers.


First: As mentioned by @scharleswatson do not, ever, EVER rely on GPT to make the final call. You can use it to curate a list of hotels and then present it for the user to make the final decision.

Second: This is a pretty daunting task. You would need to find hotels, flights, correlate them all by timing and pricing, organize them, and then ensure the user’s conditions are met. Then you need to make it autonomous. The chances for hallucinations here is incredibly high.

You would need a database that you can subscribe/listen to. This is commonly referred to as a “RealTime Database”. Supabase offers an open-source, free-tier database using postgres

You would then need to create an API for this database so that you can manually curate these hotels. Validation, cleaning, and error handling is CRITICAL HERE.

Then, you would need to use GPT with Function Calling. It would use the same API that you have been using.

So now, the GPT can make function calls to your API which would affect your database. Typically you would give the user their own space, authorized by their ID. When a change is made the user is notified via subscription (usually SSE), and this tells the front-end interface to update.


Everything @scharleswatson and @RonaldGRuckus said. However, I have a text to sql application that retrieves data from a MySQL database, so that is possible.

All of my AI development is in PHP. I use Drupal as my infrastructure. So, I am able to utilize the Drupal core REST API and direct the OpenAI LLM to execute the database calls via that API.

Your biggest challenge, as I see it, is coming up with the prompts that will define your database tables in a way to ensure that the model responds adequately to your end-user queries.

Some notes:


Building a good GPT chatbot, using your data can be achievable by using RAG Consider using tools like LangChain or Llama Index. However, creating an good and effective GPT Chatbot requires time and technical expertise, but it is achievable if you have decent experience.

If you prefer a solution without deep technical involvement, a third-party service like Yourgpt Chatbot could be ideal. I think it fulfils your basic feature requirements: human operator, intent detection, function calling, and code execution.

1 Like