diff --git a/.github/workflows/build-and-push-image.yaml b/.github/workflows/build-and-push-image.yaml index 76b6dac15..943af5526 100644 --- a/.github/workflows/build-and-push-image.yaml +++ b/.github/workflows/build-and-push-image.yaml @@ -3,6 +3,11 @@ name: Publish Docker image and Github Registry on: push: branches: ['master'] + paths-ignore: + - '*.md' + - 'cloud-deployments/*' + - 'images/*' + - '.vscode/*' jobs: push_to_registries: diff --git a/README.md b/README.md index e91520ab4..9ed7cc609 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,4 @@ +

AnythingLLM logo

@@ -26,10 +27,13 @@ A full-stack application that enables you to turn any document, resource, or pie ![Chatting](/images/screenshots/chatting.gif) -### Watch the demo! +
+Watch the demo! [![Watch the video](/images/youtube.png)](https://youtu.be/f95rGD9trL0) +
+ ### 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. @@ -79,64 +83,28 @@ This monorepo consists of three main sections: - `docker`: Docker instructions and build process + information for building from source. - `collector`: NodeJS express server that process and parses documents from the UI. -### 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. +## 🛳 Self Hosting +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. +| Docker | AWS | GCP | Digital Ocean | Render.com | +|----------------------------------------|----:|-----|---------------|------------| +| [![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) - -*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) +## How to setup for development - `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. - `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. `yarn dev:server` -To boot the frontend locally (run commands from root of repo): -- ensure `frontend/.env` is set and filled out. -- ensure `VITE_API_BASE="http://localhost:3001/api"` +To boot the frontend locally (from root of repo): `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 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 `-` - yee haw let's merge +
+Telemetry for AnythingLLM + ## Telemetry 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. 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. + +
+ +## 🔗 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. + +
+ +[![][back-to-top]](#readme-top) + +
+ +--- + +Copyright © 2023 [Mintplex Labs][profile-link].
+This project is [MIT](./LICENSE) licensed. + + +[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 diff --git a/collector/.env.example b/collector/.env.example new file mode 100644 index 000000000..91d0e10a5 --- /dev/null +++ b/collector/.env.example @@ -0,0 +1 @@ +# Placeholder .env file for collector runtime \ No newline at end of file diff --git a/docker/HOW_TO_USE_DOCKER.md b/docker/HOW_TO_USE_DOCKER.md index a74b11d45..5b5a58067 100644 --- a/docker/HOW_TO_USE_DOCKER.md +++ b/docker/HOW_TO_USE_DOCKER.md @@ -2,8 +2,20 @@ 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! > [!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 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. - `touch server/storage/anythingllm.db` to create empty SQLite DB file. - `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`. -## 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 ⚠️ 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://: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`. ### Still not working? -[Ask for help on Discord](https://discord.gg/6UyHPeGZAC) - - +[Ask for help on Discord](https://discord.gg/6UyHPeGZAC) \ No newline at end of file diff --git a/images/deployBtns/aws.png b/images/deployBtns/aws.png new file mode 100644 index 000000000..fde4a2a8d Binary files /dev/null and b/images/deployBtns/aws.png differ diff --git a/images/deployBtns/docker.png b/images/deployBtns/docker.png new file mode 100644 index 000000000..e79604afd Binary files /dev/null and b/images/deployBtns/docker.png differ diff --git a/server/utils/EmbeddingEngines/azureOpenAi/index.js b/server/utils/EmbeddingEngines/azureOpenAi/index.js index 8959b0007..3f36b576b 100644 --- a/server/utils/EmbeddingEngines/azureOpenAi/index.js +++ b/server/utils/EmbeddingEngines/azureOpenAi/index.js @@ -14,7 +14,7 @@ class AzureOpenAiEmbedder { ); 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 this.embeddingMaxChunkLength = 16; } diff --git a/server/utils/EmbeddingEngines/localAi/index.js b/server/utils/EmbeddingEngines/localAi/index.js index 0f43cc7dc..68fe66544 100644 --- a/server/utils/EmbeddingEngines/localAi/index.js +++ b/server/utils/EmbeddingEngines/localAi/index.js @@ -17,7 +17,7 @@ class LocalAiEmbedder { }); 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(); } diff --git a/server/utils/EmbeddingEngines/native/index.js b/server/utils/EmbeddingEngines/native/index.js index 2081e3fde..81189d4e2 100644 --- a/server/utils/EmbeddingEngines/native/index.js +++ b/server/utils/EmbeddingEngines/native/index.js @@ -13,8 +13,8 @@ class NativeEmbedder { ); 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. - this.embeddingMaxChunkLength = 1_000; + // Limit of how many strings we can process in a single pass to stay with resource or network limits + this.embeddingMaxChunkLength = 50; // Make directory when it does not exist in existing installations if (!fs.existsSync(this.cacheDir)) fs.mkdirSync(this.cacheDir); diff --git a/server/utils/EmbeddingEngines/openAi/index.js b/server/utils/EmbeddingEngines/openAi/index.js index 8cfa23516..6ba38c898 100644 --- a/server/utils/EmbeddingEngines/openAi/index.js +++ b/server/utils/EmbeddingEngines/openAi/index.js @@ -10,7 +10,7 @@ class OpenAiEmbedder { const openai = new OpenAIApi(config); 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; }