Skip to content

Commit 9db626a

Browse files
authored
Merge pull request #70 from diberry/infra/update-openai-models-tier
Update infra: gpt-4.1 models, AVM 0.10.0, tier comments
2 parents 2be3290 + 6719f92 commit 9db626a

11 files changed

Lines changed: 231 additions & 61 deletions

File tree

README.md

Lines changed: 65 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,59 @@ azd auth login
1919
azd up
2020
```
2121

22+
> [!TIP]
23+
> Set a custom admin password before provisioning: `azd env set DOCUMENTDB_ADMIN_PASSWORD '<your-secure-password>'`. If not set, a temporary default is used.
24+
2225
This command will:
2326
- Prompt you to create a new Azure environment
2427
- Provision all infrastructure resources in your Azure subscription
25-
- Generate a `.env` file in the root directory with all necessary connection strings and credentials
2628

29+
After provisioning, export all environment variables to a `.env` file:
30+
31+
```bash
32+
azd env get-values > .env
33+
```
34+
35+
#### Configure OpenAI Settings (Optional)
36+
37+
Before running `azd up`, you can customize the OpenAI deployment by setting environment variables. If not set, defaults are used.
38+
39+
```bash
40+
# Set OpenAI location (can differ from resource group location)
41+
azd env set AZURE_OPENAI_LOCATION eastus2
42+
43+
# Chat model configuration
44+
azd env set AZURE_OPENAI_CHAT_MODEL gpt-4.1-mini
45+
azd env set AZURE_OPENAI_CHAT_MODEL_VERSION 2025-04-14
46+
azd env set AZURE_OPENAI_CHAT_MODEL_TYPE Standard
47+
48+
# Synthesis model configuration
49+
azd env set AZURE_OPENAI_SYNTH_MODEL gpt-4.1
50+
azd env set AZURE_OPENAI_SYNTH_MODEL_VERSION 2025-04-14
51+
azd env set AZURE_OPENAI_SYNTH_MODEL_TYPE Standard
52+
53+
# Embedding model configuration
54+
azd env set AZURE_OPENAI_EMBEDDING_MODEL text-embedding-3-small
55+
azd env set AZURE_OPENAI_EMBEDDING_MODEL_VERSION 1
56+
azd env set AZURE_OPENAI_EMBEDDING_MODEL_TYPE Standard
57+
```
58+
59+
| Variable | Default | Description |
60+
|----------|---------|-------------|
61+
| `AZURE_OPENAI_LOCATION` | Same as `AZURE_LOCATION` | Region for OpenAI resources |
62+
| `AZURE_OPENAI_CHAT_MODEL` | `gpt-4.1-mini` | Chat completion model |
63+
| `AZURE_OPENAI_CHAT_MODEL_VERSION` | `2025-04-14` | Chat model version |
64+
| `AZURE_OPENAI_CHAT_MODEL_TYPE` | `Standard` | Deployment SKU (`Standard` or `GlobalStandard`) |
65+
| `AZURE_OPENAI_SYNTH_MODEL` | `gpt-4.1` | Data synthesis model |
66+
| `AZURE_OPENAI_SYNTH_MODEL_VERSION` | `2025-04-14` | Synthesis model version |
67+
| `AZURE_OPENAI_SYNTH_MODEL_TYPE` | `Standard` | Deployment SKU |
68+
| `AZURE_OPENAI_EMBEDDING_MODEL` | `text-embedding-3-small` | Embedding model |
69+
| `AZURE_OPENAI_EMBEDDING_MODEL_VERSION` | `1` | Embedding model version |
70+
| `AZURE_OPENAI_EMBEDDING_MODEL_TYPE` | `Standard` | Deployment SKU |
71+
72+
73+
> [!NOTE]
74+
> **Vector indexes can be created or dropped on existing collections at any time** — no special configuration is needed at resource creation.
2775
### 2. Navigate to Your Sample Language
2876

2977
Choose your preferred programming language and navigate to the sample directory:
@@ -63,6 +111,22 @@ Follow the language-specific instructions:
63111

64112
Each sample demonstrates how to generate embeddings, create vector indexes, and perform semantic similarity searches with hotel data.
65113

114+
## Troubleshooting
115+
116+
### Azure OpenAI provisioning fails
117+
118+
If `azd up` fails when creating the Azure OpenAI resource or model deployments, the issue is typically one of:
119+
120+
- **Region availability**: The selected model isn't available in your chosen region. Try a different `AZURE_OPENAI_LOCATION` (e.g., `eastus2`, `swedencentral`).
121+
- **SKU/tier mismatch**: The model doesn't support the selected deployment type. Switch between `Standard` and `GlobalStandard` using `azd env set AZURE_OPENAI_CHAT_MODEL_TYPE GlobalStandard`.
122+
- **Quota limits**: Your subscription has reached its quota for the selected model/region/tier combination. Check your quota in the Azure portal under **Azure OpenAI → Quotas**. You can request a quota increase or try a different region with available capacity.
123+
- **Model retired or unavailable**: Azure OpenAI periodically retires older model versions. If deployment fails because a model version is no longer available, update to a supported version (e.g., `azd env set AZURE_OPENAI_CHAT_MODEL_VERSION <new-version>`). See [Azure OpenAI model retirements](https://learn.microsoft.com/azure/ai-services/openai/concepts/model-retirements) for lifecycle status.
124+
125+
All OpenAI model parameters — region, model name, version, and deployment type (Standard/GlobalStandard) — are configurable via `azd env set` before running `azd up`. See [Configure OpenAI Settings](#configure-openai-settings-optional) above for the full list.
126+
127+
> [!TIP]
128+
> Run `azd env set AZURE_OPENAI_LOCATION <region>` to deploy OpenAI to a different region than your other resources. Check [model availability by region](https://learn.microsoft.com/azure/ai-services/openai/concepts/models#model-summary-table-and-region-availability) to find supported region/model/tier combinations.
129+
66130
## Cleanup
67131

68132
To delete all provisioned Azure resources:

ai/vector-search-agent-go/README.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,9 @@ flowchart LR
6969
- Stateless execution with no conversation history
7070
- Suitable for single-turn query/response scenarios
7171

72+
73+
> [!NOTE]
74+
> **Vector indexes can be created or dropped on existing collections at any time** — no special configuration is needed at resource creation.
7275
## Prerequisites
7376

7477
### Azure Resources
@@ -108,6 +111,25 @@ vector-search-agent-go/
108111
└── README.md
109112
```
110113

