Skip to content

Commit 7d68caf

Browse files
revisions
1 parent 2cc1742 commit 7d68caf

File tree

6 files changed

+29
-41
lines changed

6 files changed

+29
-41
lines changed

docs/concepts/managed-llms/managed-language-models.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ Assume you have a web service like the following, which uses the cloud native SD
2626

2727
## Deploying OpenAI-compatible apps
2828

29-
If you already have an OpenAI-compatible application, Defang makes it easy to deploy on your favourite cloud's managed LLM service. See our [OpenAI Access Gateway](/docs/concepts/openai-access-gateway.md)
29+
If you already have an OpenAI-compatible application, Defang makes it easy to deploy on your favourite cloud's managed LLM service. See our [OpenAI Access Gateway](/docs/concepts/managed-llms/openai-access-gateway)
3030

3131
## Current Support
3232

docs/concepts/managed-llms/openai-gateway.md renamed to docs/concepts/managed-llms/openai-access-gateway.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ sidebar_position: 3000
88

99
Defang makes it easy to deploy on your favourite cloud's managed LLM service with our [OpenAI Access Gateway](https://github.com/DefangLabs/openai-access-gateway). This service sits between your application and the cloud service and acts as a compatibility layer. It handles incoming OpenAI requests, translates those requests to the appropriate cloud-native API, handles the native response, and re-constructs an OpenAI-compatible response.
1010

11-
See [our tutorial](/docs/tutorials/deploying-openai-apps-aws-bedrock.mdx/) which describes how to configure the OpenAI Access Gateway for your application
11+
See [our tutorial](/docs/tutorials/deploying-openai-apps-aws-bedrock/) which describes how to configure the OpenAI Access Gateway for your application
1212

1313
## Current Support
1414

