AI prompts
base on <br /><br />
<p align="center">
<img src="./public/android-chrome-192x192.png" alt="LlamaIndex Chat Logo" width="70">
</p>
<h3 align="center"><b>LlamaIndex Chat</b></h3>
<p align="center"><b>Create chat bots that know your data</b></p>
<p>
<img
src="./public/screenshot.png"
alt="LlamaIndex Chat Screen"
width="100%"
/>
</p>
Welcome to [LlamaIndex Chat](https://github.com/run-llama/chat-llamaindex). You can create and share LLM chatbots that know your data (PDF or text documents).
Getting started with LlamaIndex Chat is a breeze. Visit https://chat.llamaindex.ai - a hosted version of LlamaIndex Chat with no user authentication that provides an immediate start.
## 🚀 Features
LlamaIndex Chat is an example chatbot application for [LlamaIndexTS](https://github.com/run-llama/LlamaIndexTS) featuring [LlamaCloud](https://cloud.llamaindex.ai/).
You can:
- Create bots using prompt engineering and share them with other users.
- Modify the demo bots by using the UI or directly editing the [./app/bots/bot.data.ts](./app/store/bot.data.ts) file.
- Integrate your data by uploading documents or generating new [data sources](#📀-data-sources).
## ⚡️ Quick start
### Local Development
Requirement: [NodeJS](https://nodejs.org) 18
- Clone the repository
```bash
git clone https://github.com/run-llama/chat-llamaindex
cd chat-llamaindex
```
- Prepare the project
```bash
pnpm install
pnpm run create-llama
```
> **Note**: The last step copies the chat UI component and file server route from the [create-llama](https://github.com/run-llama/create-llama) project, see [./create-llama.sh](./create-llama.sh).
- Set the environment variables
Edit environment variables in `.env.development.local`. Especially check your `OPENAI_API_KEY` and `LLAMA_CLOUD_API_KEY` and the LlamaCloud project to use (`LLAMA_CLOUD_PROJECT_NAME`).
- Download the demo datasources
```bash
pnpm run get-demo
```
- Upload the demo datasources to your LlamaCloud account
```bash
pnpm run generate-demo
```
- Run the dev server
```bash
pnpm dev
```
### 🐳 Docker
Note: This sections has not been used for a while and might be outdated.
You can use Docker for development and deployment of LlamaIndex Chat.
#### Building the Docker Image
```bash
docker build -t chat-llamaindex .
```
#### Running in a Docker Container
```bash
docker run -p 3000:3000 --env-file .env.development.local chat-llamaindex
```
#### Docker Compose
For those preferring Docker Compose, we've included a docker-compose.yml file. To run using Docker Compose:
```bash
docker compose up
```
Go to http://localhost:3000 in your web browser.
**Note**: By default, the Docker Compose setup maps the `cache` and `datasources` directories from your host machine to the Docker container, ensuring data persistence and accessibility between container restarts.
### Vercel Deployment
Deploying to Vercel is simple; click the button below and follow the instructions:
[![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/clone?repository-url=https%3A%2F%2Fgithub.com%2Frun-llama%2Fchat-llamaindex&env=OPENAI_API_KEY)
If you're deploying to a [Vercel Hobby](https://vercel.com/docs/accounts/plans#hobby) account, [change the running time](./app/api/llm/route.ts#L196) to 10 seconds, as this is the limit for the free plan.
If you want to use the [sharing](#🔄-sharing) functionality, then you need to create a Vercel KV store and connect it to your project.
Just follow [this step from the quickstart](https://vercel.com/docs/storage/vercel-kv/quickstart#create-a-kv-database). No further configuration is necessary as the app automatically uses a connected KV store.
## 🔄 Sharing
LlamaIndex Chat supports the sharing of bots via URLs. Demo bots are read-only and can't be shared. But you can create new bots (or clone and modify a demo bot) and call the share functionality in the context menu. It will create a unique URL that you can share with others. Opening the URL, users can directly use the shared bot.
## 📀 Data Sources
The app is using a [`ChatEngine`](https://ts.llamaindex.ai/modules/chat_engine) for each bot with a [`LlamaCloudIndex`](https://ts.llamaindex.ai/modules/llamacloud) attached.
To set which `LlamaCloudIndex` is used for a bot, change the `datasource` attribute in the [bot's data](./app/store/bot.data.ts).
> **Note**: To use the changed bots, you have to clear your local storage. Otherwise, the old bots are still used. You can clear your local storage by opening the developer tools and running `localStorage.clear()` in the console and reloading the page.
### Generate Data Sources
To generate a new data source, create a new subfolder in the `datasources` directory and add the data files (e.g., PDFs).
Then, run the following command to create <datasource-name> as an index in the `Default` project on LlamaCloud
```bash
pnpm run generate <datasource-name>
```
Where `<datasource-name>` is the name of the subfolder with your data files.
> **Note**: On Windows, use `pnpm run generate:win <datasource-name>` instead.
## 🙏 Thanks
Thanks go to @Yidadaa for his [ChatGPT-Next-Web](https://github.com/Yidadaa/ChatGPT-Next-Web) project, which was used as a starter template for this project.
", Assign "at most 3 tags" to the expected json: {"id":"4402","tags":[]} "only from the tags list I provide: [{"id":77,"name":"3d"},{"id":89,"name":"agent"},{"id":17,"name":"ai"},{"id":54,"name":"algorithm"},{"id":24,"name":"api"},{"id":44,"name":"authentication"},{"id":3,"name":"aws"},{"id":27,"name":"backend"},{"id":60,"name":"benchmark"},{"id":72,"name":"best-practices"},{"id":39,"name":"bitcoin"},{"id":37,"name":"blockchain"},{"id":1,"name":"blog"},{"id":45,"name":"bundler"},{"id":58,"name":"cache"},{"id":21,"name":"chat"},{"id":49,"name":"cicd"},{"id":4,"name":"cli"},{"id":64,"name":"cloud-native"},{"id":48,"name":"cms"},{"id":61,"name":"compiler"},{"id":68,"name":"containerization"},{"id":92,"name":"crm"},{"id":34,"name":"data"},{"id":47,"name":"database"},{"id":8,"name":"declarative-gui "},{"id":9,"name":"deploy-tool"},{"id":53,"name":"desktop-app"},{"id":6,"name":"dev-exp-lib"},{"id":59,"name":"dev-tool"},{"id":13,"name":"ecommerce"},{"id":26,"name":"editor"},{"id":66,"name":"emulator"},{"id":62,"name":"filesystem"},{"id":80,"name":"finance"},{"id":15,"name":"firmware"},{"id":73,"name":"for-fun"},{"id":2,"name":"framework"},{"id":11,"name":"frontend"},{"id":22,"name":"game"},{"id":81,"name":"game-engine "},{"id":23,"name":"graphql"},{"id":84,"name":"gui"},{"id":91,"name":"http"},{"id":5,"name":"http-client"},{"id":51,"name":"iac"},{"id":30,"name":"ide"},{"id":78,"name":"iot"},{"id":40,"name":"json"},{"id":83,"name":"julian"},{"id":38,"name":"k8s"},{"id":31,"name":"language"},{"id":10,"name":"learning-resource"},{"id":33,"name":"lib"},{"id":41,"name":"linter"},{"id":28,"name":"lms"},{"id":16,"name":"logging"},{"id":76,"name":"low-code"},{"id":90,"name":"message-queue"},{"id":42,"name":"mobile-app"},{"id":18,"name":"monitoring"},{"id":36,"name":"networking"},{"id":7,"name":"node-version"},{"id":55,"name":"nosql"},{"id":57,"name":"observability"},{"id":46,"name":"orm"},{"id":52,"name":"os"},{"id":14,"name":"parser"},{"id":74,"name":"react"},{"id":82,"name":"real-time"},{"id":56,"name":"robot"},{"id":65,"name":"runtime"},{"id":32,"name":"sdk"},{"id":71,"name":"search"},{"id":63,"name":"secrets"},{"id":25,"name":"security"},{"id":85,"name":"server"},{"id":86,"name":"serverless"},{"id":70,"name":"storage"},{"id":75,"name":"system-design"},{"id":79,"name":"terminal"},{"id":29,"name":"testing"},{"id":12,"name":"ui"},{"id":50,"name":"ux"},{"id":88,"name":"video"},{"id":20,"name":"web-app"},{"id":35,"name":"web-server"},{"id":43,"name":"webassembly"},{"id":69,"name":"workflow"},{"id":87,"name":"yaml"}]" returns me the "expected json"