114+
## Deploy Azure resources
115+
116+
1. Provision and deploy the infrastructure:
117+
118+
```bash
119+
azd up
120+
```
121+
122+
1. When prompted, select your subscription and a location (for example, `swedencentral` or `eastus2`).
123+
124+
1. After deployment completes, generate your `.env` file from the deployed environment:
125+
126+
```bash
127+
azd env get-values > .env
128+
```
129+
130+
> [!TIP]
131+
> Run `azd env get-values` at any time to regenerate the `.env` file with current environment values.
132+
111133
## Installation
112134

113135
1. Clone the repository:

ai/vector-search-agent-typescript/README.md

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@ By the end, you have a working two-agent system that connects Azure OpenAI and A
2929
> [!NOTE]
3030
> **Cost considerations:** This quickstart creates Azure OpenAI and Azure DocumentDB resources that incur costs. See [Azure OpenAI pricing](https://azure.microsoft.com/pricing/details/cognitive-services/openai-service/) and [Azure DocumentDB pricing](https://azure.microsoft.com/pricing/details/cosmos-db/) for details.
3131
32+
33+
> [!NOTE]
34+
> **Vector indexes can be created or dropped on existing collections at any time** — no special configuration is needed at resource creation.
3235
## Prerequisites
3336

3437
You can use the Azure Developer CLI to create the required Azure resources by running the `azd` commands in the sample repository. For more information, see [Deploy Infrastructure with Azure Developer CLI](https://github.com/Azure-Samples/documentdb-samples/).
@@ -98,10 +101,14 @@ Use the Azure Developer CLI (`azd`) to provision the required Azure OpenAI and D
98101

99102
1. When prompted, select your subscription and a location (for example, `swedencentral` or `eastus2`).
100103

101-
1. After deployment completes, `azd` outputs the environment variables you need. Copy them into your `.env` file (see [Configure environment variables](#configure-environment-variables)).
104+
1. After deployment completes, generate your `.env` file from the deployed environment:
105+
106+
```bash
107+
azd env get-values > .env
108+
```
102109

103110
> [!TIP]
104-
> Run `azd env get-values` at any time to view the current environment values.
111+
> Run `azd env get-values > .env` at any time to regenerate the `.env` file with current environment values.
105112

106113
## Configure environment variables
107114

ai/vector-search-dotnet/README.md

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@ This .NET 8.0 sample application demonstrates vector similarity searches using A
2121
- Seamless integration with DocumentDB and Azure OpenAI services
2222
- Interactive menu-driven application
2323

24+
25+
> [!NOTE]
26+
> **Vector indexes can be created or dropped on existing collections at any time** — no special configuration is needed at resource creation.
2427
## Prerequisites
2528

2629
### Azure Services
@@ -50,7 +53,17 @@ cd ai/vector-search-dotnet
5053
az login
5154
```
5255

53-
3. Update `appsettings.json` with your Azure service details:
56+
3. Configure environment variables:
57+
58+
The .NET sample reads configuration from `appsettings.json` and environment variables. After deploying with `azd up`, you can view your provisioned resource values:
59+
60+
```bash
61+
azd env get-values
62+
```
63+
64+
Use these values to update `appsettings.json` or set them as environment variables.
65+
66+
4. Update `appsettings.json` with your Azure service details:
5467

5568
```json
5669
{
@@ -64,7 +77,7 @@ az login
6477
}
6578
```
6679

67-
4. Run the application:
80+
5. Run the application:
6881

6982
```bash
7083
dotnet restore

ai/vector-search-go/README.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ products:
1414

1515
This project demonstrates vector search capabilities using Azure DocumentDB with Go. It includes implementations of three different vector index types: DiskANN, HNSW, and IVF, along with utilities for embedding generation and data management.
1616

17+
18+
> [!NOTE]
19+
> **Vector indexes can be created or dropped on existing collections at any time** — no special configuration is needed at resource creation.
1720
## Overview
1821

1922
Vector search enables semantic similarity searching by converting text into high-dimensional vector representations (embeddings) and finding the most similar vectors in the database. This project shows how to:
@@ -116,6 +119,16 @@ az resource show \
116119

117120
### Step 4: Configure Environment Variables
118121

122+
If you deployed Azure resources with `azd up` (from the repository root), create a `.env` file with your provisioned resource values:
123+
124+
```bash
125+
azd env get-values > .env
126+
```
127+
128+
This creates a `.env` file with the connection strings and endpoints needed to run the sample.
129+
130+
Alternatively, you can configure the environment manually:
131+
119132
1. Copy the example environment file:
120133

121134
```bash

ai/vector-search-java/README.md

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ products:
1414

1515
This project demonstrates vector search capabilities using Azure DocumentDB with Java. It includes implementations of three different vector index types: DiskANN, HNSW, and IVF.
1616

17+
18+
> [!NOTE]
19+
> **Vector indexes can be created or dropped on existing collections at any time** — no special configuration is needed at resource creation.
1720
## Overview
1821

1922
Vector search enables semantic similarity searching by converting text into high-dimensional vector representations (embeddings) and finding the most similar vectors in the database. This project shows how to:
@@ -92,7 +95,16 @@ The `azd up` command will:
9295
- Deploy Azure DocumentDB (MongoDB vCore) cluster
9396
- Create a managed identity for secure access
9497
- Configure all necessary permissions and networking
95-
- Generate a `.env` file with all connection information at the repository root
98+
99+
### Configure environment variables
100+
101+
After deploying with `azd up`, create a `.env` file with your provisioned resource values:
102+
103+
```bash
104+
azd env get-values > .env
105+
```
106+
107+
This creates a `.env` file at the repository root with the connection strings and endpoints needed to run the sample.
96108

97109
### Compile the Project
98110

@@ -106,7 +118,7 @@ mvn clean compile
106118

107119
### Load Environment Variables
108120

109-
After deployment completes, load the environment variables from the generated `.env` file. The `set -a` command ensures variables are exported to child processes (like the Maven JVM):
121+
Load the environment variables from the `.env` file. The `set -a` command ensures variables are exported to child processes (like the Maven JVM):
110122

111123
```bash
112124
# From the ai/vector-search-java directory

ai/vector-search-python/README.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ products:
1414

1515
This project demonstrates vector search capabilities using Azure DocumentDB with Python. It includes implementations of three different vector index types: DiskANN, HNSW, and IVF, along with utilities for embedding generation and data management.
1616

17+
18+
> [!NOTE]
19+
> **Vector indexes can be created or dropped on existing collections at any time** — no special configuration is needed at resource creation.
1720
## Overview
1821

1922
Vector search enables semantic similarity searching by converting text into high-dimensional vector representations (embeddings) and finding the most similar vectors in the database. This project shows how to:
@@ -93,6 +96,16 @@ Learn how to create an Azure DocumentDB account in the [official documentation](
9396

9497
### Step 3: Configure Environment Variables
9598

99+
If you deployed Azure resources with `azd up` (from the repository root), create a `.env` file with your provisioned resource values:
100+
101+
```bash
102+
azd env get-values > .env
103+
```
104+
105+
This creates a `.env` file with the connection strings and endpoints needed to run the sample.
106+
107+
Alternatively, you can configure the environment manually:
108+
96109
1. Copy the example environment file:
97110
```bash
98111
cp .env.example .env

ai/vector-search-typescript/README.md

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ products:
1414

1515
This project demonstrates vector search capabilities using Azure DocumentDB with TypeScript/Node.js. It includes implementations of three different vector index types: DiskANN, HNSW, and IVF, along with utilities for embedding generation and data management.
1616

17+
18+
> [!NOTE]
19+
> **Vector indexes can be created or dropped on existing collections at any time** — no special configuration is needed at resource creation.
1720
## Overview
1821

1922
Vector search enables semantic similarity searching by converting text into high-dimensional vector representations (embeddings) and finding the most similar vectors in the database. This project shows how to:
@@ -92,8 +95,16 @@ The `azd provision` command will:
9295
- Deploy Azure DocumentDB (MongoDB vCore) cluster
9396
- Create a managed identity for secure access
9497
- Configure all necessary permissions and networking
95-
- Generate a `.env` file with all connection information at the root
9698

99+
### Configure environment variables
100+
101+
After deploying with `azd up`, create a `.env` file with your provisioned resource values:
102+
103+
```bash
104+
azd env get-values > .env
105+
```
106+
107+
This creates a `.env` file at the repository root with the connection strings and endpoints needed to run the sample.
97108

98109
### Install dependencies
99110

@@ -105,20 +116,6 @@ cd ai/vector-search-typescript
105116
npm install
106117
```
107118

108-
### Verify Environment Configuration
109-
110-
After deployment completes, verify that the `.env` file was created in the repository root:
111-
112-
```bash
113-
# View the generated environment variables
114-
cat ../../.env
115-
```
116-
117-
The file should contain all necessary configuration including:
118-
- Azure OpenAI endpoint and model information
119-
- DocumentDB cluster name and database settings
120-
- Embedding and data processing configuration
121-
122119
## Build
123120

124121
Compile the TypeScript code before running:

azure.yaml

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2,23 +2,4 @@ name: documentdb-samples
22

33
services:
44

5-
hooks:
6-
postprovision:
7-
posix:
8-
sh: bash
9-
run: |
10-
# Get environment values for the application
11-
azd env get-values > .env
12-
echo "Environment configured. Data will be loaded after deployment."
13-
windows:
14-
shell: pwsh
15-
run: |
16-
azd env get-values > .env
17-
Write-Host "Environment configured. Data will be loaded after deployment."
18-
postdown:
19-
windows:
20-
shell: pwsh
21-
run: "if (Test-Path .env) { rm .env }"
22-
posix:
23-
shell: sh
24-
run: "[ -f .env ] && rm .env || true"
5+

0 commit comments

Comments
 (0)