AI Agents: Generative AI Trend of the Month
In just 30 minutes, learn to build no-code AI agent applications with an LLM that has real-world knowledge.
Join the DZone community and get the full member experience.
Join For FreeIf you have been involved in LLM (Large Language Model) and Generative AI application development, "AI agents" wouldn't be a new term for you.
AI agents are Software that can perform certain tasks independently and proactively without the need for human intervention, often utilizing a suite of tools like calculators or web browsing.
- AI Glossary
If you are new to the domain, you might wonder: "How is it different from Large Language Models and when do I use AI agents in my application?"
One of the major areas where AI agents could help is removing the shortcomings of LLMs that models might not have the most current world knowledge. Why? This is because models can only be used on the data it is trained on. To solve this, we introduce AI agents in the flow to help with getting the latest data. Thus, if LLMs are not able to answer a question confidently and correctly, related agents that are assigned are called.
As we enter the 2nd half of 2023, AI agents are being utilized for complex workflows, creating specialized personality templates and multi-tasking AI. It is a hot area in the industry as several tech startups are growing in this area (see "Insight: Race towards 'autonomous' AI agents grips Silicon Valley"). You might have recently heard the news of AI Village utilizing 25 bots (see "Researchers Create AI Village Where Bots Plan Valentine's Day Parties"). But there are several other companies already offering AI agent workflow support such as AgentGPT (reworkd.ai) and CognosysAI.
My personal favorite is a drag and drop AI called FlowiseAI - Build LLMs Apps Easily which helps me in creating ChatGPT applications that have real-world information.
Thus, I wanted to share step by step approach to how I created a no-code LLM application that answers with the latest world knowledge using the Flowise.ai tool.
I used a five-stage process to build the application:
- Stage 1: Install
- Stage 2: Build
- Stage 3: Connect
- Step 4: Run
- Step 5: Share/Export
The steps below don't require you to have experience in day-to-day software development. Thus, even product managers, designers, and other field professionals can also use it.
Stage 1: Install
- 1. 1. Install NodeJS - Download Node.js and run the installer (no coding experience required).
- 1.2. Open command prompt - By typing
cmd
on your Windows search bar; within the command prompt, type the following instruction:
This will install GitHub - FlowiseAI/Flowise. Drag and drop UI to build your customized LLM flow.
- 1.3. After the above installation is done, start the Flowise tool by typing
Npx flowise start
on the command prompt.
When Flowise is successfully started, you will get a custom message like this:
If you are an advanced developer, you can find alternative ways to install from the above GitHub link to Flowise.
- 1.4.Running Flowise.AI- Next open the browser and type
localhost:3000
. It will open a page like the one below:
Stage 2: Build
We are now ready to start building our ChatGPT application feeding in real-world data.
In order for the LLM to fetch the latest world information, we will leverage SerpAPI, which helps integrate Google Search APIs.
Let's go through building step-by-step.
- 2.1. On the
localhost:3000
browser that has flowise.ai running, click on add new on the right of the page. This would open a blank canvas:
- 2.2. This is where we will build our drag-and-drop application with AI agents. On the left of the canvas, you will see the option to add different nodes as shown in the below screenshot.
Using the search button on Add node above, drag and drop the following four nodes and connect them in the way shown below:
- ChatOpenAI - Connects basic ChatGPT bot
- Conversational agent- Helps build an interactive chatbot that remembers the chatbot history
- Buffer memory- It helps save the conversation for more contextual answers.
- SerpAPI - Google Search API, an AI agent that is called when OpenAI doesn't have the latest information
Note: The items marked in red below will be filled in during the next step.
The temperature number inside ChatOpenAI has been marked as 0.2 to provide a more accurate answer. If you want more creative answers, you can increase this number to 1.
This shouldn't take more than 5min.
Stage 3: Connect
Once you have built the application shown in the screenshot above using drag and drop only, you will need two APIs to connect to the following:
- 3.1. OpenAI Key - Visit the OpenAI platform to get the key. You would need to create a new account if not having an existing one. After the account is created, on the top right, you will see an option to view API keys.
Click on View API keys and create a new secret key.
Once this key is created, save it somewhere secured and go back to the Flowise localhost:3000
application running on the browser.
Now add this key under Connect Credential in the ChatOpenAI box on the browser as shown below:
- 3.2.SerpAPI Key - Next, visit SerpAPI for the Google search key. I signed up for the free tier.
Similar to the OpenAI key, add the SerpAPI key on the browser.
Stage 4: Run
After your APIs are added in the previous stage, make sure to save the Flowise chatflow.
Your flow should look something like the below:
We will now test it by clicking on the chat button on the Flowise UI on the right and asking Chatbot for some of the latest information as shown in the screenshot below.
Stage 5: Share/Export
Once you are happy, just click on the settings button on the top right of the page, and then click Export Chatflow.
I decided to use the Share Chatbot button. If you are a more advanced developer, you can use other embed/Python/JavaScript/cURL integration options.
This is what my personalized chatbot finally looks like from the Share Chatbot customized options.
Happy creating quick LLM applications that are personalized and don't hallucinate, thanks to AI Agents! :)
Opinions expressed by DZone contributors are their own.
Comments