Categories
GenAI

RAG ChatGPT apps complete examples using Azure and OpenAI

Do you want to create RAG ChatGPT apps and don’t know where to start? I’ll show you two complete official examples!
They will be very useful for understanding how you can create an application like ChatGPT to ask questions about your data, be it documents, databases or web pages.

ChatGPT-like app with your data demo

RAG Architecture
ChatGPT with you data demo app architecture

In this demo app you can ask a ChatGPT questions about data in documents.
Imagine having a series of PDFs for your ChatGPT to analyze and then question it about.
Through Azure AI Search documents are analyzed by storing relevant information.
By then taking advantage of GenAI models such as ChatGPT 3.5 Turbo via Azure OpenAI, you will be able to ask questions to your bot and get the answer you are looking for without having to manually study all the documents.

Chat screen
An example of ChatGPT question and answer regarding document information

You can easily deploy the application, consisting of a frontend in React and a backend in Python and the necessary services via Bicep, see the folder below.
You will then be able to upload the documents with the instructions locally in the script folder and interact via chat thanks to the application frontend, asking your questions.

It is also possible to run the application locally, interacting directly with the necessary cloud services.
Note that it is also possible to use the application directly with OpenAI‘s public APIs.

This example is extremely useful for understanding how to create a basic but complete RAG ChatGPT application, which can ask questions about data that we have provided and which are therefore not already present in the GenAI model.

Link: https://github.com/Azure-Samples/azure-search-openai-demo/

Chat with your data Solution Accelerator

We can say that this application example is similar to the one already described, but more complex.

Solution Architecture - Chat with your data
Chat with your data Solution Accelerator Architecture

In particular, unlike the first, here we do not have to run a script to analyze documents, but there is also an administrative application part.
Through it it is possible not only to upload documents, but also to analyze web pages.
In practice, a serverless Azure Function will take care of processing the indicated documents or pages each time.

A screenshot of the admin site.
Chat with your data Solution acceleratoradministration

Furthermore, the possibility from the frontend of being able to speak instead of writing with your ChatGPT is already integrated, thanks to the Azure AI Speech.

A screenshot of the chat app.
Chat with your data Solution accelerator frontend

Despite the presence of the serverless function, this example also allows you to deploy the application locally using Azure online services.

Link: https://github.com/Azure-Samples/chat-with-your-data-solution-accelerator

If you can, I recommend you try the first application and then the second one mentioned.
Analyze the code, try to make changes and improvements.
If you are interested in these topics you will easily find links to further examples in these repositories and a world of services and possibilities will open up to you, as this sector has grown exponentially in recent times.