Merge branch 'master' of github.com:Mintplex-Labs/anything-llm into render

This commit is contained in:
timothycarambat 2023-12-19 16:23:19 -08:00
commit 1ca06cc3e1
10 changed files with 86 additions and 65 deletions

View File

@ -3,6 +3,11 @@ name: Publish Docker image and Github Registry
on: on:
push: push:
branches: ['master'] branches: ['master']
paths-ignore:
- '*.md'
- 'cloud-deployments/*'
- 'images/*'
- '.vscode/*'
jobs: jobs:
push_to_registries: push_to_registries:

101
README.md
View File

@ -1,3 +1,4 @@
<a name="readme-top"></a>
<p align="center"> <p align="center">
<a href="https://useanything.com"><img src="https://github.com/Mintplex-Labs/anything-llm/blob/master/images/wordmark.png?raw=true" alt="AnythingLLM logo"></a> <a href="https://useanything.com"><img src="https://github.com/Mintplex-Labs/anything-llm/blob/master/images/wordmark.png?raw=true" alt="AnythingLLM logo"></a>
</p> </p>
@ -26,10 +27,13 @@ A full-stack application that enables you to turn any document, resource, or pie
![Chatting](/images/screenshots/chatting.gif) ![Chatting](/images/screenshots/chatting.gif)
### Watch the demo! <details>
<summary><kbd>Watch the demo!</kbd></summary>
[![Watch the video](/images/youtube.png)](https://youtu.be/f95rGD9trL0) [![Watch the video](/images/youtube.png)](https://youtu.be/f95rGD9trL0)
</details>
### Product Overview ### Product Overview
AnythingLLM is a full-stack application where you can use commercial off-the-shelf LLMs or popular open source LLMs and vectorDB solutions to build a private ChatGPT with no compromises that you can run locally as well as host remotely and be able to chat intelligently with any documents you provide it. AnythingLLM is a full-stack application where you can use commercial off-the-shelf LLMs or popular open source LLMs and vectorDB solutions to build a private ChatGPT with no compromises that you can run locally as well as host remotely and be able to chat intelligently with any documents you provide it.
@ -79,64 +83,28 @@ This monorepo consists of three main sections:
- `docker`: Docker instructions and build process + information for building from source. - `docker`: Docker instructions and build process + information for building from source.
- `collector`: NodeJS express server that process and parses documents from the UI. - `collector`: NodeJS express server that process and parses documents from the UI.
### Minimum Requirements ## 🛳 Self Hosting
> [!TIP] Mintplex Labs & the community maintain a number of deployment methods, scripts, and templates that you can use to run AnythingLLM locally. Refer to the table below to read how to deploy on your preferred environment or to automatically deploy.
> Running AnythingLLM on AWS/GCP/Azure? | Docker | AWS | GCP | Digital Ocean | Render.com |
> You should aim for at least 2GB of RAM. Disk storage is proportional to however much data |----------------------------------------|----:|-----|---------------|------------|
> you will be storing (documents, vectors, models, etc). Minimum 10GB recommended. | [![Deploy on Docker][docker-btn]][docker-deploy] | [![Deploy on AWS][aws-btn]][aws-deploy] | [![Deploy on GCP][gcp-btn]][gcp-deploy] | [![Deploy on DigitalOcean][do-btn]][aws-deploy] | [![Deploy on Render.com][render-btn]][render-deploy] |
- `yarn` and `node` on your machine
- access to an LLM running locally or remotely.
*AnythingLLM by default uses a built-in vector database powered by [LanceDB](https://github.com/lancedb/lancedb) ## How to setup for development
*AnythingLLM by default embeds text on instance privately [Learn More](/server/storage/models/README.md)
## Recommended usage with Docker (easy!)
> [!IMPORTANT]
> If you are running another service on localhost like Chroma, LocalAi, or LMStudio
> you will need to use http://host.docker.internal:xxxx to access the service from within
> the docker container using AnythingLLM as `localhost:xxxx` will not resolve for the host system.
> eg: Chroma host URL running on localhost:8000 on host machine needs to be http://host.docker.internal:8000
> when used in AnythingLLM.
> [!TIP]
> It is best to mount the containers storage volume to a folder on your host machine
> so that you can pull in future updates without deleting your existing data!
`docker pull mintplexlabs/anythingllm:master`
```shell
export STORAGE_LOCATION=$HOME/anythingllm && \
mkdir -p $STORAGE_LOCATION && \
touch "$STORAGE_LOCATION/.env" && \
docker run -d -p 3001:3001 \
--cap-add SYS_ADMIN \
-v ${STORAGE_LOCATION}:/app/server/storage \
-v ${STORAGE_LOCATION}/.env:/app/server/.env \
-e STORAGE_DIR="/app/server/storage" \
mintplexlabs/anythingllm:master
```
Open [http://localhost:3001](http://localhost:3001) and you are now using AnythingLLM!
All your data and progress will now persist between container rebuilds or pulls from Docker Hub.
[Learn more about running AnythingLLM with Docker](./docker/HOW_TO_USE_DOCKER.md)
### How to get started (Development environment)
- `yarn setup` from the project root directory. - `yarn setup` from the project root directory.
- This will fill in the required `.env` files you'll need in each of the application sections. Go fill those out before proceeding or else things won't work right. - This will fill in the required `.env` files you'll need in each of the application sections. Go fill those out before proceeding or else things won't work right.
- `yarn prisma:setup` To build the Prisma client and migrate the database. - `yarn prisma:setup` To build the Prisma client and migrate the database.
To boot the server locally (run commands from root of repo): To boot the server locally (from root of repo):
- ensure `server/.env.development` is set and filled out. - ensure `server/.env.development` is set and filled out.
`yarn dev:server` `yarn dev:server`
To boot the frontend locally (run commands from root of repo): To boot the frontend locally (from root of repo):
- ensure `frontend/.env` is set and filled out.
- ensure `VITE_API_BASE="http://localhost:3001/api"`
`yarn dev:frontend` `yarn dev:frontend`
To then run the document collector (from root of repo)
`yarn dev:collector`
[Learn about documents](./server/storage/documents/DOCUMENTS.md) [Learn about documents](./server/storage/documents/DOCUMENTS.md)
[Learn about vector caching](./server/storage/vector-cache/VECTOR_CACHE.md) [Learn about vector caching](./server/storage/vector-cache/VECTOR_CACHE.md)
@ -146,6 +114,9 @@ To boot the frontend locally (run commands from root of repo):
- create PR with branch name format of `<issue number>-<short name>` - create PR with branch name format of `<issue number>-<short name>`
- yee haw let's merge - yee haw let's merge
<details>
<summary><kbd>Telemetry for AnythingLLM</kbd></summary>
## Telemetry ## Telemetry
AnythingLLM by Mintplex Labs Inc contains a telemetry feature that collects anonymous usage information. AnythingLLM by Mintplex Labs Inc contains a telemetry feature that collects anonymous usage information.
@ -168,3 +139,37 @@ We will only track usage details that help us make product and roadmap decisions
- Chat is sent. This is the most regular "event" and gives us an idea of the daily-activity of this project across all installations. Again, only the event is sent - we have no information on the nature or content of the chat itself. - Chat is sent. This is the most regular "event" and gives us an idea of the daily-activity of this project across all installations. Again, only the event is sent - we have no information on the nature or content of the chat itself.
You can verify these claims by finding all locations `Telemetry.sendTelemetry` is called. Additionally these events are written to the output log so you can also see the specific data which was sent - if enabled. No IP or other identifying information is collected. The Telemetry provider is [PostHog](https://posthog.com/) - an open-source telemetry collection service. You can verify these claims by finding all locations `Telemetry.sendTelemetry` is called. Additionally these events are written to the output log so you can also see the specific data which was sent - if enabled. No IP or other identifying information is collected. The Telemetry provider is [PostHog](https://posthog.com/) - an open-source telemetry collection service.
</details>
## 🔗 More Products
- **[VectorAdmin][vector-admin]:** An all-in-one GUI & tool-suite for managing vector databases.
- **[OpenAI Assistant Swarm][assistant-swarm]:** Turn your entire library of OpenAI assistants into one single army commanded from a single agent.
<div align="right">
[![][back-to-top]](#readme-top)
</div>
---
Copyright © 2023 [Mintplex Labs][profile-link]. <br />
This project is [MIT](./LICENSE) licensed.
<!-- LINK GROUP -->
[back-to-top]: https://img.shields.io/badge/-BACK_TO_TOP-222628?style=flat-square
[profile-link]: https://github.com/mintplex-labs
[vector-admin]: https://github.com/mintplex-labs/vector-admin
[assistant-swarm]: https://github.com/Mintplex-Labs/openai-assistant-swarm
[docker-btn]: ./images/deployBtns/docker.png
[docker-deploy]: ./docker/HOW_TO_USE_DOCKER.md
[aws-btn]: ./images/deployBtns/aws.png
[aws-deploy]: ./cloud-deployments/aws/cloudformation/DEPLOY.md
[gcp-btn]: https://deploy.cloud.run/button.svg
[gcp-deploy]: ./cloud-deployments/gcp/deployment/DEPLOY.md
[do-btn]: https://www.deploytodo.com/do-btn-blue.svg
[do-deploy]: ./cloud-deployments/digitalocean/terraform/DEPLOY.md
[render-btn]: https://render.com/images/deploy-to-render-button.svg
[render-deploy]: https://render.com/deploy?repo=https://github.com/Mintplex-Labs/anything-llm&branch=render

1
collector/.env.example Normal file
View File

@ -0,0 +1 @@
# Placeholder .env file for collector runtime

View File

@ -2,8 +2,20 @@
Use the Dockerized version of AnythingLLM for a much faster and complete startup of AnythingLLM. Use the Dockerized version of AnythingLLM for a much faster and complete startup of AnythingLLM.
## Requirements
- Install [Docker](https://www.docker.com/) on your computer or machine. ### Minimum Requirements
> [!TIP]
> Running AnythingLLM on AWS/GCP/Azure?
> You should aim for at least 2GB of RAM. Disk storage is proportional to however much data
> you will be storing (documents, vectors, models, etc). Minimum 10GB recommended.
- `docker` installed on your machine
- `yarn` and `node` on your machine
- access to an LLM running locally or remotely
*AnythingLLM by default uses a built-in vector database powered by [LanceDB](https://github.com/lancedb/lancedb)
*AnythingLLM by default embeds text on instance privately [Learn More](../server/storage/models/README.md)
## Recommend way to run dockerized AnythingLLM! ## Recommend way to run dockerized AnythingLLM!
> [!IMPORTANT] > [!IMPORTANT]
@ -34,7 +46,13 @@ mintplexlabs/anythingllm:master
Go to `http://localhost:3001` and you are now using AnythingLLM! All your data and progress will persist between Go to `http://localhost:3001` and you are now using AnythingLLM! All your data and progress will persist between
container rebuilds or pulls from Docker Hub. container rebuilds or pulls from Docker Hub.
## Build locally from source ## How to use the user interface
- To access the full application, visit `http://localhost:3001` in your browser.
## About UID and GID in the ENV
- The UID and GID are set to 1000 by default. This is the default user in the Docker container and on most host operating systems. If there is a mismatch between your host user UID and GID and what is set in the `.env` file, you may experience permission issues.
## Build locally from source _not recommended for casual use_
- `git clone` this repo and `cd anything-llm` to get to the root directory. - `git clone` this repo and `cd anything-llm` to get to the root directory.
- `touch server/storage/anythingllm.db` to create empty SQLite DB file. - `touch server/storage/anythingllm.db` to create empty SQLite DB file.
- `cd docker/` - `cd docker/`
@ -43,12 +61,6 @@ container rebuilds or pulls from Docker Hub.
Your docker host will show the image as online once the build process is completed. This will build the app to `http://localhost:3001`. Your docker host will show the image as online once the build process is completed. This will build the app to `http://localhost:3001`.
## How to use the user interface
- To access the full application, visit `http://localhost:3001` in your browser.
## About UID and GID in the ENV
- The UID and GID are set to 1000 by default. This is the default user in the Docker container and on most host operating systems. If there is a mismatch between your host user UID and GID and what is set in the `.env` file, you may experience permission issues.
## ⚠️ Vector DB support ⚠️ ## ⚠️ Vector DB support ⚠️
Out of the box, all vector databases are supported. Any vector databases requiring special configuration are listed below. Out of the box, all vector databases are supported. Any vector databases requiring special configuration are listed below.
@ -80,6 +92,4 @@ VITE_API_BASE="http://<YOUR_REACHABLE_IP_ADDRESS>:3001/api"
For example, if the docker instance is available on `192.186.1.222` your `VITE_API_BASE` would look like `VITE_API_BASE="http://192.186.1.222:3001/api"` in `frontend/.env.production`. For example, if the docker instance is available on `192.186.1.222` your `VITE_API_BASE` would look like `VITE_API_BASE="http://192.186.1.222:3001/api"` in `frontend/.env.production`.
### Still not working? ### Still not working?
[Ask for help on Discord](https://discord.gg/6UyHPeGZAC) [Ask for help on Discord](https://discord.gg/6UyHPeGZAC)

BIN
images/deployBtns/aws.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

View File

@ -14,7 +14,7 @@ class AzureOpenAiEmbedder {
); );
this.openai = openai; this.openai = openai;
// The maximum amount of "inputs" that OpenAI API can process in a single call. // Limit of how many strings we can process in a single pass to stay with resource or network limits
// https://learn.microsoft.com/en-us/azure/ai-services/openai/faq#i-am-trying-to-use-embeddings-and-received-the-error--invalidrequesterror--too-many-inputs--the-max-number-of-inputs-is-1---how-do-i-fix-this-:~:text=consisting%20of%20up%20to%2016%20inputs%20per%20API%20request // https://learn.microsoft.com/en-us/azure/ai-services/openai/faq#i-am-trying-to-use-embeddings-and-received-the-error--invalidrequesterror--too-many-inputs--the-max-number-of-inputs-is-1---how-do-i-fix-this-:~:text=consisting%20of%20up%20to%2016%20inputs%20per%20API%20request
this.embeddingMaxChunkLength = 16; this.embeddingMaxChunkLength = 16;
} }

View File

@ -17,7 +17,7 @@ class LocalAiEmbedder {
}); });
this.openai = new OpenAIApi(config); this.openai = new OpenAIApi(config);
// Arbitrary limit of string size in chars to ensure we stay within reasonable POST request size. // Limit of how many strings we can process in a single pass to stay with resource or network limits
this.embeddingMaxChunkLength = maximumChunkLength(); this.embeddingMaxChunkLength = maximumChunkLength();
} }

View File

@ -13,8 +13,8 @@ class NativeEmbedder {
); );
this.modelPath = path.resolve(this.cacheDir, "Xenova", "all-MiniLM-L6-v2"); this.modelPath = path.resolve(this.cacheDir, "Xenova", "all-MiniLM-L6-v2");
// Arbitrary limit of string size in chars to ensure we stay within reasonable POST request size. // Limit of how many strings we can process in a single pass to stay with resource or network limits
this.embeddingMaxChunkLength = 1_000; this.embeddingMaxChunkLength = 50;
// Make directory when it does not exist in existing installations // Make directory when it does not exist in existing installations
if (!fs.existsSync(this.cacheDir)) fs.mkdirSync(this.cacheDir); if (!fs.existsSync(this.cacheDir)) fs.mkdirSync(this.cacheDir);

View File

@ -10,7 +10,7 @@ class OpenAiEmbedder {
const openai = new OpenAIApi(config); const openai = new OpenAIApi(config);
this.openai = openai; this.openai = openai;
// Arbitrary limit of string size in chars to ensure we stay within reasonable POST request size. // Limit of how many strings we can process in a single pass to stay with resource or network limits
this.embeddingMaxChunkLength = 1_000; this.embeddingMaxChunkLength = 1_000;
} }