Skip to content

Commit cec256c

Browse files
Copilotowndev
andcommitted
Fix Azure Search validation errors by removing unsupported fields
Co-authored-by: owndev <69784886+owndev@users.noreply.github.com>
1 parent 5657980 commit cec256c

2 files changed

Lines changed: 33 additions & 57 deletions

File tree

docs/azure-ai-integration.md

Lines changed: 32 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,6 @@ AZURE_SEARCH_ENDPOINT="https://your-search-service.search.windows.net"
5555
# Azure Search index name containing the documents
5656
AZURE_SEARCH_INDEX_NAME="your-index-name"
5757

58-
# Azure Search project resource ID (optional)
59-
AZURE_SEARCH_PROJECT_RESOURCE_ID="your-project-resource-id"
60-
6158
# Azure Search API key (if using api_key authentication)
6259
AZURE_SEARCH_KEY="your-search-api-key"
6360

@@ -67,12 +64,6 @@ AZURE_SEARCH_AUTHENTICATION_TYPE="system_assigned_managed_identity"
6764
# Semantic configuration name for Azure Search
6865
AZURE_SEARCH_SEMANTIC_CONFIGURATION="azureml-default"
6966

70-
# Azure Search embedding endpoint (optional)
71-
AZURE_SEARCH_EMBEDDING_ENDPOINT="your-embedding-endpoint"
72-
73-
# Azure Search embedding API key (optional)
74-
AZURE_SEARCH_EMBEDDING_KEY="your-embedding-key"
75-
7667
# Query type for Azure Search
7768
AZURE_SEARCH_QUERY_TYPE="vectorSimpleHybrid"
7869

@@ -104,15 +95,43 @@ Configure Azure Search by setting the following environment variables:
10495

10596
#### Optional Settings:
10697

107-
- **AZURE_SEARCH_PROJECT_RESOURCE_ID**: Project resource ID
10898
- **AZURE_SEARCH_SEMANTIC_CONFIGURATION**: Semantic configuration name
109-
- **AZURE_SEARCH_EMBEDDING_ENDPOINT**: Embedding service endpoint
110-
- **AZURE_SEARCH_EMBEDDING_KEY**: Embedding service API key
11199
- **AZURE_SEARCH_QUERY_TYPE**: Query type (`vectorSimpleHybrid`, `vector`, `semantic`)
112100
- **AZURE_SEARCH_IN_SCOPE**: Limit to indexed documents only
113101
- **AZURE_SEARCH_ROLE_INFORMATION**: Role information for responses
114102
- **AZURE_SEARCH_STRICTNESS**: Strictness level (1-5)
115-
- **AZURE_SEARCH_TOP_N_DOCUMENTS**: Number of documents to retrieve
103+
- **AZURE_SEARCH_TOP_N_DOCUMENTS**: Number of documents to retrieve
104+
105+
#### Example Generated Data Sources Configuration:
106+
107+
When Azure Search is configured, requests to Azure AI will automatically include:
108+
109+
```json
110+
{
111+
"model": "gpt-4o",
112+
"messages": [...],
113+
"data_sources": [
114+
{
115+
"type": "azure_search",
116+
"parameters": {
117+
"filter": null,
118+
"endpoint": "https://your-search-service.search.windows.net",
119+
"index_name": "your-index-name",
120+
"authentication": {
121+
"type": "system_assigned_managed_identity",
122+
"key": null
123+
},
124+
"query_type": "vectorSimpleHybrid",
125+
"in_scope": false,
126+
"role_information": "You are an AI assistant.",
127+
"strictness": 5,
128+
"top_n_documents": 20,
129+
"semantic_configuration": "azureml-default"
130+
}
131+
}
132+
]
133+
}
134+
```
116135

117136
> [!TIP]
118137
> To use **Azure OpenAI** and other **Azure AI** models **simultaneously**, you can use the following URL: `https://<your project>.services.ai.azure.com/models/chat/completions?api-version=2024-05-01-preview`

pipelines/azure/azure_ai_foundry.py

