Skip to content

Commit 3183d6b

Browse files
authored
🐳 : Further Docker build Cleanup & Docs Update (danny-avila#1502)
* refactor: post-cleanup changes: - add more unnecessary paths to .dockerignore - remove librechat.yaml from main compose file (prevents from being required) - do not create librechat.yaml during build (does nothing) * docs: make config file instructions easier to read, more info throughout other docs * docs: add custom config to menu * Update custom_config.md * Update docker_compose_install.md
1 parent 5d7869d commit 3183d6b

12 files changed

+181
-37
lines changed

.dockerignore

+11-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,17 @@
1-
node_modules
1+
**/.circleci
2+
**/.editorconfig
3+
**/.dockerignore
4+
**/.git
5+
**/.DS_Store
6+
**/.vscode
7+
**/node_modules
8+
9+
# Specific patterns to ignore
210
data-node
311
meili_data*
412
librechat*
513
Dockerfile*
14+
docs
15+
616
# Ignore all hidden files
717
.*

Dockerfile

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@ WORKDIR /app
66

77
# Allow mounting of these files, which have no default
88
# values.
9-
RUN touch .env librechat.yaml
9+
RUN touch .env
1010
# Install call deps - Install curl for health check
1111
RUN apk --no-cache add curl && \
12-
npm ci
12+
npm ci
1313

1414
# React client build
1515
ENV NODE_OPTIONS="--max-old-space-size=2048"

docker-compose.override.yml.example

+5
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,11 @@ version: '3.4'
88
# # SAVE THIS FILE AS 'docker-compose.override.yaml'
99
# # AND USE THE 'docker-compose build' & 'docker-compose up -d' COMMANDS AS YOU WOULD NORMALLY DO
1010

11+
# # USE LIBRECHAT CONFIG FILE
12+
# api:
13+
# volumes:
14+
# - ./librechat.yaml:/app/librechat.yaml
15+
1116
# # BUILD FROM LATEST IMAGE
1217
# api:
1318
# image: ghcr.io/danny-avila/librechat-dev:latest

docker-compose.yml

-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ services:
2525
volumes:
2626
- ./.env:/app/.env
2727
- ./images:/app/client/public/images
28-
- ./librechat.yaml:/app/librechat.yaml
2928
mongodb:
3029
container_name: chat-mongodb
3130
image: mongo

docs/install/configuration/ai_setup.md

+2
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,8 @@ Using the default environment values from [/.env.example](https://github.com/dan
4848

4949
This guide will walk you through setting up each Endpoint as needed.
5050

51+
For **custom endpoint** configuration, such as adding [Mistral AI](https://docs.mistral.ai/platform/client/) or [Openrouter](https://openrouter.ai/) refer to the **[librechat.yaml configuration guide](./custom_config.md)**.
52+
5153
**Reminder: If you use docker, you should [rebuild the docker image (here's how)](dotenv.md) each time you update your credentials**
5254

5355
*Note: Configuring pre-made Endpoint/model/conversation settings as singular options for your users is a planned feature. See the related discussion here: [System-wide custom model settings (lightweight GPTs) #1291](https://github.com/danny-avila/LibreChat/discussions/1291)*

docs/install/configuration/custom_config.md

+107-29
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,29 @@
1+
---
2+
title: 🖥️ Custom Endpoints & Config
3+
description: Comprehensive guide for configuring the `librechat.yaml` file AKA the LibreChat Config file. This document is your one-stop resource for understanding and customizing endpoints & other integrations.
4+
weight: -10
5+
---
6+
17
# LibreChat Configuration Guide
28

3-
This document provides detailed instructions for configuring the `librechat.yaml` file used by LibreChat.
9+
Welcome to the guide for configuring the **librechat.yaml** file in LibreChat.
10+
11+
This file enables the integration of custom AI endpoints, enabling you to connect with any AI provider compliant with OpenAI API standards.
12+
13+
This includes providers like [Mistral AI](https://docs.mistral.ai/platform/client/), as well as reverse proxies that facilitate access to OpenAI servers, adding them alongside existing endpoints like Anthropic.
414

5-
In future updates, some of the configurations from [your `.env` file](./dotenv.md) will migrate here.
15+
![image](https://github.com/danny-avila/LibreChat/assets/110412045/fd0d2307-008f-4e1d-b75b-4f141070ce71)
616

7-
Further customization of the current configurations are also planned.
17+
Future updates will streamline configuration further by migrating some settings from [your `.env` file](./dotenv.md) to `librechat.yaml`.
18+
19+
Stay tuned for ongoing enhancements to customize your LibreChat instance!
820

921
# Table of Contents
1022

1123
1. [Intro](#librechat-configuration-guide)
12-
- [Configuration Overview](#configuration-overview)
24+
- [Setup](#setup)
25+
- [Docker Setup](#docker-setup)
26+
- [Config Structure](#config-structure)
1327
- [1. Version](#1-version)
1428
- [2. Cache Settings](#2-cache-settings)
1529
- [3. Endpoints](#3-endpoints)
@@ -19,10 +33,39 @@ Further customization of the current configurations are also planned.
1933
- [Breakdown of Default Params](#breakdown-of-default-params)
2034
- [Example Config](#example-config)
2135

22-
## Configuration Overview
36+
## Setup
37+
38+
**The `librechat.yaml` file should be placed in the root of the project where the .env file is located.**
2339

40+
You can copy the [example config file](#example-config) as a good starting point while reading the rest of the guide.
2441

25-
The `librechat.yaml` file contains several key sections.
42+
The example config file has some options ready to go for Mistral AI and Openrouter.
43+
44+
## Docker Setup
45+
46+
For Docker, you need to make use of an [override file](./docker_override), named `docker-compose.override.yml`, to ensure the config file works for you.
47+
48+
- First, make sure your containers stop running with `docker-compose down`
49+
- Create or edit existing `docker-compose.override.yml` at the root of the project:
50+
51+
```yaml
52+
# For more details on the override file, see the Docker Override Guide:
53+
# https://docs.librechat.ai/install/configuration/docker_override.html
54+
55+
version: '3.4'
56+
57+
services:
58+
api:
59+
volumes:
60+
- ./librechat.yaml:/app/librechat.yaml
61+
```
62+
63+
- Start docker again, and you should see your config file settings apply
64+
```bash
65+
docker-compose up # no need to rebuild
66+
```
67+
68+
## Config Structure
2669

2770
**Note:** Fields not specifically mentioned as required are optional.
2871

@@ -48,36 +91,61 @@ The `librechat.yaml` file contains several key sections.
4891
- **Description**: Each object in the array represents a unique endpoint configuration.
4992
- **Required**
5093

51-
#### Endpoint Object Structure
94+
## Endpoint Object Structure
5295
Each endpoint in the `custom` array should have the following structure:
5396

54-
- **name**: A unique name for the endpoint.
97+
```yaml
98+
# Example Endpoint Object Structure
99+
endpoints:
100+
custom:
101+
- name: "Mistral"
102+
apiKey: "${YOUR_ENV_VAR_KEY}"
103+
baseURL: "https://api.mistral.ai/v1"
104+
models:
105+
default: ["mistral-tiny", "mistral-small", "mistral-medium"]
106+
titleConvo: true
107+
titleModel: "mistral-tiny"
108+
summarize: false
109+
summaryModel: "mistral-tiny"
110+
forcePrompt: false
111+
modelDisplayLabel: "Mistral"
112+
addParams:
113+
safe_mode: true
114+
dropParams: ["stop", "temperature", "top_p"]
115+
```
116+
117+
### **name**:
118+
> A unique name for the endpoint.
55119
- Type: String
56120
- Example: `name: "Mistral"`
57121
- **Required**
58122
- **Note**: Will be used as the "title" in the Endpoints Selector
59123

60-
- **apiKey**: Your API key for the service. Can reference an environment variable, or allow user to provide the value.
124+
### **apiKey**:
125+
> Your API key for the service. Can reference an environment variable, or allow user to provide the value.
61126
- Type: String (apiKey | `"user_provided"`)
62-
- **Example**: `apiKey: "${MISTRAL_API_KEY}"` | `apiKey: "your_api_key"` | `apiKey: "user_provided"`
127+
- Example: `apiKey: "${MISTRAL_API_KEY}"` | `apiKey: "your_api_key"` | `apiKey: "user_provided"`
63128
- **Required**
64129
- **Note**: It's highly recommended to use the env. variable reference for this field, i.e. `${YOUR_VARIABLE}`
65130

66-
- **baseURL**: Base URL for the API. Can reference an environment variable, or allow user to provide the value.
131+
### **baseURL**:
132+
> Base URL for the API. Can reference an environment variable, or allow user to provide the value.
67133
- Type: String (baseURL | `"user_provided"`)
68-
- **Example**: `baseURL: "https://api.mistral.ai/v1"` | `baseURL: "${MISTRAL_BASE_URL}"` | `baseURL: "user_provided"`
134+
- Example: `baseURL: "https://api.mistral.ai/v1"` | `baseURL: "${MISTRAL_BASE_URL}"` | `baseURL: "user_provided"`
69135
- **Required**
70136
- **Note**: It's highly recommended to use the env. variable reference for this field, i.e. `${YOUR_VARIABLE}`
71137

72-
- **iconURL**: The URL to use as the Endpoint Icon.
138+
### **iconURL**:
139+
> The URL to use as the Endpoint Icon.
73140
- Type: Boolean
74141
- Example: `iconURL: https://github.com/danny-avila/LibreChat/raw/main/docs/assets/LibreChat.svg`
75-
- **Note**: The following are "known endpoints" (case-insensitive), which have icons provided for them. If your endpoint `name` matches these, you should omit this field:
142+
- **Note**: The following are "known endpoints" (case-insensitive), which have icons provided for them. If your endpoint `name` matches the following names, you should omit this field:
76143
- "Mistral"
77144
- "OpenRouter"
78145

79-
- **models**: Configuration for models.
80-
- **Required**
146+
### **models**:
147+
> Configuration for models.
148+
- **Required**
81149
- **default**: An array of strings indicating the default models to use. At least one value is required.
82150
- Type: Array of Strings
83151
- Example: `default: ["mistral-tiny", "mistral-small", "mistral-medium"]`
@@ -87,44 +155,54 @@ Each endpoint in the `custom` array should have the following structure:
87155
- Example: `fetch: true`
88156
- **Note**: May cause slowdowns during initial use of the app if the response is delayed. Defaults to `false`.
89157

90-
- **titleConvo**: Enables title conversation when set to `true`.
158+
### **titleConvo**:
159+
> Enables title conversation when set to `true`.
91160
- Type: Boolean
92161
- Example: `titleConvo: true`
93162

94-
- **titleMethod**: Chooses between "completion" or "functions" for title method.
163+
### **titleMethod**:
164+
> Chooses between "completion" or "functions" for title method.
95165
- Type: String (`"completion"` | `"functions"`)
96166
- Example: `titleMethod: "completion"`
97167
- **Note**: Defaults to "completion" if omitted.
98168

99-
- **titleModel**: Specifies the model to use for titles.
169+
### **titleModel**:
170+
> Specifies the model to use for titles.
100171
- Type: String
101172
- Example: `titleModel: "mistral-tiny"`
102173
- **Note**: Defaults to "gpt-3.5-turbo" if omitted. May cause issues if "gpt-3.5-turbo" is not available.
103174

104-
- **summarize**: Enables summarization when set to `true`.
175+
### **summarize**:
176+
> Enables summarization when set to `true`.
105177
- Type: Boolean
106178
- Example: `summarize: false`
107179
- **Note**: This feature requires an OpenAI Functions compatible API
108180

109-
- **summaryModel**: Specifies the model to use if summarization is enabled.
181+
### **summaryModel**:
182+
> Specifies the model to use if summarization is enabled.
110183
- Type: String
111184
- Example: `summaryModel: "mistral-tiny"`
112185
- **Note**: Defaults to "gpt-3.5-turbo" if omitted. May cause issues if "gpt-3.5-turbo" is not available.
113186

114-
- **forcePrompt**: If `true`, sends a `prompt` parameter instead of `messages`.
187+
### **forcePrompt**:
188+
> If `true`, sends a `prompt` parameter instead of `messages`.
115189
- Type: Boolean
116190
- Example: `forcePrompt: false`
117-
- **Note**: This combines all messages into a single text payload, [following OpenAI format](https://github.com/pvicente/openai-python/blob/main/chatml.md), and uses the `/completions` endpoint of your baseURL rather than `/chat/completions`.
191+
- **Note**: This combines all messages into a single text payload, [following OpenAI format](https://github.com/pvicente/openai-python/blob/main/chatml.md), and
118192

119-
- **modelDisplayLabel**: The label displayed in messages next to the Icon for the current AI model.
193+
uses the `/completions` endpoint of your baseURL rather than `/chat/completions`.
194+
195+
### **modelDisplayLabel**:
196+
> The label displayed in messages next to the Icon for the current AI model.
120197
- Type: String
121198
- Example: `modelDisplayLabel: "Mistral"`
122199
- **Note**: The display order is:
123200
- 1. Custom name set via preset (if available)
124201
- 2. Label derived from the model name (if applicable)
125202
- 3. This value, `modelDisplayLabel`, is used if the above are not specified. Defaults to "AI".
126203

127-
- **addParams**: Adds additional parameters to requests.
204+
### **addParams**:
205+
> Adds additional parameters to requests.
128206
- Type: Object/Dictionary
129207
- **Description**: Adds/Overrides parameters. Useful for specifying API-specific options.
130208
- **Example**:
@@ -133,12 +211,12 @@ Each endpoint in the `custom` array should have the following structure:
133211
safe_mode: true
134212
```
135213

136-
- **dropParams**: Removes default parameters from requests.
214+
### **dropParams**:
215+
> Removes [default parameters](#default-parameters) from requests.
137216
- Type: Array/List of Strings
138-
- **Description**: Excludes specified default parameters. Useful for APIs that do not accept or recognize certain parameters.
217+
- **Description**: Excludes specified [default parameters](#default-parameters). Useful for APIs that do not accept or recognize certain parameters.
139218
- **Example**: `dropParams: ["stop", "temperature", "top_p"]`
140-
- **Note**: For a list of default parameters sent with every request, see the "Default Parameters" Section below.
141-
219+
- **Note**: For a list of default parameters sent with every request, see the ["Default Parameters"](#default-parameters) Section below.
142220
## Additional Notes
143221
- Ensure that all URLs and keys are correctly specified to avoid connectivity issues.
144222

docs/install/configuration/docker_override.md

+12-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,18 @@ Open your `docker-compose.override.yml` file with vscode or any text editor.
3434

3535
Make your desired changes by uncommenting the relevant sections and customizing them as needed.
3636

37-
For example, if you want to use a prebuilt image for the `api` service and expose MongoDB's port, your `docker-compose.override.yml` might look like this:
37+
For example, if you want to make sure Docker can use your `librechat.yaml` file for [custom configuration](./custom_config.md), it would look like this:
38+
39+
```yaml
40+
version: '3.4'
41+
42+
services:
43+
api:
44+
volumes:
45+
- ./librechat.yaml:/app/librechat.yaml
46+
```
47+
48+
Or, if you want to use a prebuilt image for the `api` service and expose MongoDB's port, your `docker-compose.override.yml` might look like this:
3849

3950
```yaml
4051
version: '3.4'

docs/install/configuration/dotenv.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: ⚙️ Environment Variables
33
description: Comprehensive guide for configuring your application's environment with the `.env` file. This document is your one-stop resource for understanding and customizing the environment variables that will shape your application's behavior in different contexts.
4-
weight: -10
4+
weight: -11
55
---
66

77
# .env File Configuration

docs/install/configuration/index.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ weight: 2
77
# Configuration
88

99
* ⚙️ [Environment Variables](./dotenv.md)
10-
* 🖥️ [Custom Config & Endpoints](./configuration/custom_config.md)
10+
* 🖥️ [Custom Endpoints & Config](./custom_config.md)
1111
* 🐋 [Docker Compose Override](./docker_override.md)
1212
---
1313
* 🤖 [AI Setup](./ai_setup.md)

docs/install/index.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ weight: 1
1717
## **[Configuration](./configuration/index.md)**
1818

1919
* ⚙️ [Environment Variables](./configuration/dotenv.md)
20-
* 🖥️ [Custom Config & Endpoints](./configuration/custom_config.md)
20+
* 🖥️ [Custom Endpoints & Config](./configuration/custom_config.md)
2121
* 🐋 [Docker Compose Override](./configuration/docker_override.md)
2222
* 🤖 [AI Setup](./configuration/ai_setup.md)
2323
* 🚅 [LiteLLM](./configuration/litellm.md)

docs/install/installation/container_install.md

+36
Original file line numberDiff line numberDiff line change
@@ -222,4 +222,40 @@ podman stop librechat && systemctl --user start container-librechat
222222

223223
---
224224

225+
## Integrating the Configuration File in Podman Setup
226+
227+
When using Podman for setting up LibreChat, you can also integrate the [`librechat.yaml` configuration file](../configuration/custom_config.md).
228+
229+
This file allows you to define specific settings and AI endpoints, such as Mistral AI, tailoring the application to your needs.
230+
231+
After creating your `.env` file as detailed in the previous steps, follow these instructions to integrate the `librechat.yaml` configuration:
232+
233+
1. Place your `librechat.yaml` file in your project's root directory.
234+
2. Modify the Podman run command for the LibreChat container to include a volume argument that maps the `librechat.yaml` file inside the container. This can be done by adding the following line to your Podman run command:
235+
236+
```bash
237+
-v "./librechat.yaml:/app/librechat.yaml"
238+
```
239+
240+
For example, the modified Podman run command for starting LibreChat will look like this:
241+
242+
```bash
243+
podman run \
244+
--name="librechat" \
245+
--network=librechat \
246+
--env-file="./.env" \
247+
-v "./librechat.yaml:/app/librechat.yaml" \
248+
-p 3080:3080 \
249+
--detach \
250+
librechat:local;
251+
```
252+
253+
By mapping the `librechat.yaml` file into the container, Podman ensures that your custom configurations are applied to LibreChat, enabling a tailored AI experience.
254+
255+
Ensure that the `librechat.yaml` file is correctly formatted and contains valid settings.
256+
257+
Any errors in this file might affect the functionality of LibreChat. For more information on configuring `librechat.yaml`, refer to the [configuration guide](../configuration/custom_config.md).
258+
259+
---
260+
225261
>⚠️ Note: If you're having trouble, before creating a new issue, please search for similar ones on our [#issues thread on our discord](https://discord.gg/weqZFtD9C4) or our [troubleshooting discussion](https://github.com/danny-avila/LibreChat/discussions/categories/troubleshooting) on our Discussions page. If you don't find a relevant issue, feel free to create a new one and provide as much detail as possible.

docs/install/installation/docker_compose_install.md

+3
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@ Before running LibreChat with Docker, you need to configure some settings:
3434
#### [AI Setup](../configuration/ai_setup.md) (Required)
3535
At least one AI endpoint should be setup for use.
3636

37+
#### [Custom Endpoints & Configuration](../configuration/custom_config.md#docker-setup) (Optional)
38+
Allows you to customize AI endpoints, such as Mistral AI, and other settings to suit your specific needs.
39+
3740
#### [Manage Your MongoDB Database](../../features/manage_your_database.md) (Optional)
3841
Safely access and manage your MongoDB database using Mongo Express
3942

0 commit comments

Comments
 (0)