Sign up to save tools and stay up to date with the latest in AI
bg
bg
1

Combining WhatsApp with large language models: prototyping with Twilio and Flask

Aug 16, 2023 - medium.com
Nesta’s Discovery Hub has developed a WhatsApp chatbot prototype that uses a large language model (LLM) to generate activity ideas for early-years education. The chatbot, built using Twilio, Flask, and OpenAI, can respond to user messages with pre-made prompts, which are then sent to OpenAI's LLM for a response. The prototype can handle two types of user messages, 'Explain' and 'Activities', with the latter requiring the bot to send a hold message due to the time it takes for the LLM to generate a response.

The article also provides a technical overview of how the chatbot was built, including the use of Python, Twilio's Sandbox for WhatsApp, and Flask API. It explains how to run the API locally with ngrok and deploy it on Heroku using Docker. The authors note that while the current implementation is simple, it has been useful for exploring the technical feasibility of combining WhatsApp with generative AI, particularly for early-years education. Future iterations could potentially use WhatsApp messaging history to enable more natural interactions and allow users to ask follow-up questions.

Key takeaways:

  • Nesta’s Discovery Hub has created a WhatsApp chatbot prototype that uses a large language model (LLM) to generate personalised activity ideas for toddlers and answer questions.
  • The chatbot was built using Twilio, a communications service platform, Flask Python package, and OpenAI. It can handle two types of user messages and provides responses based on pre-made tailored prompts.
  • The prototype can be tested locally using ngrok and deployed on Heroku using Docker, ensuring it runs even when the local machine is turned off.
  • While the current implementation is simple, it highlights the potential of combining WhatsApp with generative AI, especially in the context of early-years education. Future iterations could use WhatsApp messaging history for more natural interactions and follow-up questions.
View Full Article

Comments (0)

Be the first to comment!