Lines changed: 1 addition & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -187,11 +187,6 @@ class Valves(BaseModel):
187187
description="Azure Search index name for RAG",
188188
)
189189

190-
AZURE_SEARCH_PROJECT_RESOURCE_ID: str = Field(
191-
default=os.getenv("AZURE_SEARCH_PROJECT_RESOURCE_ID", ""),
192-
description="Azure Search project resource ID",
193-
)
194-
195190
AZURE_SEARCH_KEY: EncryptedStr = Field(
196191
default=os.getenv("AZURE_SEARCH_KEY", ""),
197192
description="Azure Search API key",
@@ -209,16 +204,6 @@ class Valves(BaseModel):
209204
description="Azure Search semantic configuration name",
210205
)
211206

212-
AZURE_SEARCH_EMBEDDING_ENDPOINT: str = Field(
213-
default=os.getenv("AZURE_SEARCH_EMBEDDING_ENDPOINT", ""),
214-
description="Azure Search embedding endpoint URL",
215-
)
216-
217-
AZURE_SEARCH_EMBEDDING_KEY: EncryptedStr = Field(
218-
default=os.getenv("AZURE_SEARCH_EMBEDDING_KEY", ""),
219-
description="Azure Search embedding API key",
220-
)
221-
222207
AZURE_SEARCH_QUERY_TYPE: str = Field(
223208
default=os.getenv("AZURE_SEARCH_QUERY_TYPE", "vectorSimpleHybrid"),
224209
description="Azure Search query type (vectorSimpleHybrid, vector, semantic)",
@@ -339,7 +324,7 @@ def get_azure_search_data_sources(self) -> Optional[List[Dict[str, Any]]]:
339324
):
340325
auth_config["key"] = self.valves.AZURE_SEARCH_KEY.get_decrypted()
341326

342-
# Build the data source configuration
327+
# Build the data source configuration with only officially supported parameters
343328
data_source = {
344329
"type": "azure_search",
345330
"parameters": {
@@ -355,40 +340,12 @@ def get_azure_search_data_sources(self) -> Optional[List[Dict[str, Any]]]:
355340
},
356341
}
357342

358-
# Add optional project resource ID if configured
359-
if self.valves.AZURE_SEARCH_PROJECT_RESOURCE_ID:
360-
data_source["parameters"]["project_resource_id"] = (
361-
self.valves.AZURE_SEARCH_PROJECT_RESOURCE_ID
362-
)
363-
364343
# Add semantic configuration if configured
365344
if self.valves.AZURE_SEARCH_SEMANTIC_CONFIGURATION:
366345
data_source["parameters"]["semantic_configuration"] = (
367346
self.valves.AZURE_SEARCH_SEMANTIC_CONFIGURATION
368347
)
369348

370-
# Add embedding configuration if configured
371-
if self.valves.AZURE_SEARCH_EMBEDDING_ENDPOINT:
372-
data_source["parameters"]["embeddingEndpoint"] = (
373-
self.valves.AZURE_SEARCH_EMBEDDING_ENDPOINT
374-
)
375-
data_source["parameters"]["embedding_dependency"] = None
376-
377-
if self.valves.AZURE_SEARCH_EMBEDDING_KEY:
378-
data_source["parameters"]["embeddingKey"] = (
379-
self.valves.AZURE_SEARCH_EMBEDDING_KEY.get_decrypted()
380-
)
381-
382-
# Add additional Azure Search parameters if using API key
383-
if (
384-
self.valves.AZURE_SEARCH_AUTHENTICATION_TYPE == "api_key"
385-
and self.valves.AZURE_SEARCH_KEY
386-
):
387-
data_source["parameters"]["key"] = (
388-
self.valves.AZURE_SEARCH_KEY.get_decrypted()
389-
)
390-
data_source["parameters"]["indexName"] = self.valves.AZURE_SEARCH_INDEX_NAME
391-
392349
return [data_source]
393350

394351
def parse_models(self, models_str: str) -> List[str]:

0 commit comments

Comments
 (0)