Skip to content

Commit 99aaf96

Browse files
Priyanka-MicrosoftRoopan-MicrosoftAjitPadhi-MicrosoftPavan-Microsoftross-p-smith
authored
fix: merging dev changes to main (#2068)
Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: Roopan-Microsoft <168007406+Roopan-Microsoft@users.noreply.github.com> Co-authored-by: Ajit Padhi <v-padhiajit@microsoft.com> Co-authored-by: Roopan P M <v-roopanpm@microsoft.com> Co-authored-by: Pavan-Microsoft <v-kupavan@microsoft.com> Co-authored-by: Ross Smith <ross-p-smith@users.noreply.github.com> Co-authored-by: gpickett <122489228+gpickett@users.noreply.github.com> Co-authored-by: Francia Riesco <friesco@microsoft.com> Co-authored-by: Francia Riesco <Fr4nc3@users.noreply.github.com> Co-authored-by: Prajwal D C <v-dcprajwal@microsoft.com> Co-authored-by: Harmanpreet-Microsoft <v-harmanprka@microsoft.com> Co-authored-by: UtkarshMishra-Microsoft <v-utkamishra@microsoft.com> Co-authored-by: Prasanjeet-Microsoft <v-singhprasa@microsoft.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Kiran-Siluveru-Microsoft <v-ksiluveru@microsoft.com> Co-authored-by: Prashant-Microsoft <v-pmalusare@microsoft.com> Co-authored-by: Rohini-Microsoft <v-rwalunj@microsoft.com> Co-authored-by: Avijit-Microsoft <v-aghorui@microsoft.com> Co-authored-by: RaviKiran-Microsoft <v-ravikirans@microsoft.com> Co-authored-by: Somesh Joshi <v-somejoshi@microsoft.com> Co-authored-by: Himanshi Agrawal <v-himagrawal@microsoft.com> Co-authored-by: pradeepjha-microsoft <v-pradeepjha@microsoft.com> Co-authored-by: Harmanpreet Kaur <v-harmanpkau@microsoft.com> Co-authored-by: Bangarraju-Microsoft <v-golib@microsoft.com> Co-authored-by: Harsh-Microsoft <v-hbangera@microsoft.com> Co-authored-by: Kanchan-Microsoft <v-knagshetti@microsoft.com> Co-authored-by: Cristopher Coronado <cristofima@hotmail.com> Co-authored-by: Cristopher Coronado Moreira <crcorona@pichincha.com> Co-authored-by: Vamshi-Microsoft <v-vamolla@microsoft.com> Co-authored-by: Thanusree-Microsoft <168087422+Thanusree-Microsoft@users.noreply.github.com> Co-authored-by: Niraj Chaudhari (Persistent Systems Inc) <v-nirajcha@microsoft.com> Co-authored-by: Rohini-Microsoft <168007985+Rohini-Microsoft@users.noreply.github.com> Co-authored-by: Kingshuk-Microsoft <v-kidatta@microsoft.com> Co-authored-by: Ayaz-Microsoft <v-ayazkhan@microsoft.com> Co-authored-by: Abdul-Microsoft <v-amujeebta@microsoft.com> Co-authored-by: Prekshith-Microsoft <v-pdj@microsoft.com> Co-authored-by: Rafi-Microsoft <v-rafmd@microsoft.com>
1 parent 4e88232 commit 99aaf96

File tree

12 files changed

+210
-231
lines changed

12 files changed

+210
-231
lines changed

.github/workflows/broken-links-checker.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ jobs:
3535
uses: lycheeverse/lychee-action@v2.7.0
3636
with:
3737
args: >
38-
--verbose --exclude-mail --no-progress --exclude ^https?://
38+
--verbose --no-progress --exclude ^https?://
3939
${{ steps.changed-markdown-files.outputs.all_changed_files }}
4040
failIfEmpty: false
4141
env:
@@ -48,7 +48,7 @@ jobs:
4848
uses: lycheeverse/lychee-action@v2.7.0
4949
with:
5050
args: >
51-
--verbose --exclude-mail --no-progress --exclude ^https?://
51+
--verbose --no-progress --exclude ^https?://
5252
'**/*.md'
5353
failIfEmpty: false
5454
env:

azure.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ services:
5656
prepackage:
5757
windows:
5858
shell: pwsh
59-
run: poetry export -o requirements.txt; pip install -r requirements.txt
59+
run: poetry export -o requirements.txt --without-hashes; pip install -r requirements.txt
6060
posix:
6161
shell: sh
62-
run: poetry export -o requirements.txt; pip install -r requirements.txt
62+
run: poetry export -o requirements.txt --without-hashes; pip install -r requirements.txt

code/backend/batch/host.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,6 @@
1010
},
1111
"extensionBundle": {
1212
"id": "Microsoft.Azure.Functions.ExtensionBundle",
13-
"version": "[3.*, 4.0.0)"
13+
"version": "[4.*, 5.0.0)"
1414
}
15-
}
15+
}

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

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,26 +91,44 @@ def get_streaming_llm(self):
9191
)
9292

