Voicegain Enterprise Speech-to-Text Platform (API, Portal, etc.)
The Project is to create a fast food ordering voicebot using Langchain and Voicegain Telephony Bot API. The bot has the ability to order from a predefined menu that includes burgers, wraps, drinks, fries and potato wedges. The bot can distinguish between all vegetarian items and non-veg items. The user has the ability to customize their order by adding topics / add-ons to their burger or wrap and have the ability to pick from 3 different sizes for the fries and potato wedges. They can further create custom combo orders and have a choice between 3 - main item with a drink, main item with a side of their fries or potato wedges, main with a side and a drink. If an order qualifies for a combo order - the bot automatically creates a combo for the user. The bot can summarize the users order at any point along with calculating the total cost of the order. The user can further edit their order at any point - by either changing an item (replace item, change quantity etc) or deleting an item entirely.
There are mainly 3 steps to it -
Each of these work hand in hand to create the bot.
For the bot logic, we use LangChain which is a framework to build with LLMs by chaining interoperable components. This helps in managing the workflow of the bot.
For Langchain Reference kindly refer the Documentation here - https://python.langchain.com/v0.2/docs/introduction/
If the reader is interested in the detailed bot implementation, kindly read through —
The bot logic is powered by LangChain and OpenAI’s API. In order to create the bot framework, chains are used to link the various functions that the bot can perform. By using tools, the program is able to create a basic function framework that ChatGPT can use depending on the task. It is important to note that the function description is key as this informs ChatGPT what the function of each of these functions are, and can respectively pick the appropriate function for the task. This logic for bot is present in fast_food_bot.py.
The core functions are therefore created as tool functions in LangChain. Functions such as giving the order summary and the total order cost have their own function as well, so as to prevent possible errors arising from ChatGPT.
Reference Document: https://console.voicegain.ai/api-documentation#tag/aivr-callback
Implement POST / PUT / DELETE
This is the component that integrates Voicegain’s Telephony Bot API with the function of the langChain bot. This adds the ability to interact with the bot through speech, rather than text, thereby enhancing the user interaction experience. This logic is present in main.py.
By making an AIVR App on the Voicegain Portal, we can enable the speech component to our food ordering bot. This has mainly 3 steps -
We explore these steps in detail below.
When you’ve run the main.py file and the bot is running locally on your device, you need to host the bot on a public URL for using on AIVR app. One of the options for that is to use Ngrok - https://dashboard.ngrok.com/get-started/setup/windows
After you’ve configured the public URL for the food ordering bot, we need to setup the AIVR App using the following steps -





Now you can call on the phone number in the Main DNIS and you can use the food ordering bot on call.
Voicegain Team