@@ -187,6 +187,11 @@ 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+
190195 AZURE_SEARCH_KEY : EncryptedStr = Field (
191196 default = os .getenv ("AZURE_SEARCH_KEY" , "" ),
192197 description = "Azure Search API key" ,
@@ -204,6 +209,16 @@ class Valves(BaseModel):
204209 description = "Azure Search semantic configuration name" ,
205210 )
206211
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+
207222 AZURE_SEARCH_QUERY_TYPE : str = Field (
208223 default = os .getenv ("AZURE_SEARCH_QUERY_TYPE" , "vectorSimpleHybrid" ),
209224 description = "Azure Search query type (vectorSimpleHybrid, vector, semantic)" ,
@@ -324,7 +339,7 @@ def get_azure_search_data_sources(self) -> Optional[List[Dict[str, Any]]]:
324339 ):
325340 auth_config ["key" ] = self .valves .AZURE_SEARCH_KEY .get_decrypted ()
326341
327- # Build the data source configuration with only officially supported parameters
342+ # Build the data source configuration
328343 data_source = {
329344 "type" : "azure_search" ,
330345 "parameters" : {
@@ -340,12 +355,40 @@ def get_azure_search_data_sources(self) -> Optional[List[Dict[str, Any]]]:
340355 },
341356 }
342357
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+
343364 # Add semantic configuration if configured
344365 if self .valves .AZURE_SEARCH_SEMANTIC_CONFIGURATION :
345366 data_source ["parameters" ]["semantic_configuration" ] = (
346367 self .valves .AZURE_SEARCH_SEMANTIC_CONFIGURATION
347368 )
348369
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+
349392 return [data_source ]
350393
351394 def parse_models (self , models_str : str ) -> List [str ]:
0 commit comments