DocsGPT/docs/pages/Guides/How-to-use-different-LLM.md

43 lines
1.6 KiB
Markdown
Raw Normal View History

2023-10-25 10:08:19 +00:00
# Setting Up Local Language Models for Your App
2023-09-07 11:36:39 +00:00
2023-10-25 10:08:19 +00:00
Your app relies on two essential models: Embeddings and Text Generation. While OpenAI's default models work seamlessly, you have the flexibility to switch providers or even run the models locally.
2023-09-07 11:36:39 +00:00
2023-10-25 10:08:19 +00:00
## Step 1: Configure Environment Variables
2023-09-07 11:36:39 +00:00
2023-10-25 10:08:19 +00:00
Navigate to the `.env` file or set the following environment variables:
2023-09-07 11:36:39 +00:00
2023-10-25 10:08:19 +00:00
```env
LLM_NAME=<your Text Generation model>
API_KEY=<API key for Text Generation>
EMBEDDINGS_NAME=<LLM for Embeddings>
EMBEDDINGS_KEY=<API key for Embeddings>
VITE_API_STREAMING=<true or false>
```
2023-09-07 11:36:39 +00:00
2023-10-25 10:08:19 +00:00
You can omit the keys if users provide their own. Ensure you set `LLM_NAME` and `EMBEDDINGS_NAME`.
2023-09-07 11:36:39 +00:00
2023-10-25 10:08:19 +00:00
## Step 2: Choose Your Models
2023-09-07 11:36:39 +00:00
2023-10-25 10:08:19 +00:00
**Options for `LLM_NAME`:**
- openai
- manifest
- cohere
- Arc53/docsgpt-14b
- Arc53/docsgpt-7b-falcon
- llama.cpp
2023-09-07 11:36:39 +00:00
2023-10-25 10:08:19 +00:00
**Options for `EMBEDDINGS_NAME`:**
- openai_text-embedding-ada-002
- huggingface_sentence-transformers/all-mpnet-base-v2
- huggingface_hkunlp/instructor-large
- cohere_medium
2023-09-07 11:36:39 +00:00
2023-10-25 10:08:19 +00:00
If using Llama, set `EMBEDDINGS_NAME` to `huggingface_sentence-transformers/all-mpnet-base-v2`. Download the required model and place it in the `models/` folder.
2023-09-07 11:36:39 +00:00
2023-10-25 10:08:19 +00:00
Alternatively, for local Llama setup, run `setup.sh` and choose option 1. The script handles the DocsGPT model addition.
2023-09-07 11:36:39 +00:00
2023-10-25 10:08:19 +00:00
## Step 3: Local Hosting for Privacy
2023-10-25 10:08:19 +00:00
If working with sensitive data, host everything locally by setting `SELF_HOSTED_MODEL` to true in your `.env`. For `LLM_NAME`, use any model available on Hugging Face.
That's it! Your app is now configured for local and private hosting, ensuring optimal security for critical data.