Subscribe to newsletter
Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form.
Account
Sign upRNA Digital Pty Ltd
Enterprises are turning to RAG (Retrieval-Augmented Generation) because it fundamentally changes how AI can be used for better decision-making.
RAG combines the power of information retrieval with AI generation, allowing businesses to:
RAG is a framework designed to improve language models by pulling in relevant, up-to-date data directly related to a user’s query and RAG chat apps allow you to chat with your data.
In this blog, we will learn to build a RAG chatbot in minutes using AgentCloud.
AgentCloud is an open-source platform enabling companies to build and deploy private LLM chat apps, empowering teams to securely interact with their data.
So, let’s get started building a RAG chat application using Agent Cloud to talk privately and securely with your Postgres data.
To run AgentCloud locally, ensure Docker is installed. Follow these steps to get AgentCloud up and running.
git clone https://github.com/rnadigital/agentcloud.git
cd agentcloud
chmod +x install.sh && ./install.sh
Running the install command will download necessary Docker images and launch the containers.
Once the install script is executed successfully we can view the containers running in the docker app:
To access Agent Cloud in the browser, we can hit the below URL:
http://localhost:3000/register
Next, we need to sign to the platform
Post sign-up, and log in to the App, to get to this landing screen.
Congrats, setup is complete now. Next, we will move towards building our RAG application.
Agent Cloud allows us to use models like FastEmbed and OpenAI in app.
To add a new model let’s go to the Models screen and click the Add Model option.
In the configuration screen, select a Model—such as the fast-bge-small-en for embedding text. Then, save your settings to finish the model setup.
Post successfully adding the model we will be able to view the model in the Models list.
The data source for our app will be a Postgres table which contains information about Indian dishes.
Here is the snapshot of the table data.
Our table features 181 Indian dishes representing various Indian states.
Here is a description of the table columns.
To integrate table data into our app, add the data source by navigating to the Data Source page, clicking the New Connection button, and selecting a source from the modal.
Let's choose Postgres as our data source and then configure the connection.
Here's what's needed to set up the Postgres data source.
Let's disabled the SSL modes as we're running Postgres on our local machine.
Next, we need to select the replication method; I have selected Xmin.
Xmin replication is the new cursor-less replication method for Postgres.
Cursorless syncs enable syncing new or updated rows without explicitly choosing a cursor field. The Xmin system column is used to track inserts and updates to your source data.
Now, we need to click on the Test and Save button, which will first test the DB connection and, if successful, save the data connector.
We'll select the table and all its columns.
The column meta_info is selected for embedding, which means the vector search will be performed on the contents of this column.
Then we press the Continue button to create the Data Source.
It will take some time to embed the data, and post that you will be able to see this data in a new collection in the Qdrant collection dashboard.
After setting up the data source, Agent Cloud uses Airbyte in the background to create a data pipeline between Postgres and Qdrant.
Once the sync is complete, the new collection will appear in the Qdrant DB.
Example of how the data is stored inside a Qdrant point.
Next, we will be setting up a tool for using our data source.
Tools are essential for enabling the AI agent to interact effectively with its environment, process information, and take appropriate actions to achieve its goals.
The tools used by an AI agent can include functions, APIs, data sources, and other resources that help the agent perform specific tasks autonomously and efficiently.
The tool we will be setting up will be responsible for querying the data source and fetching relevant documents. Agent Cloud creates a tool for us when we add a new data source by default.
The screenshot below shows that the Postgres Food data tool has been automatically created by the platform.
I have updated the tool configuration to change the description.
This description is very important as it will be used by the Agent to decide which tool to use for a given task.
Click on the Save button to update the tool.
An Agent is an intelligent system that can efficiently accomplish complex tasks.
To create an Agent, let’s go to the Agents screen and click on the New Agent button.
In the Agent configuration, we need to provide certain information one of the information is the LLM Model. Agents use LLMs to enhance their capabilities and improve communication.
We are using gpt-4-0125-preview OpenAI model for our agent.
Here are the remaining details needed for configuration:
Now click on the Save button to complete the Agent configuration.
Tasks are specific assignments assigned to an agent for completion.
To create a new task let’s click the `Add Task` button in the Task screen.
When configuring the task, provide the following information:
Post that we can click on the Save button to save the configuration.
So till now, we have created a data source for the App, a tool to retrieve to information from the data source, an LLM Agent that will be working on complex tasks using the tool, and a Task that will be assigned to the Agent based on the user’s instruction.
Now we will be creating a conversational App that will allow us to chat with our data.
To create the App, let’s go to the App screen and click on the New App button.
In the configuration page, let’s enter the app name and select the app type, which will be a conversation chat app in our case.
Select the Task and Agent that we created. In the process, we will select sequential, and finally, in the Chat manager model, we will select the OpenAI GPT 4 model.
Now we can click on the Save button to complete the app setup.
After completing the app setup, the newly created app will appear in the dashboard.
Now let's see the app in action by clicking the Play button.
A conversion window is opened for us where we can chat with our data.
Here is the app's response to our question.
Yay, we did it 😎
In this blog, we learned to build a RAG chat app with Agent Cloud and Postgres.
We covered creating a data source, embedding it, and storing it in Qdrant DB.
Additionally, we learned how to build tools for Agents and create an app where users can interact with their private data.