Skip to content

Commit d5f93d0

Browse files
chore: upgrade Azure OpenAI embedding model to text-embedding-3-small (#2128)
1 parent f3dcdbf commit d5f93d0

File tree

23 files changed

+71
-69
lines changed

23 files changed

+71
-69
lines changed

.env.sample

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ AZURE_OPENAI_RESOURCE=
2727
AZURE_OPENAI_API_KEY=
2828
AZURE_OPENAI_MODEL=gpt-4o
2929
AZURE_OPENAI_MODEL_NAME=gpt-4o
30-
AZURE_OPENAI_EMBEDDING_MODEL=text-embedding-ada-002
30+
AZURE_OPENAI_EMBEDDING_MODEL=text-embedding-3-small
3131
AZURE_OPENAI_TEMPERATURE=0
3232
AZURE_OPENAI_TOP_P=1.0
3333
AZURE_OPENAI_MAX_TOKENS=1000

code/backend/batch/utilities/helpers/env_helper.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ def __load_config(self, **kwargs) -> None:
212212
else:
213213
# Otherwise, fallback to individual environment variable
214214
self.AZURE_OPENAI_EMBEDDING_MODEL = os.getenv(
215-
"AZURE_OPENAI_EMBEDDING_MODEL", "text-embedding-ada-002"
215+
"AZURE_OPENAI_EMBEDDING_MODEL", "text-embedding-3-small"
216216
)
217217

218218
self.SHOULD_STREAM = (

code/backend/batch/utilities/helpers/llm_helper.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,13 +103,15 @@ def get_embedding_model(self):
103103
azure_endpoint=self.env_helper.AZURE_OPENAI_ENDPOINT,
104104
api_key=self.env_helper.OPENAI_API_KEY,
105105
azure_deployment=self.embedding_model,
106+
model=self.embedding_model,
106107
dimensions=dimensions,
107108
chunk_size=1,
108109
)
109110
else:
110111
return AzureOpenAIEmbeddings(
111112
azure_endpoint=self.env_helper.AZURE_OPENAI_ENDPOINT,
112113
azure_deployment=self.embedding_model,
114+
model=self.embedding_model,
113115
dimensions=dimensions,
114116
chunk_size=1,
115117
azure_ad_token_provider=self.token_provider,

code/tests/functional/app_config.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ class AppConfig:
2323
"AZURE_FORM_RECOGNIZER_INFO": '{"endpoint":"some-key-vault-endpoint","key":"some-key-vault-endpoint"}',
2424
"AZURE_OPENAI_API_KEY": "some-azure-openai-api-key",
2525
"AZURE_OPENAI_API_VERSION": "2024-02-01",
26-
"AZURE_OPENAI_EMBEDDING_MODEL_INFO": '{"model":"some-embedding-model","modelName":"some-embedding-model-name","modelVersion":"some-embedding-model-version"}',
26+
"AZURE_OPENAI_EMBEDDING_MODEL_INFO": '{"model":"text-embedding-3-small","modelName":"text-embedding-3-small","modelVersion":"1"}',
2727
"AZURE_OPENAI_ENDPOINT": "some-openai-endpoint",
2828
"AZURE_OPENAI_MAX_TOKENS": "1000",
2929
"AZURE_OPENAI_MODEL_INFO": '{"model":"some-openai-model","modelName":"some-openai-model-name","modelVersion":"some-openai-model-version"}',

code/tests/functional/conftest.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ def setup_default_mocking(httpserver: HTTPServer, app_config: AppConfig):
3232
"index": 0,
3333
}
3434
],
35-
"model": "text-embedding-ada-002",
35+
"model": "text-embedding-3-small",
3636
}
3737
)
3838

code/tests/functional/tests/backend_api/default/test_conversation.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -131,8 +131,9 @@ def test_post_makes_correct_calls_to_openai_embeddings_to_get_vector_dimensions(
131131
method="POST",
132132
json={
133133
"input": [[1199]],
134-
"model": "text-embedding-ada-002",
134+
"model": "text-embedding-3-small",
135135
"encoding_format": "base64",
136+
"dimensions": 1536,
136137
},
137138
headers={
138139
"Accept": "application/json",
@@ -162,10 +163,9 @@ def test_post_makes_correct_calls_to_openai_embeddings_to_embed_question_to_sear
162163
"input": [
163164
[3923, 374, 279, 7438, 315, 2324, 30]
164165
], # Embedding of "What is the meaning of life?"
165-
"model": app_config.get_from_json(
166-
"AZURE_OPENAI_EMBEDDING_MODEL_INFO", "model"
167-
),
166+
"model": "text-embedding-3-small",
168167
"encoding_format": "base64",
168+
"dimensions": 1536,
169169
},
170170
headers={
171171
"Accept": "application/json",
@@ -174,7 +174,7 @@ def test_post_makes_correct_calls_to_openai_embeddings_to_embed_question_to_sear
174174
"Api-Key": app_config.get("AZURE_OPENAI_API_KEY"),
175175
},
176176
query_string="api-version=2024-02-01",
177-
times=1,
177+
times=2,
178178
),
179179
)
180180