9393
def get_embedding_model(self):
94+
# Only pass dimensions for models that support it (text-embedding-3-*)
95+
# text-embedding-ada-002 does NOT support the dimensions parameter
96+
supports_dimensions = "text-embedding-3" in self.embedding_model.lower()
97+
dimensions = None
98+
if supports_dimensions and self.env_helper.AZURE_SEARCH_DIMENSIONS:
99+
dimensions = int(self.env_helper.AZURE_SEARCH_DIMENSIONS)
100+
94101
if self.auth_type_keys:
95102
return AzureOpenAIEmbeddings(
96103
azure_endpoint=self.env_helper.AZURE_OPENAI_ENDPOINT,
97104
api_key=self.env_helper.OPENAI_API_KEY,
98105
azure_deployment=self.embedding_model,
106+
dimensions=dimensions,
99107
chunk_size=1,
100108
)
101109
else:
102110
return AzureOpenAIEmbeddings(
103111
azure_endpoint=self.env_helper.AZURE_OPENAI_ENDPOINT,
104112
azure_deployment=self.embedding_model,
113+
dimensions=dimensions,
105114
chunk_size=1,
106115
azure_ad_token_provider=self.token_provider,
107116
)
108117

109118
def generate_embeddings(self, input: Union[str, list[int]]) -> List[float]:
119+
# Only pass dimensions for models that support it (text-embedding-3-*)
120+
# text-embedding-ada-002 does NOT support the dimensions parameter
121+
supports_dimensions = "text-embedding-3" in self.embedding_model.lower()
122+
dimensions = None
123+
if supports_dimensions and self.env_helper.AZURE_SEARCH_DIMENSIONS:
124+
dimensions = int(self.env_helper.AZURE_SEARCH_DIMENSIONS)
125+
126+
kwargs = {"input": [input], "model": self.embedding_model}
127+
if dimensions is not None:
128+
kwargs["dimensions"] = dimensions
129+
110130
return (
111-
self.openai_client.embeddings.create(
112-
input=[input], model=self.embedding_model
113-
)
131+
self.openai_client.embeddings.create(**kwargs)
114132
.data[0]
115133
.embedding
116134
)

code/tests/functional/app_config.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ class AppConfig:
3838
"AZURE_SEARCH_CONVERSATIONS_LOG_INDEX": "some-log-index",
3939
"AZURE_SEARCH_CONTENT_COLUMN": "content",
4040
"AZURE_SEARCH_CONTENT_VECTOR_COLUMN": "some-search-content-vector-columns",
41-
"AZURE_SEARCH_DIMENSIONS": "some-search-dimensions",
41+
"AZURE_SEARCH_DIMENSIONS": "1536",
4242
"AZURE_SEARCH_ENABLE_IN_DOMAIN": "True",
4343
"AZURE_SEARCH_FIELDS_ID": "some-search-fields-id",
4444
"AZURE_SEARCH_FIELDS_METADATA": "some-search-fields-metadata",

code/tests/utilities/helpers/test_llm_helper.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@
2020
PROMPT_FLOW_DEPLOYMENT_NAME = "mock-deployment-name"
2121

2222

23+
AZURE_SEARCH_DIMENSIONS = "1536"
24+
25+
2326
@pytest.fixture(autouse=True)
2427
def env_helper_mock():
2528
with patch("backend.batch.utilities.helpers.llm_helper.EnvHelper") as mock:
@@ -36,6 +39,7 @@ def env_helper_mock():
3639
env_helper.AZURE_ML_WORKSPACE_NAME = AZURE_ML_WORKSPACE_NAME
3740
env_helper.PROMPT_FLOW_ENDPOINT_NAME = PROMPT_FLOW_ENDPOINT_NAME
3841
env_helper.PROMPT_FLOW_DEPLOYMENT_NAME = PROMPT_FLOW_DEPLOYMENT_NAME
42+
env_helper.AZURE_SEARCH_DIMENSIONS = AZURE_SEARCH_DIMENSIONS
3943

4044
yield env_helper
4145

docs/customizing_azd_parameters.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ By default this template will use the environment name as the prefix to prevent
4242
| `AZURE_OPENAI_EMBEDDING_MODEL_NAME` | string | `text-embedding-ada-002` | Actual embedding model name |
4343
| `AZURE_OPENAI_EMBEDDING_MODEL_VERSION` | string | `2` | Embedding model version |
4444
| `AZURE_OPENAI_EMBEDDING_MODEL_CAPACITY` | integer | `100` | Embedding model capacity (TPM in thousands) |
45+
| `AZURE_SEARCH_DIMENSIONS` | integer | `1536` | Azure Search vector dimensions(Update dimensions for CosmosDB) |
4546
| `USE_ADVANCED_IMAGE_PROCESSING` | boolean | `false` | Enable vision LLM and Computer Vision for images (must be false for PostgreSQL) |
4647
| `ADVANCED_IMAGE_PROCESSING_MAX_IMAGES` | integer | `1` | Maximum images per vision model request |
4748
| `AZURE_OPENAI_VISION_MODEL` | string | `gpt-4.1` | Vision model deployment name |
@@ -90,5 +91,6 @@ azd env set AZURE_OPENAI_EMBEDDING_MODEL_CAPACITY 150
9091
- `AZURE_SEARCH_USE_INTEGRATED_VECTORIZATION=false`
9192
- `USE_ADVANCED_IMAGE_PROCESSING=false`
9293
- `ORCHESTRATION_STRATEGY=semantic_kernel` (recommended)
94+
- `AZURE_SEARCH_DIMENSIONS=1536` (recommended)
9395