docs/providers/aws/aws.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ When using [Managed Postgres](/docs/concepts/managed-storage/managed-postgres.md
7272

7373
When using [Managed Redis](/docs/concepts/managed-storage/managed-redis.md), the Defang CLI provisions an ElastiCache Redis cluster in your account.
7474

75-
### Managed large language models
75+
### Managed LLMs
7676

7777
Defang offers integration with managed, cloud-native large language model services with the `x-defang-llm` service extension. Add this extension to any services which use the Bedrock SDKs.
7878

docs/providers/gcp.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ The Provider builds and deploys your services using [Google Cloud Run](https://c
5959

6060
The GCP provider does not currently support storing sensitive config values.
6161

62-
### Managed large language models
62+
### Managed LLMs
6363

6464
Defang offers integration with managed, cloud-native large language model services with the `x-defang-llm` service extension. Add this extension to any services which use the Bedrock SDKs.
6565

docs/providers/playground.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,6 @@ Overall, the Defang Playground is very similar to deploying to your own cloud ac
2020

2121
In essence, the Playground does not support any [managed storage](../concepts/managed-storage) services, ie. `x-defang-postgres` and `x-defang-redis` are ignored when deploying to the Playground. You can however run both Postgres and Redis as regular container services for testing purposes.
2222

23-
### Managed large language models
23+
### Managed LLMs
2424

2525
Defang offers integration with managed, cloud-native large language model services with the `x-defang-llm` service extension when deploying to your own cloud account with BYOC. This extension is not supported in the Defang Playground.
Lines changed: 24 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
---
2-
title: Deploying your OpenAI application to AWS and using Bedrock
2+
title: Deploying your OpenAI application to AWS using Bedrock
33
sidebar_position: 50
44
---
55

6-
# Deploying your OpenAI application to AWS and using Bedrock
6+
# Deploying your OpenAI application to AWS using Bedrock
77

88
Let's assume you have an app which is using one of the OpenAI client libraries and you want to deploy your app to AWS so you can leverage Bedrock. This tutorial will show you how Defang makes it easy.
99

@@ -15,19 +15,16 @@ services:
1515
build:
1616
context: .
1717
ports:
18-
- target: 3000
19-
published: 3000
20-
protocol: tcp
21-
mode: ingress
18+
- 3000:3000
2219
environment:
2320
OPENAI_API_KEY:
2421
healthcheck:
2522
test: ["CMD", "curl", "-f", "http://localhost:3000/"]
2623
```
2724
28-
## Add an llm service to your compose file
25+
## Add an LLM service to your compose file
2926
30-
The first step is to add a new service to your compose file. The `defangio/openai-access-gateway`. This service provides an OpenAI compatible interface to AWS Bedrock. It's easy to configure, first you need to add it to your compose file:
27+
The first step is to add a new service to your compose file: the `defangio/openai-access-gateway`. This service provides an OpenAI compatible interface to AWS Bedrock. It's easy to configure, first you need to add it to your compose file:
3128

3229
```diff
3330
+ llm:
@@ -36,15 +33,21 @@ The first step is to add a new service to your compose file. The `defangio/opena
3633
+ ports:
3734
+ - target: 80
3835
+ published: 80
39-
+ protocol: tcp
4036
+ mode: host
4137
+ environment:
4238
+ - OPENAI_API_KEY
43-
+ healthcheck:
44-
+ test: ["CMD", "curl", "-f", "http://localhost/health"]
4539
```
4640

47-
A few things to note here. First the image is a fork of [aws-samples/bedrock-access-gateway](https://github.com/aws-samples/bedrock-access-gateway), which a few modifications to make it easier to use. The source code is available [here](https://github.com/DefangLabs/openai-access-gateway). Second: the `x-defang-llm` property. Defang uses extensions like this to signal special handling of certain kinds of services. In this case, it signals to Defang that we need to configure the appropriate IAM Roles and Policies to support your application.
41+
A few things to note here. First the image is a fork of [aws-samples/bedrock-access-gateway](https://github.com/aws-samples/bedrock-access-gateway), with a few modifications to make it easier to use. The source code is available [here](https://github.com/DefangLabs/openai-access-gateway). Second: the `x-defang-llm` property. Defang uses extensions like this to signal special handling of certain kinds of services. In this case, it signals to Defang that we need to configure the appropriate IAM Roles and Policies to support your application.
42+
43+
:::warning
44+
**Your OpenAI key**
45+
46+
You no longer need to use your original OpenAI API key. We do recommend using _something_ in its place, but feel free to generate a new secret and set it with `defang config set OPENAI_API_KEY --random`.
47+
48+
This is used to authenticate your application service with the openai-access-gateway.
49+
:::
50+
4851

4952
## Redirecting application traffic
5053

@@ -54,30 +57,23 @@ Then you need to configure your application to redirect traffic to the openai-ac
5457
services:
5558
app:
5659
ports:
57-
- target: 3000
58-
published: 3000
59-
protocol: tcp
60-
mode: ingress
60+
- 3000:3000
6161
environment:
6262
OPENAI_API_KEY:
6363
+ OPENAI_BASE_URL: "http://llm/api/v1"
64-
+ MODEL: "anthropic.claude-3-sonnet-20240229-v1:0"
6564
healthcheck:
6665
test: ["CMD", "curl", "-f", "http://localhost:3000/"]
6766
```
6867

69-
You will also need to configure your application to use one of the bedrock models. We recommend configuring an environment variable called `MODEL` like this:
70-
7168
## Selecting a model
7269

70+
You will also need to configure your application to use one of the bedrock models. We recommend configuring an environment variable called `MODEL` like this:
71+
7372
```diff
7473
services:
7574
app:
7675
ports:
77-
- target: 3000
78-
published: 3000
79-
protocol: tcp
80-
mode: ingress
76+
- 3000:3000
8177
environment:
8278
OPENAI_API_KEY:
8379
OPENAI_BASE_URL: "http://llm/api/v1"
@@ -86,13 +82,11 @@ You will also need to configure your application to use one of the bedrock model
8682
test: ["CMD", "curl", "-f", "http://localhost:3000/"]
8783
```
8884

89-
## Enabling bedrock model access
85+
:::warning
86+
**Enabling bedrock model access**
9087

9188
AWS currently requires access to be manually configured on a per-model basis in each account. See this guide for [how to enable model access](https://docs.aws.amazon.com/bedrock/latest/userguide/model-access-modify.html).
92-
93-
## Your OpenAI key
94-
95-
It's worth noting that you no longer need ot use your original OpenAI API key. We do recommend using _something_ in its place, but feel free to generate a new secret and set it with `defang config set OPENAI_API_KEY`.
89+
:::
9690

9791
## Complete Example Compose File
9892

@@ -102,14 +96,11 @@ services:
10296
build:
10397
context: .
10498
ports:
105-
- target: 3000
106-
published: 3000
107-
protocol: tcp
108-
mode: ingress
99+
- 3000:3000
109100
environment:
110101
OPENAI_API_KEY:
111102
OPENAI_BASE_URL: "http://llm/api/v1"
112-
MODEL: "anthropic.claude-3-sonnet-20240229-v1:0"
103+
MODEL: "us:anthropic.claude-3-sonnet-20240229-v1:0"
113104
healthcheck:
114105
test: ["CMD", "curl", "-f", "http://localhost:3000/"]
115106
llm:
@@ -118,11 +109,8 @@ services:
118109
ports:
119110
- target: 80
120111
published: 80
121-
protocol: tcp
122112
mode: host
123113
environment:
124114
- OPENAI_API_KEY
125-
healthcheck:
126-
test: ["CMD", "curl", "-f", "http://localhost/health"]
127115
128116
```

0 commit comments

Comments
 (0)