You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This sample application demonstrates the use of Managed LLMs (Large Language Models) with Defang.
6
+
7
+
The Managed LLM feature, provided by the Defang OpenAI Access Gateway, enables users to switch LLM models in production without altering the app's API interface.
8
+
9
+
You can configure the `MODEL` and `ENDPOINT_URL` for the LLM separately for local development and production environments. The `MODEL` is the LLM Model ID you are using. The `ENDPOINT_URL` is the bridge that provides authenticated access to the LLM model.
10
+
11
+
### Defang OpenAI Access Gateway
12
+
13
+
In the `compose.yaml` file, the `llm-gateway` service is used to route requests to the LLM API model. This is known as the Defang OpenAI Access Gateway.
14
+
15
+
The `x-defang-llm` property must be set to `true` to enable the feature during deployment with Defang.
2. (Optional) If you are using [Defang BYOC](https://docs.defang.io/docs/concepts/defang-byoc) authenticate with your cloud provider account
21
+
3. (Optional for local development) [Docker CLI](https://docs.docker.com/engine/install/)
22
+
23
+
## Development
24
+
25
+
To run the application locally, you can use the following command:
26
+
27
+
```bash
28
+
docker compose -f compose.dev.yaml up --build
29
+
```
30
+
31
+
## Configuration
32
+
33
+
For this sample, you will need to provide the following [configuration](https://docs.defang.io/docs/concepts/configuration):
34
+
35
+
> Note that if you are using the 1-click deploy option, you can set these values as secrets in your GitHub repository and the action will automatically deploy them for you.
36
+
37
+
### `MODEL`
38
+
The Model ID of the LLM you are using for your application. For example, `anthropic.claude-3-5-haiku-20241022-v1:0`.
0 commit comments