9496
2. **Region Compatibility**: Not all services are available in all regions. Verify service availability in your chosen region before deployment.

infra/main.bicep

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -150,18 +150,6 @@ param useAdvancedImageProcessing bool = false
150150
@description('Optional. The maximum number of images to pass to the vision model in a single request.')
151151
param advancedImageProcessingMaxImages int = 1
152152

153-
@description('Optional. Azure OpenAI Vision Model Deployment Name.')
154-
param azureOpenAIVisionModel string = 'gpt-4.1'
155-
156-
@description('Optional. Azure OpenAI Vision Model Name.')
157-
param azureOpenAIVisionModelName string = 'gpt-4.1'
158-
159-
@description('Optional. Azure OpenAI Vision Model Version.')
160-
param azureOpenAIVisionModelVersion string = '2025-04-14'
161-
162-
@description('Optional. Azure OpenAI Vision Model Capacity - See here for more info https://learn.microsoft.com/en-us/azure/ai-services/openai/how-to/quota.')
163-
param azureOpenAIVisionModelCapacity int = 10
164-
165153
@description('Optional. Orchestration strategy: openai_function or semantic_kernel or langchain str. If you use a old version of turbo (0301), please select langchain. If the database type is PostgreSQL, set this to sementic_kernel.')
166154
@allowed([
167155
'openai_function'
@@ -210,6 +198,9 @@ param azureOpenAIEmbeddingModelVersion string = '2'
210198
@description('Optional. Azure OpenAI Embedding Model Capacity - See here for more info https://learn.microsoft.com/en-us/azure/ai-services/openai/how-to/quota .')
211199
param azureOpenAIEmbeddingModelCapacity int = 100
212200

201+
@description('Optional. Azure Search vector field dimensions. Must match the embedding model dimensions. 1536 for text-embedding-ada-002, 3072 for text-embedding-3-large. See https://learn.microsoft.com/en-us/azure/search/cognitive-search-skill-azure-openai-embedding#supported-dimensions-by-modelname.(Only for databaseType=CosmosDB)')
202+
param azureSearchDimensions string = '1536'
203+
213204
@description('Optional. Name of Computer Vision Resource (if useAdvancedImageProcessing=true).')
214205
var computerVisionName string = 'cv-${solutionSuffix}'
215206

@@ -858,7 +849,7 @@ module pgSqlDelayScript 'br/public:avm/res/resources/deployment-script:0.5.1' =
858849
tags: tags
859850
kind: 'AzurePowerShell'
860851
enableTelemetry: enableTelemetry
861-
scriptContent: 'start-sleep -Seconds 300'
852+
scriptContent: 'start-sleep -Seconds 600'
862853
azPowerShellVersion: '11.0'
863854
timeout: 'PT15M'
864855
cleanupPreference: 'Always'
@@ -1285,6 +1276,7 @@ module web 'modules/app/web.bicep' = {
12851276
MANAGED_IDENTITY_RESOURCE_ID: managedIdentityModule.outputs.resourceId
12861277
AZURE_CLIENT_ID: managedIdentityModule.outputs.clientId // Required so LangChain AzureSearch vector store authenticates with this user-assigned managed identity
12871278
APP_ENV: appEnvironment
1279+
AZURE_SEARCH_DIMENSIONS: azureSearchDimensions
12881280
},
12891281
databaseType == 'CosmosDB'
12901282
? {
@@ -1383,6 +1375,7 @@ module adminweb 'modules/app/adminweb.bicep' = {
13831375
MANAGED_IDENTITY_CLIENT_ID: managedIdentityModule.outputs.clientId
13841376
MANAGED_IDENTITY_RESOURCE_ID: managedIdentityModule.outputs.resourceId
13851377
APP_ENV: appEnvironment
1378+
AZURE_SEARCH_DIMENSIONS: azureSearchDimensions
13861379
},
13871380
databaseType == 'CosmosDB'
13881381
? {
@@ -1482,6 +1475,7 @@ module function 'modules/app/function.bicep' = {
14821475
AZURE_CLIENT_ID: managedIdentityModule.outputs.clientId // Required so LangChain AzureSearch vector store authenticates with this user-assigned managed identity
14831476
APP_ENV: appEnvironment
14841477
BACKEND_URL: backendUrl
1478+
AZURE_SEARCH_DIMENSIONS: azureSearchDimensions
14851479
},
14861480
databaseType == 'CosmosDB'
14871481
? {

0 commit comments

Comments
 (0)