Ai Web Agent Rag banner
botextractai botextractai

Ai Web Agent Rag

AI community

Description

An advanced Artificial Intelligence (AI) example of a Retrieval-Augmented Generation (RAG) Next.js web app with agents (tools)

Installation

This entry records only its repository, not the path inside it, so there is no exact command to give. Open the source below and copy the folder into ~/.claude/skills/, or the file into ~/.claude/agents/.

README

Advanced Retrieval-Augmented Generation (RAG) web app

This advanced Retrieval-Augmented Generation (RAG) web app is based on the [LlamaIndex](https://www.llamaindex.ai/) project using [Next.js](https://nextjs.org/) bootstrapped with [create-llama](https://www.npmjs.com/package/create-llama).

You might therefore have to install [Node.js](https://nodejs.org/en) first.

The front-end is a Next.js (React) TypeScript (JavaScript) web app.

This web app also contains two different types of agents (tools).

The first one is the [Wikipedia tool](https://llamahub.ai/l/tools/llama-index-tools-wikipedia) provided by LlamaIndex.

The second one is a custom FunctionTool in the `chat.ts` file. This custom function writes the first name in lower case letters and the last name in upper case letters. This is in itself not very useful, but you can easily change it to any functionality you like. You just have to change the custom function and the JSON (parameter) description of the custom function accordingly.

First, install the dependencies:

npm install

You will need to supply your own OpenAI API key. You can supply your OpenAI API key either via the `.env` file, or through an environment variable called `OPENAI_API_KEY`. If you don't want to use OpenAI, then you can change the web app to use any of the Large Language Models (LLMs) that LlamaIndex supports, including local models.

[Pinecone](https://www.pinecone.io/) is used as Vector Store (database). You can use a free Pinecone pod-based index of the "Chatbot" type. You can give your index any name you like. If you use the GPT-3.5 Large Language Model, then you will have to set the configuration to "text-embedding-ada-002" ("1536" dimension and "cosine" metric). You will then have to supply these 3 settings either through environment variables, or via the `.env` file like this:

PINECONE_API_KEY=
PINECONE_ENVIRONMENT=https://.pinec