@@ -197,8 +197,9 @@ def test_post_makes_correct_calls_to_openai_embeddings_to_embed_question_to_stor
197197
"input": [
198198
[3923, 374, 279, 7438, 315, 2324, 30]
199199
], # Embedding of "What is the meaning of life?"
200-
"model": "text-embedding-ada-002", # this is hard coded in the langchain code base
200+
"model": "text-embedding-3-small",
201201
"encoding_format": "base64",
202+
"dimensions": 1536,
202203
},
203204
headers={
204205
"Accept": "application/json",
@@ -207,7 +208,7 @@ def test_post_makes_correct_calls_to_openai_embeddings_to_embed_question_to_stor
207208
"Api-Key": app_config.get("AZURE_OPENAI_API_KEY"),
208209
},
209210
query_string="api-version=2024-02-01",
210-
times=1,
211+
times=2,
211212
),
212213
)
213214

code/tests/functional/tests/backend_api/sk_orchestrator/test_response_without_tool_call.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,9 @@ def test_post_makes_correct_call_to_openai_embeddings(
7171
"input": [
7272
[3923, 374, 279, 7438, 315, 2324, 30]
7373
], # Embedding of "What is the meaning of life?"
74-
"model": "text-embedding-ada-002",
74+
"model": "text-embedding-3-small",
7575
"encoding_format": "base64",
76+
"dimensions": 1536,
7677
},
7778
headers={
7879
"Accept": "application/json",

code/tests/functional/tests/functions/advanced_image_processing/test_advanced_image_processing.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,7 @@ def test_embeddings_generated_for_caption(
221221
"AZURE_OPENAI_EMBEDDING_MODEL_INFO", "model"
222222
),
223223
"encoding_format": "base64",
224+
"dimensions": 1536,
224225
},
225226
headers={
226227
"Accept": "application/json",

docs/LOCAL_DEPLOYMENT.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ Ensure you have access to an [Azure subscription](https://azure.microsoft.com/fr
7171
| **Model** | **Minimum Capacity** | **Recommended Capacity** |
7272
|-----------|---------------------|--------------------------|
7373
| **gpt-4.1** | 150k tokens | 200k tokens (for best performance) |
74-
| **text-embedding-ada-002** | 100k tokens | 150k tokens (for best performance) |
74+
| **text-embedding-3-small** | 100k tokens | 150k tokens (for best performance) |
7575

7676
> **Note:** When you run `azd up`, the deployment will automatically show you regions with available quota, so this pre-check is optional but helpful for planning purposes. You can customize these settings later in [Step 3.3: Advanced Configuration](#33-advanced-configuration-optional).
7777

docs/QuotaCheck.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ azd auth login
1212

1313
### 📌 Default Models & Capacities:
1414
```
15-
gpt4.1:150, text-embedding-ada-002:100
15+
gpt4.1:150, text-embedding-3-small:100
1616
```
1717
### 📌 Default Regions:
1818
```
@@ -38,7 +38,7 @@ australiaeast, eastus2, japaneast, uksouth
3838
```
3939
✔️ Check specific model(s) in default regions:
4040
```
41-
./quota_check_params.sh --models gpt4.1:150,text-embedding-ada-002:100
41+
./quota_check_params.sh --models gpt4.1:150,text-embedding-3-small:100
4242
```
4343
✔️ Check default models in specific region(s):
4444
```
@@ -50,7 +50,7 @@ australiaeast, eastus2, japaneast, uksouth
5050
```
5151
✔️ All parameters combined:
5252
```
53-
./quota_check_params.sh --models gpt4.1:150,text-embedding-ada-002:100 --regions eastus2,japaneast --verbose
53+
./quota_check_params.sh --models gpt4.1:150,text-embedding-3-small:100 --regions eastus2,japaneast --verbose
5454
```
5555

5656
### **Sample Output**

0 commit comments

Comments
 (0)