From 4fd40d718df32aaae62341b429cb87640c388f22 Mon Sep 17 00:00:00 2001 From: Ciprian Jichici Date: Sun, 28 Jul 2024 04:30:04 +0300 Subject: [PATCH] Refactor settings management --- src/dotnet/Common/Common.csproj | 9 + .../AppConfigurationKeyFilters.cs | 296 ++++++++++++++++++ .../AppConfigurationKeyFilters.tt | 43 +++ .../AppConfigurationKeySections.cs | 18 ++ .../Configuration/AppConfigurationKeys.cs | 4 + .../Configuration/AppConfigurationKeysOld.cs | 146 --------- .../Configuration/DependencyInjectionKeys.cs | 42 +++ .../DependencyInjectionKeysOld.cs | 58 ---- .../Constants/Data/AppConfiguration.json | 44 ++- src/dotnet/CoreAPI/Program.cs | 16 +- src/dotnet/CoreWorker/Program.cs | 4 +- src/dotnet/GatekeeperAPI/Program.cs | 6 +- src/dotnet/GatewayAPI/Program.cs | 3 +- src/dotnet/GatewayAdapterAPI/Program.cs | 3 +- src/dotnet/ManagementAPI/Program.cs | 27 +- src/dotnet/OrchestrationAPI/Program.cs | 24 +- src/dotnet/SemanticKernelAPI/Program.cs | 5 +- src/dotnet/StateAPI/Program.cs | 3 +- .../Services/Text/IndexingServiceFactory.cs | 6 +- .../Text/TextEmbeddingServiceFactory.cs | 2 +- .../BlobStorageVectorizationStateService.cs | 2 +- src/dotnet/VectorizationAPI/Program.cs | 21 +- src/dotnet/VectorizationWorker/Program.cs | 30 +- .../dotnet/Core.Examples/Setup/TestFixture.cs | 13 +- .../Setup/TestServicesInitializer.cs | 2 +- 25 files changed, 528 insertions(+), 299 deletions(-) create mode 100644 src/dotnet/Common/Constants/Configuration/AppConfigurationKeyFilters.cs create mode 100644 src/dotnet/Common/Constants/Configuration/AppConfigurationKeyFilters.tt delete mode 100644 src/dotnet/Common/Constants/Configuration/AppConfigurationKeysOld.cs delete mode 100644 src/dotnet/Common/Constants/Configuration/DependencyInjectionKeysOld.cs diff --git a/src/dotnet/Common/Common.csproj b/src/dotnet/Common/Common.csproj index 7807820005..8a529339a8 100644 --- a/src/dotnet/Common/Common.csproj +++ b/src/dotnet/Common/Common.csproj @@ -55,6 +55,10 @@ TextTemplatingFileGenerator RoleDefinitionNames.cs + + AppConfigurationKeyFilters.cs + TextTemplatingFileGenerator + AppConfigurationKeySections.cs TextTemplatingFileGenerator @@ -129,6 +133,11 @@ True RoleDefinitionNames.tt + + AppConfigurationKeyFilters.tt + True + True + AppConfigurationKeySections.tt True diff --git a/src/dotnet/Common/Constants/Configuration/AppConfigurationKeyFilters.cs b/src/dotnet/Common/Constants/Configuration/AppConfigurationKeyFilters.cs new file mode 100644 index 0000000000..1567fd134d --- /dev/null +++ b/src/dotnet/Common/Constants/Configuration/AppConfigurationKeyFilters.cs @@ -0,0 +1,296 @@ +namespace FoundationaLLM.Common.Constants.Configuration +{ + /// + /// Defines all configuration section filters used to select subsets of configuration settings. + /// + public static partial class AppConfigurationKeyFilters + { + /// + /// Filter for the configuration section used to identify the settings related to the FoundationaLLM instance. + /// + public const string FoundationaLLM_Instance = + "FoundationaLLM:Instance:*"; + + /// + /// Filter for the configuration section used to identify the Azure Key Vault settings related to the FoundationaLLM instance. + /// + public const string FoundationaLLM_Configuration = + "FoundationaLLM:Configuration:*"; + + /// + /// Filter for the configuration section used to identify the storage settings for the FoundationaLLM.AIModel resource provider. + /// + public const string FoundationaLLM_ResourceProviders_AIModel_Storage = + "FoundationaLLM:ResourceProviders:AIModel:Storage:*"; + + /// + /// Filter for the configuration section used to identify the storage settings for the FoundationaLLM.Agent resource provider. + /// + public const string FoundationaLLM_ResourceProviders_Agent_Storage = + "FoundationaLLM:ResourceProviders:Agent:Storage:*"; + + /// + /// Filter for the configuration section used to identify the storage settings for the FoundationaLLM.Attachment resource provider. + /// + public const string FoundationaLLM_ResourceProviders_Attachment_Storage = + "FoundationaLLM:ResourceProviders:Attachment:Storage:*"; + + /// + /// Filter for the configuration section used to identify the storage settings for the FoundationaLLM.Configuration resource provider. + /// + public const string FoundationaLLM_ResourceProviders_Configuration_Storage = + "FoundationaLLM:ResourceProviders:Configuration:Storage:*"; + + /// + /// Filter for the configuration section used to identify the storage settings for the FoundationaLLM.DataSource resource provider. + /// + public const string FoundationaLLM_ResourceProviders_DataSource_Storage = + "FoundationaLLM:ResourceProviders:DataSource:Storage:*"; + + /// + /// Filter for the configuration section used to identify the storage settings for the FoundationaLLM.Prompt resource provider. + /// + public const string FoundationaLLM_ResourceProviders_Prompt_Storage = + "FoundationaLLM:ResourceProviders:Prompt:Storage:*"; + + /// + /// Filter for the configuration section used to identify the storage settings for the FoundationaLLM.Vectorization resource provider. + /// + public const string FoundationaLLM_ResourceProviders_Vectorization_Storage = + "FoundationaLLM:ResourceProviders:Vectorization:Storage:*"; + + /// + /// Filter for the configuration section used to identify the settings for all API endpoints. + /// + public const string FoundationaLLM_APIEndpoints = + "FoundationaLLM:APIEndpoints:*"; + + /// + /// Filter for the configuration section used to identify the authentication settings for the Authorization API. Due to its special nature, the Authorization API does not have a corresponding APIEndpointConfiguration resource. + /// + public const string FoundationaLLM_APIEndpoints_AuthorizationAPI = + "FoundationaLLM:APIEndpoints:AuthorizationAPI:*"; + + /// + /// Filter for the configuration section used to identify the main Core API settings. + /// + public const string FoundationaLLM_APIEndpoints_CoreAPI_Configuration = + "FoundationaLLM:APIEndpoints:CoreAPI:Configuration:*"; + + /// + /// Filter for the configuration section used to identify the Entra ID authentication settings for Core API. + /// + public const string FoundationaLLM_APIEndpoints_CoreAPI_Configuration_Entra = + "FoundationaLLM:APIEndpoints:CoreAPI:Configuration:Entra:*"; + + /// + /// Filter for the configuration section used to identify the Cosmos DB settings for the Core API. + /// + public const string FoundationaLLM_APIEndpoints_CoreAPI_Configuration_CosmosDB = + "FoundationaLLM:APIEndpoints:CoreAPI:Configuration:CosmosDB:*"; + + /// + /// Filter for the configuration section used to identify the authentication settings for the Core Worker service. + /// + public const string FoundationaLLM_APIEndpoints_CoreWorker = + "FoundationaLLM:APIEndpoints:CoreWorker:*"; + + /// + /// Filter for the configuration section used to identify the authentication settings for the Gatekeeper API. + /// + public const string FoundationaLLM_APIEndpoints_GatekeeperAPI = + "FoundationaLLM:APIEndpoints:GatekeeperAPI:*"; + + /// + /// Filter for the configuration section used to identify the settings for the Gatekeeper API. + /// + public const string FoundationaLLM_APIEndpoints_GatekeeperAPI_Configuration = + "FoundationaLLM:APIEndpoints:GatekeeperAPI:Configuration:*"; + + /// + /// Filter for the configuration section used to identify the authentication settings for the Gatekeeper Integration API. + /// + public const string FoundationaLLM_APIEndpoints_GatekeeperIntegrationAPI = + "FoundationaLLM:APIEndpoints:GatekeeperIntegrationAPI:*"; + + /// + /// Filter for the configuration section used to identify the authentication settings for the Orchestration API. + /// + public const string FoundationaLLM_APIEndpoints_OrchestrationAPI = + "FoundationaLLM:APIEndpoints:OrchestrationAPI:*"; + + /// + /// Filter for the configuration section used to identify the authentication settings for the LangChain API. + /// + public const string FoundationaLLM_APIEndpoints_LangChainAPI = + "FoundationaLLM:APIEndpoints:LangChainAPI:*"; + + /// + /// Filter for the configuration section used to identify the authentication settings for the Semantic Kernel API. + /// + public const string FoundationaLLM_APIEndpoints_SemanticKernelAPI = + "FoundationaLLM:APIEndpoints:SemanticKernelAPI:*"; + + /// + /// Filter for the configuration section used to identify the Entra ID authentication settings for Management API. + /// + public const string FoundationaLLM_APIEndpoints_ManagementAPI_Configuration_Entra = + "FoundationaLLM:APIEndpoints:ManagementAPI:Configuration:Entra:*"; + + /// + /// Filter for the configuration section used to identify the authentication settings for the Vectorization API. + /// + public const string FoundationaLLM_APIEndpoints_VectorizationAPI = + "FoundationaLLM:APIEndpoints:VectorizationAPI:*"; + + /// + /// Filter for the configuration section used to identify the authentication settings for the Vectorization Worker service. + /// + public const string FoundationaLLM_APIEndpoints_VectorizationWorker = + "FoundationaLLM:APIEndpoints:VectorizationWorker:*"; + + /// + /// Filter for the configuration section used to identify the authentication settings for the Gateway API. + /// + public const string FoundationaLLM_APIEndpoints_GatewayAPI = + "FoundationaLLM:APIEndpoints:GatewayAPI:*"; + + /// + /// Filter for the configuration section used to identify the settings for the Gateway API. + /// + public const string FoundationaLLM_APIEndpoints_GatewayAPI_Configuration = + "FoundationaLLM:APIEndpoints:GatewayAPI:Configuration:*"; + + /// + /// Filter for the configuration section used to identify the authentication settings for the Gateway Adapter API. + /// + public const string FoundationaLLM_APIEndpoints_GatewayAdapterAPI = + "FoundationaLLM:APIEndpoints:GatewayAdapterAPI:*"; + + /// + /// Filter for the configuration section used to identify the authentication settings for the State API. + /// + public const string FoundationaLLM_APIEndpoints_StateAPI = + "FoundationaLLM:APIEndpoints:StateAPI:*"; + + /// + /// Filter for the configuration section used to identify the Cosmos DB settings for the State API. + /// + public const string FoundationaLLM_APIEndpoints_StateAPI_Configuration_CosmosDB = + "FoundationaLLM:APIEndpoints:StateAPI:Configuration:CosmosDB:*"; + + /// + /// Filter for the configuration section used to identify the settings for the Azure AI Search vector store service. + /// + public const string FoundationaLLM_APIEndpoints_AzureAISearchVectorStore_Configuration = + "FoundationaLLM:APIEndpoints:AzureAISearchVectorStore:Configuration:*"; + + /// + /// Filter for the configuration section used to identify the settings for the Azure Cosmos DB NoSQL vector store service. + /// + public const string FoundationaLLM_APIEndpoints_AzureCosmosDBNoSQLVectorStore_Configuration = + "FoundationaLLM:APIEndpoints:AzureCosmosDBNoSQLVectorStore:Configuration:*"; + + /// + /// Filter for the configuration section used to identify the settings for the Azure PostgreSQL vector store service. + /// + public const string FoundationaLLM_APIEndpoints_AzurePostgreSQLVectorStore_Configuration = + "FoundationaLLM:APIEndpoints:AzurePostgreSQLVectorStore:Configuration:*"; + + /// + /// Filter for the configuration section used to identify the settings for the Azure Event Grid service. + /// + public const string FoundationaLLM_APIEndpoints_AzureEventGrid_Configuration = + "FoundationaLLM:APIEndpoints:AzureEventGrid:Configuration:*"; + + /// + /// Filter for the configuration section used to identify the settings for the Azure AI Studio service. + /// + public const string FoundationaLLM_APIEndpoints_AzureAIStudio_Configuration = + "FoundationaLLM:APIEndpoints:AzureAIStudio:Configuration:*"; + + /// + /// Filter for the configuration section used to identify the settings for storage account used by the Azure AI Studio service. + /// + public const string FoundationaLLM_APIEndpoints_AzureAIStudio_Configuration_Storage = + "FoundationaLLM:APIEndpoints:AzureAIStudio:Configuration:Storage:*"; + + /// + /// Filter for the configuration section used to identify the settings for the Azure Content Safety service. + /// + public const string FoundationaLLM_APIEndpoints_AzureContentSafety_Configuration = + "FoundationaLLM:APIEndpoints:AzureContentSafety:Configuration:*"; + + /// + /// Filter for the configuration section used to identify the settings for the Lakera Guard service. + /// + public const string FoundationaLLM_APIEndpoints_LakeraGuard_Configuration = + "FoundationaLLM:APIEndpoints:LakeraGuard:Configuration:*"; + + /// + /// Filter for the configuration section used to identify the settings for the Encrypt Guardrails service. + /// + public const string FoundationaLLM_APIEndpoints_EnkryptGuardrails_Configuration = + "FoundationaLLM:APIEndpoints:EnkryptGuardrails:Configuration:*"; + + /// + /// Filter for the configuration section used to identify the branding settings for the User Portal. + /// + public const string FoundationaLLM_Branding = + "FoundationaLLM:Branding:*"; + + /// + /// Filter for the configuration section used to identify the settings for vectorization steps. + /// + public const string FoundationaLLM_Vectorization_Steps = + "FoundationaLLM:Vectorization:Steps:*"; + + /// + /// Filter for the configuration section used to identify the settings for vectorization queues. + /// + public const string FoundationaLLM_Vectorization_Queues = + "FoundationaLLM:Vectorization:Queues:*"; + + /// + /// Filter for the configuration section used to identify the settings for the storage account used by the vectorization state service. + /// + public const string FoundationaLLM_Vectorization_StateService_Storage = + "FoundationaLLM:Vectorization:StateService:Storage:*"; + + /// + /// Filter for the configuration section used to identify the settings for data sources resources managed by the FoundationaLLM.DataSource resource provider. + /// + public const string FoundationaLLM_DataSources = + "FoundationaLLM:DataSources:*"; + + /// + /// Filter for the configuration section used to identify the settings for the events infrastructure used by the Core API. + /// + public const string FoundationaLLM_Events_Profiles_CoreAPI = + "FoundationaLLM:Events:Profiles:CoreAPI:*"; + + /// + /// Filter for the configuration section used to identify the settings for the events infrastructure used by the Orchestration API. + /// + public const string FoundationaLLM_Events_Profiles_OrchestrationAPI = + "FoundationaLLM:Events:Profiles:OrchestrationAPI:*"; + + /// + /// Filter for the configuration section used to identify the settings for the events infrastructure used by the Management API. + /// + public const string FoundationaLLM_Events_Profiles_ManagementAPI = + "FoundationaLLM:Events:Profiles:ManagementAPI:*"; + + /// + /// Filter for the configuration section used to identify the settings for the events infrastructure used by the Vectorization API. + /// + public const string FoundationaLLM_Events_Profiles_VectorizationAPI = + "FoundationaLLM:Events:Profiles:VectorizationAPI:*"; + + /// + /// Filter for the configuration section used to identify the settings for the events infrastructure used by the Vectorization Worker service. + /// + public const string FoundationaLLM_Events_Profiles_VectorizationWorker = + "FoundationaLLM:Events:Profiles:VectorizationWorker:*"; + } +} diff --git a/src/dotnet/Common/Constants/Configuration/AppConfigurationKeyFilters.tt b/src/dotnet/Common/Constants/Configuration/AppConfigurationKeyFilters.tt new file mode 100644 index 0000000000..8755b12bf2 --- /dev/null +++ b/src/dotnet/Common/Constants/Configuration/AppConfigurationKeyFilters.tt @@ -0,0 +1,43 @@ +<#@ template debug="false" hostspecific="true" language="C#" #> +<#@ assembly name="System.Core" #> +<#@ import namespace="System.IO" #> +<#@ assembly name="System.Text.Json" #> +<#@ import namespace="System.Collections.Generic" #> +<#@ assembly name="System.Memory" #> +<#@ import namespace="System.Text.Json" #> +<#@ import namespace="System.Text.Json.Nodes" #> +<#@ output extension=".cs" #> +<# + string inputFileName = this.Host.ResolvePath($"../Data/AppConfiguration.json"); + string inputContent = File.ReadAllText(inputFileName); + var jsonObjects = JsonNode.Parse(inputContent)!; + Func getName = n => n.GetValue().Replace(":", "_"); +#> +namespace FoundationaLLM.Common.Constants.Configuration +{ + /// + /// Defines all configuration section filters used to select subsets of configuration settings. + /// + public static partial class AppConfigurationKeyFilters + {<# + foreach (var jsonObject in jsonObjects.AsArray()) + { + var configurationSection = jsonObject["configuration_section"]; + if (configurationSection != null) + { + var description = configurationSection["description"].GetValue(); + description = "Filter for the " + + Char.ToLowerInvariant(description[0]) + description.Substring(1); +#> + + /// + /// <#=description#> + /// + public const string FoundationaLLM_<#=getName(jsonObject["namespace"])#> = + "FoundationaLLM:<#=jsonObject["namespace"]#>:*"; +<# + } + } +#> + } +} diff --git a/src/dotnet/Common/Constants/Configuration/AppConfigurationKeySections.cs b/src/dotnet/Common/Constants/Configuration/AppConfigurationKeySections.cs index 738d57566d..8d53133502 100644 --- a/src/dotnet/Common/Constants/Configuration/AppConfigurationKeySections.cs +++ b/src/dotnet/Common/Constants/Configuration/AppConfigurationKeySections.cs @@ -11,6 +11,12 @@ public static partial class AppConfigurationKeySections public const string FoundationaLLM_Instance = "FoundationaLLM:Instance"; + /// + /// Configuration section used to identify the Azure Key Vault settings related to the FoundationaLLM instance. + /// + public const string FoundationaLLM_Configuration = + "FoundationaLLM:Configuration"; + /// /// Configuration section used to identify the storage settings for the FoundationaLLM.AIModel resource provider. /// @@ -71,6 +77,12 @@ public static partial class AppConfigurationKeySections public const string FoundationaLLM_APIEndpoints_CoreAPI_Configuration = "FoundationaLLM:APIEndpoints:CoreAPI:Configuration"; + /// + /// Configuration section used to identify the Entra ID authentication settings for Core API. + /// + public const string FoundationaLLM_APIEndpoints_CoreAPI_Configuration_Entra = + "FoundationaLLM:APIEndpoints:CoreAPI:Configuration:Entra"; + /// /// Configuration section used to identify the Cosmos DB settings for the Core API. /// @@ -119,6 +131,12 @@ public static partial class AppConfigurationKeySections public const string FoundationaLLM_APIEndpoints_SemanticKernelAPI = "FoundationaLLM:APIEndpoints:SemanticKernelAPI"; + /// + /// Configuration section used to identify the Entra ID authentication settings for Management API. + /// + public const string FoundationaLLM_APIEndpoints_ManagementAPI_Configuration_Entra = + "FoundationaLLM:APIEndpoints:ManagementAPI:Configuration:Entra"; + /// /// Configuration section used to identify the authentication settings for the Vectorization API. /// diff --git a/src/dotnet/Common/Constants/Configuration/AppConfigurationKeys.cs b/src/dotnet/Common/Constants/Configuration/AppConfigurationKeys.cs index 82f9ce875c..fedc159427 100644 --- a/src/dotnet/Common/Constants/Configuration/AppConfigurationKeys.cs +++ b/src/dotnet/Common/Constants/Configuration/AppConfigurationKeys.cs @@ -1017,6 +1017,10 @@ public static class AppConfigurationKeys #endregion + #region FoundationaLLM:Vectorization:TextEmbedding:Gateway + + #endregion + #region FoundationaLLM:DataSources #endregion diff --git a/src/dotnet/Common/Constants/Configuration/AppConfigurationKeysOld.cs b/src/dotnet/Common/Constants/Configuration/AppConfigurationKeysOld.cs deleted file mode 100644 index 3ac0eaf4b9..0000000000 --- a/src/dotnet/Common/Constants/Configuration/AppConfigurationKeysOld.cs +++ /dev/null @@ -1,146 +0,0 @@ -namespace FoundationaLLM.Common.Constants.Configuration -{ - /// - /// Contains constants of the keys filters for app configuration setting namespaces. - /// - public static class AppConfigurationKeyFilters - { - /// - /// The key filter for the FoundationaLLM:Instance:* app configuration settings. - /// - public const string FoundationaLLM_Instance = "FoundationaLLM:Instance:*"; - /// - /// The key filter for the FoundationaLLM:Configuration:* app configuration settings. - /// - public const string FoundationaLLM_Configuration = "FoundationaLLM:Configuration:*"; - /// - /// The key filter for the FoundationaLLM:Branding:* app configuration settings. - /// - public const string FoundationaLLM_Branding = "FoundationaLLM:Branding:*"; - /// - /// The key filter for the FoundationaLLM:APIs:* app configuration settings. - /// - public const string FoundationaLLM_APIEndpoints = "FoundationaLLM:APIEndpoints:*"; - - /// - /// The key filter for the FoundationaLLM:APIs:VectorizationAPI:* app configuration settings. - /// - public const string FoundationaLLM_APIs_VectorizationAPI = "FoundationaLLM:APIs:VectorizationAPI:*"; - /// - /// The key filter for the FoundationaLLM:APIs:VectorizationWorker:* app configuration settings. - /// - public const string FoundationaLLM_APIs_VectorizationWorker = "FoundationaLLM:APIs:VectorizationWorker:*"; - /// - /// The key filter for the FoundationaLLM:APIs:GatewayAPI:* app configuration settings. - /// - public const string FoundationaLLM_APIs_GatewayAPI = "FoundationaLLM:APIs:GatewayAPI:*"; - /// - /// The key filter for the FoundationaLLM:APIs:GatewayAdapterAPI:* app configuration settings. - /// - public const string FoundationaLLM_APIs_GatewayAdapterAPI = "FoundationaLLM:APIs:GatewayAdapterAPI:*"; - /// - /// The key filter for the FoundationaLLM:APIs:StateAPI:* app configuration settings. - /// - public const string FoundationaLLM_APIs_StateAPI = "FoundationaLLM:APIs:StateAPI:*"; - /// - /// The key filter for the FoundationaLLM:CosmosDB:* app configuration settings. - /// - public const string FoundationaLLM_CosmosDB = "FoundationaLLM:CosmosDB:*"; - /// - /// The key filter for the FoundationaLLM:CoreAPI:Entra:* app configuration settings. - /// - public const string FoundationaLLM_CoreAPI_Entra = "FoundationaLLM:CoreAPI:Entra:*"; - /// - /// The key filter for the FoundationaLLM:ManagementAPI:Entra:* app configuration settings. - /// - public const string FoundationaLLM_ManagementAPI_Entra = "FoundationaLLM:ManagementAPI:Entra:*"; - /// - /// The key filter for the FoundationaLLM:Chat:Entra:* app configuration settings. - /// - public const string FoundationaLLM_Chat_Entra = "FoundationaLLM:Chat:Entra:*"; - /// - /// The key filter for the FoundationaLLM:Management:Entra:* app configuration settings. - /// - public const string FoundationaLLM_Management_Entra = "FoundationaLLM:Management:Entra:*"; - /// - /// The key filter for the FoundationaLLM:Orchestration:* app configuration settings. - /// - public const string FoundationaLLM_Orchestration = "FoundationaLLM:Orchestration:*"; - /// - /// The key filter for the FoundationaLLM:CoreWorker:* app configuration settings. - /// - public const string FoundationaLLM_CoreWorker = "FoundationaLLM:CoreWorker:*"; - /// - /// The key filter for the FoundationaLLM:Refinement:* app configuration settings. - /// - public const string FoundationaLLM_Refinement = "FoundationaLLM:Refinement:*"; - /// - /// The key filter for the FoundationaLLM:AzureContentSafety:* app configuration settings. - /// - public const string FoundationaLLM_AzureContentSafety = "FoundationaLLM:AzureContentSafety:*"; - /// - /// The key filter for the FoundationaLLM:BlobStorageMemorySource:* app configuration settings. - /// - public const string FoundationaLLM_BlobStorageMemorySource = "FoundationaLLM:CoreAPI:BlobStorageMemorySource:*"; - /// - /// The key filter for the FoundationaLLM:Vectorization:* app configuration settings. - /// - public const string FoundationaLLM_Vectorization = "FoundationaLLM:Vectorization:*"; - /// - /// The key filter for the FoundationaLLM:Agent:* app configuration settings. - /// - public const string FoundationaLLM_Agent = "FoundationaLLM:Agent:*"; - /// - /// The key filter for the FoundationaLLM:Prompt:* app configuration settings. - /// - public const string FoundationaLLM_Prompt = "FoundationaLLM:Prompt:*"; - /// - /// The key filter for the FoundationaLLM:Prompt:* app configuration settings. - /// - public const string FoundationaLLM_AIModel = "FoundationaLLM:AIModel:*"; - /// - /// The key filter for the FoundationaLLM:Events:* app configuration settings. - /// - public const string FoundationaLLM_Events = "FoundationaLLM:Events:*"; - /// - /// The key filter for the FoundationaLLM:DataSource:* app configuration settings. - /// This supports the DataSource resource provider settings. - /// - public const string FoundationaLLM_DataSource = "FoundationaLLM:DataSource:*"; - /// - /// The key filter for the FoundationaLLM:DataSources:* app configuration settings. - /// This supports data source settings created by the Management API. - /// - public const string FoundationaLLM_DataSources = "FoundationaLLM:DataSources:*"; - /// - /// The key filter for the FoundationaLLM:Attachment:* app configuration settings. - /// This supports the Attachment resource provider settings. - /// - public const string FoundationaLLM_Attachment = "FoundationaLLM:Attachment:*"; - /// - /// The key filter for the FoundationaLLM:AzureOpenAI:* app configuration settings. - /// - public const string FoundationaLLM_AzureOpenAI = "FoundationaLLM:AzureOpenAI:*"; - /// - /// The key filter for the FoundationaLLM:AzureAI:* app configuration settings. - /// - public const string FoundationaLLM_AzureAI = "FoundationaLLM:AzureAI:*"; - /// - /// The key filter for the FoundationaLLM:Gateway:* app configuration settings. - /// - public const string FoundationaLLM_Gateway = "FoundationaLLM:Gateway:*"; - /// - /// The key filter for the FoundationaLLM:State:* app configuration settings. - /// - public const string FoundationaLLM_State = "FoundationaLLM:State:*"; - /// - /// The key filter for the FoundationaLLM:AzureAIStudio:* app configuration settings. - /// - public const string FoundationaLLM_AzureAIStudio = "FoundationaLLM:AzureAIStudio:*"; - /// - /// The key filter for the FoundationaLLM:AzureAIStudio:BlobStorageServiceSettings:* app configuration settings. - /// - public const string FoundationaLLM_AzureAIStudio_BlobStorageServiceSettings = "FoundationaLLM:AzureAIStudio:BlobStorageServiceSettings:*"; - } - -} diff --git a/src/dotnet/Common/Constants/Configuration/DependencyInjectionKeys.cs b/src/dotnet/Common/Constants/Configuration/DependencyInjectionKeys.cs index b29813968d..4c67d3e079 100644 --- a/src/dotnet/Common/Constants/Configuration/DependencyInjectionKeys.cs +++ b/src/dotnet/Common/Constants/Configuration/DependencyInjectionKeys.cs @@ -46,5 +46,47 @@ public static partial class DependencyInjectionKeys /// public const string FoundationaLLM_ResourceProviders_Vectorization = "FoundationaLLM:ResourceProviders:Vectorization"; + + /// + /// Dependency injection key used to inject the implementation of IIndexingService based on Azure AI Search. + /// + public const string FoundationaLLM_APIEndpoints_AzureAISearchVectorStore_Configuration = + "FoundationaLLM:APIEndpoints:AzureAISearchVectorStore:Configuration"; + + /// + /// Dependency injection key used to inject the implementation of IIndexingService based on Azure Cosmos DB NoSQL. + /// + public const string FoundationaLLM_APIEndpoints_AzureCosmosDBNoSQLVectorStore_Configuration = + "FoundationaLLM:APIEndpoints:AzureCosmosDBNoSQLVectorStore:Configuration"; + + /// + /// Dependency injection key used to inject the implementation of IIndexingService based on Azure PostgreSQL. + /// + public const string FoundationaLLM_APIEndpoints_AzurePostgreSQLVectorStore_Configuration = + "FoundationaLLM:APIEndpoints:AzurePostgreSQLVectorStore:Configuration"; + + /// + /// Dependency injection key used to inject the IConfiguration section for vectorization steps. + /// + public const string FoundationaLLM_Vectorization_Steps = + "FoundationaLLM:Vectorization:Steps"; + + /// + /// Dependency injection key used to inject the IConfiguration section for vectorization queues. + /// + public const string FoundationaLLM_Vectorization_Queues = + "FoundationaLLM:Vectorization:Queues"; + + /// + /// Dependency injection key used to inject storage settings for the Vectorization state service. + /// + public const string FoundationaLLM_Vectorization_StateService_Storage = + "FoundationaLLM:Vectorization:StateService:Storage"; + + /// + /// Dependency injection key used to inject the ITextEmbeddingService implementation that uses the FoundationaLLM Gateway for embedding. + /// + public const string FoundationaLLM_Vectorization_TextEmbedding_Gateway = + "FoundationaLLM:Vectorization:TextEmbedding:Gateway"; } } diff --git a/src/dotnet/Common/Constants/Configuration/DependencyInjectionKeysOld.cs b/src/dotnet/Common/Constants/Configuration/DependencyInjectionKeysOld.cs deleted file mode 100644 index 21d5efe4d9..0000000000 --- a/src/dotnet/Common/Constants/Configuration/DependencyInjectionKeysOld.cs +++ /dev/null @@ -1,58 +0,0 @@ -namespace FoundationaLLM.Common.Constants.Configuration -{ - /// - /// Contains constants of the keys for all keyed dependency injections. - /// - public static partial class DependencyInjectionKeys - { - /// - /// The dependency injection key for the blob storage vectorization state service. - /// - public const string FoundationaLLM_Vectorization_BlobStorageVectorizationStateService = "FoundationaLLM:Vectorization:BlobStorageVectorizationStateService"; - - /// - /// The dependency injection key for the vectorization data lake content source service. - /// - public const string FoundationaLLM_Vectorization_DataLakeContentSourceService = "FoundationaLLM:Vectorization:DataLakeContentSourceService"; - - /// - /// The dependency injection key for the content source service factory. - /// - public const string FoundationaLLM_Vectorization_ContentSourceServiceFactory = "FoundationaLLM:Vectorization:ContentSourceServiceFactory"; - - /// - /// The dependency injection key for the Semantic Kernel text embedding service. - /// - public const string FoundationaLLM_Vectorization_SemanticKernelTextEmbeddingService = "FoundationaLLM:Vectorization:SemanticKernelTextEmbeddingService"; - - /// - /// The dependency injection key for the Gateway text embedding service. - /// - public const string FoundationaLLM_Vectorization_GatewayTextEmbeddingService = "FoundationaLLM:Vectorization:GatewayTextEmbeddingService"; - - /// - /// The dependency injection key for the Azure AI Search indexing service. - /// - public const string FoundationaLLM_Vectorization_AzureAISearchIndexingService = "FoundationaLLM:Vectorization:AzureAISearchIndexingService"; - - /// - /// The dependency injection key for the Azure Cosmos DB NoSQL indexing service. - /// - public const string FoundationaLLM_Vectorization_AzureCosmosDBNoSQLIndexingService = "FoundationaLLM:Vectorization:AzureCosmosDBNoSQLIndexingService"; - - /// - /// The dependency injection key for the PostgreSQL indexing service. - /// - public const string FoundationaLLM_Vectorization_PostgresIndexingService = "FoundationaLLM:Vectorization:PostgresIndexingService"; - - /// - /// The dependency injection key for the vectorization queues configuration section. - /// - public const string FoundationaLLM_Vectorization_Queues = "FoundationaLLM:Vectorization:Queues"; - - /// - /// The dependency injection key for the vectorization steps configuration section. - /// - public const string FoundationaLLM_Vectorization_Steps = "FoundationaLLM:Vectorization:Steps"; - } -} diff --git a/src/dotnet/Common/Constants/Data/AppConfiguration.json b/src/dotnet/Common/Constants/Data/AppConfiguration.json index 9f276fac11..8406aa8c58 100644 --- a/src/dotnet/Common/Constants/Data/AppConfiguration.json +++ b/src/dotnet/Common/Constants/Data/AppConfiguration.json @@ -19,7 +19,9 @@ { "namespace": "Configuration", "dependency_injection_key": null, - "configuration_section": null, + "configuration_section": { + "description": "Configuration section used to identify the Azure Key Vault settings related to the FoundationaLLM instance." + }, "configuration_keys": [ { "name": "KeyVaultURI", @@ -338,7 +340,9 @@ { "namespace": "APIEndpoints:CoreAPI:Configuration:Entra", "dependency_injection_key": null, - "configuration_section": null, + "configuration_section": { + "description": "Configuration section used to identify the Entra ID authentication settings for Core API." + }, "configuration_keys": [ { "name": "Instance", @@ -656,7 +660,9 @@ { "namespace": "APIEndpoints:ManagementAPI:Configuration:Entra", "dependency_injection_key": null, - "configuration_section": null, + "configuration_section": { + "description": "Configuration section used to identify the Entra ID authentication settings for Management API." + }, "configuration_keys": [ { "name": "Instance", @@ -892,7 +898,9 @@ }, { "namespace": "APIEndpoints:AzureAISearchVectorStore:Configuration", - "dependency_injection_key": null, + "dependency_injection_key": { + "description": "Dependency injection key used to inject the implementation of IIndexingService based on Azure AI Search." + }, "configuration_section": { "description": "Configuration section used to identify the settings for the Azure AI Search vector store service." }, @@ -900,7 +908,9 @@ }, { "namespace": "APIEndpoints:AzureCosmosDBNoSQLVectorStore:Configuration", - "dependency_injection_key": null, + "dependency_injection_key": { + "description": "Dependency injection key used to inject the implementation of IIndexingService based on Azure Cosmos DB NoSQL." + }, "configuration_section": { "description": "Configuration section used to identify the settings for the Azure Cosmos DB NoSQL vector store service." }, @@ -908,7 +918,9 @@ }, { "namespace": "APIEndpoints:AzurePostgreSQLVectorStore:Configuration", - "dependency_injection_key": null, + "dependency_injection_key": { + "description": "Dependency injection key used to inject the implementation of IIndexingService based on Azure PostgreSQL." + }, "configuration_section": { "description": "Configuration section used to identify the settings for the Azure PostgreSQL vector store service." }, @@ -1298,7 +1310,9 @@ }, { "namespace": "Vectorization:Steps", - "dependency_injection_key": null, + "dependency_injection_key": { + "description": "Dependency injection key used to inject the IConfiguration section for vectorization steps." + }, "configuration_section": { "description": "Configuration section used to identify the settings for vectorization steps." }, @@ -1306,7 +1320,9 @@ }, { "namespace": "Vectorization:Queues", - "dependency_injection_key": null, + "dependency_injection_key": { + "description": "Dependency injection key used to inject the IConfiguration section for vectorization queues." + }, "configuration_section": { "description": "Configuration section used to identify the settings for vectorization queues." }, @@ -1347,7 +1363,9 @@ }, { "namespace": "Vectorization:StateService:Storage", - "dependency_injection_key": null, + "dependency_injection_key": { + "description": "Dependency injection key used to inject storage settings for the Vectorization state service." + }, "configuration_section": { "description": "Configuration section used to identify the settings for the storage account used by the vectorization state service." }, @@ -1370,6 +1388,14 @@ } ] }, + { + "namespace": "Vectorization:TextEmbedding:Gateway", + "dependency_injection_key": { + "description": "Dependency injection key used to inject the ITextEmbeddingService implementation that uses the FoundationaLLM Gateway for embedding." + }, + "configuration_section": null, + "configuration_keys": [] + }, { "namespace": "DataSources", "dependency_injection_key": null, diff --git a/src/dotnet/CoreAPI/Program.cs b/src/dotnet/CoreAPI/Program.cs index f63cf06185..6fd16cd445 100644 --- a/src/dotnet/CoreAPI/Program.cs +++ b/src/dotnet/CoreAPI/Program.cs @@ -48,16 +48,14 @@ public static void Main(string[] args) options.SetCredential(DefaultAuthentication.AzureCredential); }); options.Select(AppConfigurationKeyFilters.FoundationaLLM_Instance); - options.Select((string)AppConfigurationKeyFilters.FoundationaLLM_APIEndpoints); - options.Select(AppConfigurationKeyFilters.FoundationaLLM_CosmosDB); - options.Select(AppConfigurationKeyFilters.FoundationaLLM_Branding); - options.Select(AppConfigurationKeyFilters.FoundationaLLM_CoreAPI_Entra); - options.Select(AppConfigurationKeyFilters.FoundationaLLM_Agent); - options.Select(AppConfigurationKeyFilters.FoundationaLLM_Events); - options.Select(AppConfigurationKeyFilters.FoundationaLLM_Attachment); - options.Select(AppConfigurationKeyFilters.FoundationaLLM_AIModel); - options.Select(AppConfigurationKeyFilters.FoundationaLLM_Configuration); + options.Select(AppConfigurationKeyFilters.FoundationaLLM_Branding); + options.Select(AppConfigurationKeyFilters.FoundationaLLM_APIEndpoints_CoreAPI_Configuration_CosmosDB); + options.Select(AppConfigurationKeyFilters.FoundationaLLM_APIEndpoints_CoreAPI_Configuration_Entra); + options.Select(AppConfigurationKeyFilters.FoundationaLLM_ResourceProviders_Agent_Storage); + options.Select(AppConfigurationKeyFilters.FoundationaLLM_ResourceProviders_Attachment_Storage); + options.Select(AppConfigurationKeyFilters.FoundationaLLM_ResourceProviders_AIModel_Storage); + options.Select(AppConfigurationKeyFilters.FoundationaLLM_Events_Profiles_CoreAPI); })); if (builder.Environment.IsDevelopment()) builder.Configuration.AddJsonFile("appsettings.development.json", true, true); diff --git a/src/dotnet/CoreWorker/Program.cs b/src/dotnet/CoreWorker/Program.cs index 849347cbff..8c125cbe05 100644 --- a/src/dotnet/CoreWorker/Program.cs +++ b/src/dotnet/CoreWorker/Program.cs @@ -26,8 +26,8 @@ { options.SetCredential(DefaultAuthentication.AzureCredential); }); - options.Select(AppConfigurationKeyFilters.FoundationaLLM_CoreWorker); - options.Select(AppConfigurationKeyFilters.FoundationaLLM_CosmosDB); + options.Select(AppConfigurationKeyFilters.FoundationaLLM_APIEndpoints_CoreWorker); + options.Select(AppConfigurationKeyFilters.FoundationaLLM_APIEndpoints_CoreAPI_Configuration_CosmosDB); }); if (builder.Environment.IsDevelopment()) builder.Configuration.AddJsonFile("appsettings.development.json", true, true); diff --git a/src/dotnet/GatekeeperAPI/Program.cs b/src/dotnet/GatekeeperAPI/Program.cs index 1d3f21abd0..a48ebb00bb 100644 --- a/src/dotnet/GatekeeperAPI/Program.cs +++ b/src/dotnet/GatekeeperAPI/Program.cs @@ -45,9 +45,9 @@ public static void Main(string[] args) options.SetCredential(DefaultAuthentication.AzureCredential); }); options.Select(AppConfigurationKeyFilters.FoundationaLLM_Instance); - options.Select((string)AppConfigurationKeyFilters.FoundationaLLM_APIEndpoints); - options.Select(AppConfigurationKeyFilters.FoundationaLLM_Refinement); - options.Select(AppConfigurationKeyFilters.FoundationaLLM_AzureContentSafety); + options.Select(AppConfigurationKeyFilters.FoundationaLLM_Configuration); + options.Select(AppConfigurationKeyFilters.FoundationaLLM_APIEndpoints); + })); if (builder.Environment.IsDevelopment()) builder.Configuration.AddJsonFile("appsettings.development.json", true, true); diff --git a/src/dotnet/GatewayAPI/Program.cs b/src/dotnet/GatewayAPI/Program.cs index a939eee376..ca902e3986 100644 --- a/src/dotnet/GatewayAPI/Program.cs +++ b/src/dotnet/GatewayAPI/Program.cs @@ -25,8 +25,7 @@ { options.SetCredential(DefaultAuthentication.AzureCredential); }); - options.Select(AppConfigurationKeyFilters.FoundationaLLM_APIs_GatewayAPI); - options.Select(AppConfigurationKeyFilters.FoundationaLLM_Gateway); + options.Select(AppConfigurationKeyFilters.FoundationaLLM_APIEndpoints_GatewayAPI); }); if (builder.Environment.IsDevelopment()) builder.Configuration.AddJsonFile("appsettings.development.json", true, true); diff --git a/src/dotnet/GatewayAdapterAPI/Program.cs b/src/dotnet/GatewayAdapterAPI/Program.cs index fa462dc304..91cdee7037 100644 --- a/src/dotnet/GatewayAdapterAPI/Program.cs +++ b/src/dotnet/GatewayAdapterAPI/Program.cs @@ -24,8 +24,7 @@ { options.SetCredential(DefaultAuthentication.AzureCredential); }); - options.Select(AppConfigurationKeyFilters.FoundationaLLM_APIs_GatewayAdapterAPI); - options.Select(AppConfigurationKeyFilters.FoundationaLLM_Gateway); + options.Select(AppConfigurationKeyFilters.FoundationaLLM_APIEndpoints_GatewayAdapterAPI); }); if (builder.Environment.IsDevelopment()) builder.Configuration.AddJsonFile("appsettings.development.json", true, true); diff --git a/src/dotnet/ManagementAPI/Program.cs b/src/dotnet/ManagementAPI/Program.cs index f0ae415002..df81b89892 100644 --- a/src/dotnet/ManagementAPI/Program.cs +++ b/src/dotnet/ManagementAPI/Program.cs @@ -45,20 +45,23 @@ public static void Main(string[] args) { options.Connect(builder.Configuration[EnvironmentVariables.FoundationaLLM_AppConfig_ConnectionString]); options.ConfigureKeyVault(options => { options.SetCredential(DefaultAuthentication.AzureCredential); }); + options.Select(AppConfigurationKeyFilters.FoundationaLLM_Instance); - options.Select((string)AppConfigurationKeyFilters.FoundationaLLM_APIEndpoints); - options.Select(AppConfigurationKeyFilters.FoundationaLLM_CosmosDB); - options.Select(AppConfigurationKeyFilters.FoundationaLLM_Branding); - options.Select(AppConfigurationKeyFilters.FoundationaLLM_ManagementAPI_Entra); - options.Select(AppConfigurationKeyFilters.FoundationaLLM_Vectorization); - options.Select(AppConfigurationKeyFilters.FoundationaLLM_APIs_VectorizationAPI); - options.Select(AppConfigurationKeyFilters.FoundationaLLM_Agent); - options.Select(AppConfigurationKeyFilters.FoundationaLLM_Prompt); - options.Select(AppConfigurationKeyFilters.FoundationaLLM_DataSource); //resource provider settings - options.Select(AppConfigurationKeyFilters.FoundationaLLM_Events); options.Select(AppConfigurationKeyFilters.FoundationaLLM_Configuration); - options.Select(AppConfigurationKeyFilters.FoundationaLLM_Attachment); - options.Select(AppConfigurationKeyFilters.FoundationaLLM_AIModel); + + options.Select(AppConfigurationKeyFilters.FoundationaLLM_APIEndpoints_CoreAPI_Configuration_CosmosDB); + options.Select(AppConfigurationKeyFilters.FoundationaLLM_Branding); + options.Select(AppConfigurationKeyFilters.FoundationaLLM_APIEndpoints_ManagementAPI_Configuration_Entra); + options.Select(AppConfigurationKeyFilters.FoundationaLLM_APIEndpoints_VectorizationAPI); + + options.Select(AppConfigurationKeyFilters.FoundationaLLM_ResourceProviders_Vectorization_Storage); + options.Select(AppConfigurationKeyFilters.FoundationaLLM_ResourceProviders_Agent_Storage); + options.Select(AppConfigurationKeyFilters.FoundationaLLM_ResourceProviders_Prompt_Storage); + options.Select(AppConfigurationKeyFilters.FoundationaLLM_ResourceProviders_DataSource_Storage); + options.Select(AppConfigurationKeyFilters.FoundationaLLM_ResourceProviders_Attachment_Storage); + options.Select(AppConfigurationKeyFilters.FoundationaLLM_ResourceProviders_AIModel_Storage); + + options.Select(AppConfigurationKeyFilters.FoundationaLLM_Events_Profiles_ManagementAPI); })); if (builder.Environment.IsDevelopment()) diff --git a/src/dotnet/OrchestrationAPI/Program.cs b/src/dotnet/OrchestrationAPI/Program.cs index fe49b69006..b9c207bc87 100644 --- a/src/dotnet/OrchestrationAPI/Program.cs +++ b/src/dotnet/OrchestrationAPI/Program.cs @@ -49,19 +49,19 @@ public static void Main(string[] args) options.SetCredential(DefaultAuthentication.AzureCredential); }); options.Select(AppConfigurationKeyFilters.FoundationaLLM_Instance); - options.Select((string)AppConfigurationKeyFilters.FoundationaLLM_APIEndpoints); - options.Select((string)AppConfigurationKeyFilters.FoundationaLLM_APIEndpoints); - options.Select(AppConfigurationKeyFilters.FoundationaLLM_Orchestration); - options.Select(AppConfigurationKeyFilters.FoundationaLLM_Agent); - options.Select(AppConfigurationKeyFilters.FoundationaLLM_AzureAI); - options.Select(AppConfigurationKeyFilters.FoundationaLLM_AzureOpenAI); - options.Select(AppConfigurationKeyFilters.FoundationaLLM_Events); - options.Select(AppConfigurationKeyFilters.FoundationaLLM_Prompt); - options.Select(AppConfigurationKeyFilters.FoundationaLLM_Vectorization); options.Select(AppConfigurationKeyFilters.FoundationaLLM_Configuration); - options.Select(AppConfigurationKeyFilters.FoundationaLLM_DataSource); - options.Select(AppConfigurationKeyFilters.FoundationaLLM_Attachment); - options.Select(AppConfigurationKeyFilters.FoundationaLLM_AIModel); + + options.Select(AppConfigurationKeyFilters.FoundationaLLM_APIEndpoints); + + options.Select(AppConfigurationKeyFilters.FoundationaLLM_ResourceProviders_Configuration_Storage); + options.Select(AppConfigurationKeyFilters.FoundationaLLM_ResourceProviders_Agent_Storage); + options.Select(AppConfigurationKeyFilters.FoundationaLLM_ResourceProviders_Vectorization_Storage); + options.Select(AppConfigurationKeyFilters.FoundationaLLM_ResourceProviders_Vectorization_Storage); + options.Select(AppConfigurationKeyFilters.FoundationaLLM_ResourceProviders_DataSource_Storage); + options.Select(AppConfigurationKeyFilters.FoundationaLLM_ResourceProviders_Attachment_Storage); + options.Select(AppConfigurationKeyFilters.FoundationaLLM_ResourceProviders_AIModel_Storage); + + options.Select(AppConfigurationKeyFilters.FoundationaLLM_Events_Profiles_OrchestrationAPI); })); if (builder.Environment.IsDevelopment()) builder.Configuration.AddJsonFile("appsettings.development.json", true, true); diff --git a/src/dotnet/SemanticKernelAPI/Program.cs b/src/dotnet/SemanticKernelAPI/Program.cs index c561598d7e..254f1a1f41 100644 --- a/src/dotnet/SemanticKernelAPI/Program.cs +++ b/src/dotnet/SemanticKernelAPI/Program.cs @@ -43,10 +43,9 @@ public static void Main(string[] args) options.SetCredential(DefaultAuthentication.AzureCredential); }); options.Select(AppConfigurationKeyFilters.FoundationaLLM_Instance); - options.Select((string)AppConfigurationKeyFilters.FoundationaLLM_APIEndpoints); - options.Select(AppConfigurationKeyFilters.FoundationaLLM_BlobStorageMemorySource); - options.Select(AppConfigurationKeyFilters.FoundationaLLM_Events); options.Select(AppConfigurationKeyFilters.FoundationaLLM_Configuration); + options.Select(AppConfigurationKeyFilters.FoundationaLLM_APIEndpoints); + options.Select(AppConfigurationKeyFilters.FoundationaLLM_Events_Profiles_VectorizationAPI); })); if (builder.Environment.IsDevelopment()) builder.Configuration.AddJsonFile("appsettings.development.json", true, true); diff --git a/src/dotnet/StateAPI/Program.cs b/src/dotnet/StateAPI/Program.cs index 4c6ceb6500..1d001c4330 100644 --- a/src/dotnet/StateAPI/Program.cs +++ b/src/dotnet/StateAPI/Program.cs @@ -24,8 +24,7 @@ { options.SetCredential(DefaultAuthentication.AzureCredential); }); - options.Select(AppConfigurationKeyFilters.FoundationaLLM_APIs_StateAPI); - options.Select(AppConfigurationKeyFilters.FoundationaLLM_State); + options.Select(AppConfigurationKeyFilters.FoundationaLLM_APIEndpoints_StateAPI); }); if (builder.Environment.IsDevelopment()) builder.Configuration.AddJsonFile("appsettings.development.json", true, true); diff --git a/src/dotnet/Vectorization/Services/Text/IndexingServiceFactory.cs b/src/dotnet/Vectorization/Services/Text/IndexingServiceFactory.cs index 7c0356c1ad..0850d22746 100644 --- a/src/dotnet/Vectorization/Services/Text/IndexingServiceFactory.cs +++ b/src/dotnet/Vectorization/Services/Text/IndexingServiceFactory.cs @@ -71,7 +71,7 @@ public IIndexingService GetService(string serviceName) private IIndexingService CreateAzureAISearchIndexingService() { var indexingService = _serviceProvider.GetKeyedService( - DependencyInjectionKeys.FoundationaLLM_Vectorization_AzureAISearchIndexingService) + DependencyInjectionKeys.FoundationaLLM_APIEndpoints_AzureAISearchVectorStore_Configuration) ?? throw new VectorizationException($"Could not retrieve the Azure AI Search indexing service instance."); return indexingService!; @@ -80,7 +80,7 @@ private IIndexingService CreateAzureAISearchIndexingService() private IIndexingService CreateAzureCosmosDBNoSQLIndexingService() { var indexingService = _serviceProvider.GetKeyedService( - DependencyInjectionKeys.FoundationaLLM_Vectorization_AzureCosmosDBNoSQLIndexingService) + DependencyInjectionKeys.FoundationaLLM_APIEndpoints_AzureCosmosDBNoSQLVectorStore_Configuration) ?? throw new VectorizationException($"Could not retrieve the Azure Cosmos DB NoSQL indexing service instance."); return indexingService!; @@ -89,7 +89,7 @@ private IIndexingService CreateAzureCosmosDBNoSQLIndexingService() private IIndexingService CreatePostgresIndexingService() { var indexingService = _serviceProvider.GetKeyedService( - DependencyInjectionKeys.FoundationaLLM_Vectorization_PostgresIndexingService) + DependencyInjectionKeys.FoundationaLLM_APIEndpoints_AzurePostgreSQLVectorStore_Configuration) ?? throw new VectorizationException($"Could not retrieve the PostgreSQL indexing service instance."); return indexingService!; diff --git a/src/dotnet/Vectorization/Services/Text/TextEmbeddingServiceFactory.cs b/src/dotnet/Vectorization/Services/Text/TextEmbeddingServiceFactory.cs index 935fe9e831..53cad90d90 100644 --- a/src/dotnet/Vectorization/Services/Text/TextEmbeddingServiceFactory.cs +++ b/src/dotnet/Vectorization/Services/Text/TextEmbeddingServiceFactory.cs @@ -103,7 +103,7 @@ private ITextEmbeddingService CreateGatewayTextEmbeddingService() { using var scope = _serviceProvider.CreateScope(); var textEmbeddingService = scope.ServiceProvider.GetKeyedService( - DependencyInjectionKeys.FoundationaLLM_Vectorization_GatewayTextEmbeddingService) + DependencyInjectionKeys.FoundationaLLM_Vectorization_TextEmbedding_Gateway) ?? throw new VectorizationException($"Could not retrieve the Gateway text embedding service instance."); return textEmbeddingService!; diff --git a/src/dotnet/Vectorization/Services/VectorizationStates/BlobStorageVectorizationStateService.cs b/src/dotnet/Vectorization/Services/VectorizationStates/BlobStorageVectorizationStateService.cs index 1365d60a47..b62ced0e00 100644 --- a/src/dotnet/Vectorization/Services/VectorizationStates/BlobStorageVectorizationStateService.cs +++ b/src/dotnet/Vectorization/Services/VectorizationStates/BlobStorageVectorizationStateService.cs @@ -24,7 +24,7 @@ namespace FoundationaLLM.Vectorization.Services.VectorizationStates /// The that provides storage services. /// The logger factory used to create loggers. public class BlobStorageVectorizationStateService( - [FromKeyedServices(DependencyInjectionKeys.FoundationaLLM_Vectorization_BlobStorageVectorizationStateService)] IStorageService storageService, + [FromKeyedServices(DependencyInjectionKeys.FoundationaLLM_Vectorization_StateService_Storage)] IStorageService storageService, ILoggerFactory loggerFactory) : VectorizationStateServiceBase, IVectorizationStateService { private readonly IStorageService _storageService = storageService; diff --git a/src/dotnet/VectorizationAPI/Program.cs b/src/dotnet/VectorizationAPI/Program.cs index 4d03b6d8eb..8f9320f24e 100644 --- a/src/dotnet/VectorizationAPI/Program.cs +++ b/src/dotnet/VectorizationAPI/Program.cs @@ -45,12 +45,15 @@ options.SetCredential(DefaultAuthentication.AzureCredential); }); options.Select(AppConfigurationKeyFilters.FoundationaLLM_Instance); - options.Select(AppConfigurationKeyFilters.FoundationaLLM_Vectorization); - options.Select(AppConfigurationKeyFilters.FoundationaLLM_APIs_VectorizationAPI); - options.Select(AppConfigurationKeyFilters.FoundationaLLM_APIs_GatewayAPI); - options.Select(AppConfigurationKeyFilters.FoundationaLLM_Events); options.Select(AppConfigurationKeyFilters.FoundationaLLM_Configuration); - options.Select(AppConfigurationKeyFilters.FoundationaLLM_DataSource); //resource provider settings + options.Select(AppConfigurationKeyFilters.FoundationaLLM_Vectorization_Queues); + options.Select(AppConfigurationKeyFilters.FoundationaLLM_Vectorization_Steps); + options.Select(AppConfigurationKeyFilters.FoundationaLLM_Vectorization_StateService_Storage); + options.Select(AppConfigurationKeyFilters.FoundationaLLM_APIEndpoints_VectorizationAPI); + options.Select(AppConfigurationKeyFilters.FoundationaLLM_APIEndpoints_GatewayAPI); + options.Select(AppConfigurationKeyFilters.FoundationaLLM_Events_Profiles_VectorizationAPI); + + options.Select(AppConfigurationKeyFilters.FoundationaLLM_ResourceProviders_DataSource_Storage); //resource provider settings options.Select(AppConfigurationKeyFilters.FoundationaLLM_DataSources); //data source settings }); if (builder.Environment.IsDevelopment()) @@ -147,7 +150,7 @@ // Gateway text embedding builder.Services.AddKeyedScoped( - DependencyInjectionKeys.FoundationaLLM_Vectorization_GatewayTextEmbeddingService); + DependencyInjectionKeys.FoundationaLLM_Vectorization_TextEmbedding_Gateway); builder.AddGatewayService(); builder.Services.AddScoped(); @@ -155,11 +158,11 @@ // Indexing builder.Services.AddKeyedSingleton( - DependencyInjectionKeys.FoundationaLLM_Vectorization_AzureAISearchIndexingService); + DependencyInjectionKeys.FoundationaLLM_APIEndpoints_AzureAISearchVectorStore_Configuration); builder.Services.AddKeyedSingleton( - DependencyInjectionKeys.FoundationaLLM_Vectorization_AzureCosmosDBNoSQLIndexingService); + DependencyInjectionKeys.FoundationaLLM_APIEndpoints_AzureCosmosDBNoSQLVectorStore_Configuration); builder.Services.AddKeyedSingleton( - DependencyInjectionKeys.FoundationaLLM_Vectorization_PostgresIndexingService); + DependencyInjectionKeys.FoundationaLLM_APIEndpoints_AzurePostgreSQLVectorStore_Configuration); builder.Services.AddTransient, ConfigureSwaggerOptions>(); builder.Services.AddTransient(); diff --git a/src/dotnet/VectorizationWorker/Program.cs b/src/dotnet/VectorizationWorker/Program.cs index 7607872d4d..9b04346c8c 100644 --- a/src/dotnet/VectorizationWorker/Program.cs +++ b/src/dotnet/VectorizationWorker/Program.cs @@ -43,14 +43,18 @@ options.SetCredential(DefaultAuthentication.AzureCredential); }); options.Select(AppConfigurationKeyFilters.FoundationaLLM_Instance); - options.Select(AppConfigurationKeyFilters.FoundationaLLM_Vectorization); - options.Select(AppConfigurationKeyFilters.FoundationaLLM_APIs_VectorizationWorker); - options.Select(AppConfigurationKeyFilters.FoundationaLLM_APIs_GatewayAPI); - options.Select(AppConfigurationKeyFilters.FoundationaLLM_Events); options.Select(AppConfigurationKeyFilters.FoundationaLLM_Configuration); - options.Select(AppConfigurationKeyFilters.FoundationaLLM_DataSource); //resource provider settings + options.Select(AppConfigurationKeyFilters.FoundationaLLM_Vectorization_Queues); + options.Select(AppConfigurationKeyFilters.FoundationaLLM_Vectorization_Steps); + options.Select(AppConfigurationKeyFilters.FoundationaLLM_Vectorization_StateService_Storage); + options.Select(AppConfigurationKeyFilters.FoundationaLLM_APIEndpoints_VectorizationWorker); + options.Select(AppConfigurationKeyFilters.FoundationaLLM_APIEndpoints_GatewayAPI); + options.Select(AppConfigurationKeyFilters.FoundationaLLM_Events_Profiles_VectorizationWorker); + + options.Select(AppConfigurationKeyFilters.FoundationaLLM_ResourceProviders_DataSource_Storage); //resource provider settings + options.Select(AppConfigurationKeyFilters.FoundationaLLM_ResourceProviders_Vectorization_Storage); //resource provider settings + options.Select(AppConfigurationKeyFilters.FoundationaLLM_DataSources); //data source settings - options.Select(AppConfigurationKeyFilters.FoundationaLLM_Vectorization); //vectorization settings }); if (builder.Environment.IsDevelopment()) @@ -83,7 +87,7 @@ .Bind(builder.Configuration.GetSection(AppConfigurationKeys.FoundationaLLM_Vectorization_Worker)); builder.Services.AddOptions( - DependencyInjectionKeys.FoundationaLLM_Vectorization_BlobStorageVectorizationStateService) + DependencyInjectionKeys.FoundationaLLM_Vectorization_StateService_Storage) .Bind(builder.Configuration.GetSection(AppConfigurationKeySections.FoundationaLLM_Vectorization_StateService_Storage)); builder.Services.AddOptions() @@ -117,10 +121,10 @@ }); builder.Services.AddKeyedSingleton( - DependencyInjectionKeys.FoundationaLLM_Vectorization_BlobStorageVectorizationStateService, (sp, obj) => + DependencyInjectionKeys.FoundationaLLM_Vectorization_StateService_Storage, (sp, obj) => { var settings = sp.GetRequiredService>() - .Get(DependencyInjectionKeys.FoundationaLLM_Vectorization_BlobStorageVectorizationStateService); + .Get(DependencyInjectionKeys.FoundationaLLM_Vectorization_StateService_Storage); var logger = sp.GetRequiredService>(); return new BlobStorageService( @@ -151,7 +155,7 @@ // Gateway text embedding builder.Services.AddKeyedScoped( - DependencyInjectionKeys.FoundationaLLM_Vectorization_GatewayTextEmbeddingService); + DependencyInjectionKeys.FoundationaLLM_Vectorization_TextEmbedding_Gateway); builder.AddGatewayService(); builder.Services.AddScoped(); @@ -159,11 +163,11 @@ // Indexing builder.Services.AddKeyedSingleton( - DependencyInjectionKeys.FoundationaLLM_Vectorization_AzureAISearchIndexingService); + DependencyInjectionKeys.FoundationaLLM_APIEndpoints_AzureAISearchVectorStore_Configuration); builder.Services.AddKeyedSingleton( - DependencyInjectionKeys.FoundationaLLM_Vectorization_AzureCosmosDBNoSQLIndexingService); + DependencyInjectionKeys.FoundationaLLM_APIEndpoints_AzureCosmosDBNoSQLVectorStore_Configuration); builder.Services.AddKeyedSingleton( - DependencyInjectionKeys.FoundationaLLM_Vectorization_PostgresIndexingService); + DependencyInjectionKeys.FoundationaLLM_APIEndpoints_AzurePostgreSQLVectorStore_Configuration); builder.Services.AddTransient(); diff --git a/tests/dotnet/Core.Examples/Setup/TestFixture.cs b/tests/dotnet/Core.Examples/Setup/TestFixture.cs index ce69939b38..084fbe79d0 100644 --- a/tests/dotnet/Core.Examples/Setup/TestFixture.cs +++ b/tests/dotnet/Core.Examples/Setup/TestFixture.cs @@ -35,17 +35,8 @@ public TestFixture() { kv.SetCredential(DefaultAuthentication.AzureCredential); }) - // Select the configuration sections to load: - .Select(AppConfigurationKeyFilters.FoundationaLLM_Instance) - .Select((string)AppConfigurationKeyFilters.FoundationaLLM_APIEndpoints) - .Select(AppConfigurationKeyFilters.FoundationaLLM_Chat_Entra) - .Select(AppConfigurationKeyFilters.FoundationaLLM_Management_Entra) - .Select(AppConfigurationKeyFilters.FoundationaLLM_CosmosDB) - .Select(AppConfigurationKeyFilters.FoundationaLLM_AzureAIStudio) - .Select(AppConfigurationKeyFilters.FoundationaLLM_APIs_VectorizationAPI) - .Select(AppConfigurationKeyFilters.FoundationaLLM_Vectorization) - .Select(AppConfigurationKeyFilters.FoundationaLLM_DataSources) - .Select(AppConfigurationKeyFilters.FoundationaLLM_AzureAIStudio_BlobStorageServiceSettings); + // Select all configuration sections + .Select("*"); })) .Build(); diff --git a/tests/dotnet/Core.Examples/Setup/TestServicesInitializer.cs b/tests/dotnet/Core.Examples/Setup/TestServicesInitializer.cs index 51a09325c2..e277eadf17 100644 --- a/tests/dotnet/Core.Examples/Setup/TestServicesInitializer.cs +++ b/tests/dotnet/Core.Examples/Setup/TestServicesInitializer.cs @@ -67,7 +67,7 @@ private static void RegisterSearchIndex(IServiceCollection services, IConfigurat .Bind(configuration.GetSection(AppConfigurationKeySections.FoundationaLLM_APIEndpoints_AzureAISearchVectorStore_Configuration)); services.AddKeyedSingleton( - DependencyInjectionKeys.FoundationaLLM_Vectorization_AzureAISearchIndexingService); + DependencyInjectionKeys.FoundationaLLM_APIEndpoints_AzureAISearchVectorStore_Configuration); }