From 80f08e6e1e129edb14eb89df6020c7540faf7606 Mon Sep 17 00:00:00 2001 From: codingbandit Date: Tue, 30 Jul 2024 16:26:23 -0400 Subject: [PATCH 01/22] Add Essentials to LangChain App Insights connection string --- src/python/LangChainAPI/app/main.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/python/LangChainAPI/app/main.py b/src/python/LangChainAPI/app/main.py index 4a4fcfff37..dcc34051ed 100644 --- a/src/python/LangChainAPI/app/main.py +++ b/src/python/LangChainAPI/app/main.py @@ -14,7 +14,7 @@ # Open a connection to the app configuration config = get_config() # Start collecting telemetry -Telemetry.configure_monitoring(config, f'FoundationaLLM:APIEndpoints:{API_NAME}:AppInsightsConnectionString') +Telemetry.configure_monitoring(config, f'FoundationaLLM:APIEndpoints:{API_NAME}:Essentials:AppInsightsConnectionString') app = FastAPI( title=f'FoundationaLLM {API_NAME}', From ef7264424a4b8ba59084b5c79239a869bb30881c Mon Sep 17 00:00:00 2001 From: codingbandit Date: Tue, 30 Jul 2024 16:32:33 -0400 Subject: [PATCH 02/22] Add ManagementAPI Essentials to Management API config load --- src/dotnet/ManagementAPI/Program.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/dotnet/ManagementAPI/Program.cs b/src/dotnet/ManagementAPI/Program.cs index db64d907e7..864d87bf4c 100644 --- a/src/dotnet/ManagementAPI/Program.cs +++ b/src/dotnet/ManagementAPI/Program.cs @@ -44,11 +44,10 @@ public static void Main(string[] args) options.Select(AppConfigurationKeyFilters.FoundationaLLM_Instance); options.Select(AppConfigurationKeyFilters.FoundationaLLM_Configuration); - 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_ManagementAPI_Essentials); options.Select(AppConfigurationKeyFilters.FoundationaLLM_APIEndpoints_AuthorizationAPI_Essentials); options.Select(AppConfigurationKeyFilters.FoundationaLLM_ResourceProviders_Vectorization_Storage); options.Select(AppConfigurationKeyFilters.FoundationaLLM_ResourceProviders_Agent_Storage); From 473689bd339f3d1cc092ed252802c37228e2c927 Mon Sep 17 00:00:00 2001 From: codingbandit Date: Tue, 30 Jul 2024 17:35:48 -0400 Subject: [PATCH 03/22] Update APIEndpointConfiguration APIKey namespaces --- .../FoundationaLLM.Configuration/AzureEventGrid.json | 4 ++-- .../AzureContentSafety.template.json | 2 +- .../FoundationaLLM.Configuration/AzureEventGrid.template.json | 2 +- .../FoundationaLLM.Configuration/AzureOpenAI.template.json | 2 +- .../FoundationaLLM.Configuration/GatekeeperAPI.template.json | 2 +- .../GatekeeperIntegrationAPI.template.json | 2 +- .../FoundationaLLM.Configuration/GatewayAPI.template.json | 2 +- .../GatewayAdapterAPI.template.json | 2 +- .../FoundationaLLM.Configuration/LangChainAPI.template.json | 2 +- .../OrchestrationAPI.template.json | 2 +- .../SemanticKernelAPI.template.json | 2 +- .../FoundationaLLM.Configuration/StateAPI.template.json | 2 +- .../VectorizationAPI.template.json | 2 +- .../VectorizationWorker.template.json | 2 +- .../AzureContentSafety.template.json | 2 +- .../FoundationaLLM.Configuration/AzureEventGrid.template.json | 2 +- .../FoundationaLLM.Configuration/AzureOpenAI.template.json | 2 +- .../FoundationaLLM.Configuration/GatekeeperAPI.template.json | 2 +- .../GatekeeperIntegrationAPI.template.json | 2 +- .../FoundationaLLM.Configuration/GatewayAPI.template.json | 2 +- .../GatewayAdapterAPI.template.json | 2 +- .../FoundationaLLM.Configuration/LangChainAPI.template.json | 2 +- .../OrchestrationAPI.template.json | 2 +- .../SemanticKernelAPI.template.json | 2 +- .../FoundationaLLM.Configuration/StateAPI.template.json | 2 +- .../VectorizationAPI.template.json | 2 +- .../VectorizationWorker.template.json | 2 +- 27 files changed, 28 insertions(+), 28 deletions(-) diff --git a/deploy/common/data/resource-provider/FoundationaLLM.Configuration/AzureEventGrid.json b/deploy/common/data/resource-provider/FoundationaLLM.Configuration/AzureEventGrid.json index 25ceb87529..b2666cdec6 100644 --- a/deploy/common/data/resource-provider/FoundationaLLM.Configuration/AzureEventGrid.json +++ b/deploy/common/data/resource-provider/FoundationaLLM.Configuration/AzureEventGrid.json @@ -8,10 +8,10 @@ "category": "General", "authentication_type": "APIKey", "authentication_parameters": { - "api_key_configuration_name": "FoundationaLLM:APIEndpoints:AzureEventGrid:APIKey" + "api_key_configuration_name": "FoundationaLLM:APIEndpoints:AzureEventGrid:Essentials:APIKey" }, "url": "https://eg-mg08-fllmstd-westus-svc.westus3-1.eventgrid.azure.net/", "url_exceptions": [], "timeout_seconds": 60, "retry_strategy_name": "ExponentialBackoff" -} +} diff --git a/deploy/quick-start/data/resource-provider/FoundationaLLM.Configuration/AzureContentSafety.template.json b/deploy/quick-start/data/resource-provider/FoundationaLLM.Configuration/AzureContentSafety.template.json index 359bbe7c52..8c8b26c54a 100644 --- a/deploy/quick-start/data/resource-provider/FoundationaLLM.Configuration/AzureContentSafety.template.json +++ b/deploy/quick-start/data/resource-provider/FoundationaLLM.Configuration/AzureContentSafety.template.json @@ -8,7 +8,7 @@ "category": "Gatekeeper", "authentication_type": "APIKey", "authentication_parameters":{ - "api_key_configuration_name": "FoundationaLLM:APIEndpoints:AzureContentSafety:APIKey", + "api_key_configuration_name": "FoundationaLLM:APIEndpoints:AzureContentSafety:Essentials:APIKey", "api_key_header_name": "Ocp-Apim-Subscription-Key" }, "url": "${env:AZURE_CONTENT_SAFETY_ENDPOINT}", diff --git a/deploy/quick-start/data/resource-provider/FoundationaLLM.Configuration/AzureEventGrid.template.json b/deploy/quick-start/data/resource-provider/FoundationaLLM.Configuration/AzureEventGrid.template.json index 5e376c0323..fbee942e44 100644 --- a/deploy/quick-start/data/resource-provider/FoundationaLLM.Configuration/AzureEventGrid.template.json +++ b/deploy/quick-start/data/resource-provider/FoundationaLLM.Configuration/AzureEventGrid.template.json @@ -8,7 +8,7 @@ "category": "General", "authentication_type": "APIKey", "authentication_parameters": { - "api_key_configuration_name": "FoundationaLLM:APIEndpoints:AzureEventGrid:APIKey" + "api_key_configuration_name": "FoundationaLLM:APIEndpoints:AzureEventGrid:Essentials:APIKey" }, "url": "${env:AZURE_EVENT_GRID_ENDPOINT}", "url_exceptions": [], diff --git a/deploy/quick-start/data/resource-provider/FoundationaLLM.Configuration/AzureOpenAI.template.json b/deploy/quick-start/data/resource-provider/FoundationaLLM.Configuration/AzureOpenAI.template.json index bd3e52894a..c9802c2995 100644 --- a/deploy/quick-start/data/resource-provider/FoundationaLLM.Configuration/AzureOpenAI.template.json +++ b/deploy/quick-start/data/resource-provider/FoundationaLLM.Configuration/AzureOpenAI.template.json @@ -8,7 +8,7 @@ "category": "General", "authentication_type": "APIKey", "authentication_parameters": { - "api_key_configuration_name": "FoundationaLLM:APIEndpoints:AzureOpenAI:APIKey" + "api_key_configuration_name": "FoundationaLLM:APIEndpoints:AzureOpenAI:Essentials:APIKey" }, "url": "${env:AZURE_OPENAI_ENDPOINT}", "url_exceptions": [], diff --git a/deploy/quick-start/data/resource-provider/FoundationaLLM.Configuration/GatekeeperAPI.template.json b/deploy/quick-start/data/resource-provider/FoundationaLLM.Configuration/GatekeeperAPI.template.json index e29dd66b78..31b1da9ef9 100644 --- a/deploy/quick-start/data/resource-provider/FoundationaLLM.Configuration/GatekeeperAPI.template.json +++ b/deploy/quick-start/data/resource-provider/FoundationaLLM.Configuration/GatekeeperAPI.template.json @@ -8,7 +8,7 @@ "category": "Gatekeeper", "authentication_type": "APIKey", "authentication_parameters":{ - "api_key_configuration_name": "FoundationaLLM:APIEndpoints:GatekeeperAPI:APIKey", + "api_key_configuration_name": "FoundationaLLM:APIEndpoints:GatekeeperAPI:Essentials:APIKey", "api_key_header_name": "X-API-KEY" }, "url": "${env:SERVICE_GATEKEEPER_API_ENDPOINT_URL}", diff --git a/deploy/quick-start/data/resource-provider/FoundationaLLM.Configuration/GatekeeperIntegrationAPI.template.json b/deploy/quick-start/data/resource-provider/FoundationaLLM.Configuration/GatekeeperIntegrationAPI.template.json index 646b6a95bf..40fd95a6be 100644 --- a/deploy/quick-start/data/resource-provider/FoundationaLLM.Configuration/GatekeeperIntegrationAPI.template.json +++ b/deploy/quick-start/data/resource-provider/FoundationaLLM.Configuration/GatekeeperIntegrationAPI.template.json @@ -8,7 +8,7 @@ "category": "Gatekeeper", "authentication_type": "APIKey", "authentication_parameters":{ - "api_key_configuration_name": "FoundationaLLM:APIEndpoints:GatekeeperIntegrationAPI:APIKey", + "api_key_configuration_name": "FoundationaLLM:APIEndpoints:GatekeeperIntegrationAPI:Essentials:APIKey", "api_key_header_name": "X-API-KEY" }, "url": "${env:SERVICE_GATEKEEPER_INTEGRATION_API_ENDPOINT_URL}", diff --git a/deploy/quick-start/data/resource-provider/FoundationaLLM.Configuration/GatewayAPI.template.json b/deploy/quick-start/data/resource-provider/FoundationaLLM.Configuration/GatewayAPI.template.json index 7cc4d2adf0..6d772e85fd 100644 --- a/deploy/quick-start/data/resource-provider/FoundationaLLM.Configuration/GatewayAPI.template.json +++ b/deploy/quick-start/data/resource-provider/FoundationaLLM.Configuration/GatewayAPI.template.json @@ -8,7 +8,7 @@ "category": "General", "authentication_type": "APIKey", "authentication_parameters":{ - "api_key_configuration_name": "FoundationaLLM:APIEndpoints:GatewayAPI:APIKey", + "api_key_configuration_name": "FoundationaLLM:APIEndpoints:GatewayAPI:Essentials:APIKey", "api_key_header_name": "X-API-KEY" }, "url": "${env:SERVICE_GATEWAY_API_ENDPOINT_URL}", diff --git a/deploy/quick-start/data/resource-provider/FoundationaLLM.Configuration/GatewayAdapterAPI.template.json b/deploy/quick-start/data/resource-provider/FoundationaLLM.Configuration/GatewayAdapterAPI.template.json index 75745abd9c..9ef8e70d91 100644 --- a/deploy/quick-start/data/resource-provider/FoundationaLLM.Configuration/GatewayAdapterAPI.template.json +++ b/deploy/quick-start/data/resource-provider/FoundationaLLM.Configuration/GatewayAdapterAPI.template.json @@ -8,7 +8,7 @@ "category": "General", "authentication_type": "APIKey", "authentication_parameters": { - "api_key_configuration_name": "FoundationaLLM:APIEndpoints:GatewayAdapterAPI:APIKey", + "api_key_configuration_name": "FoundationaLLM:APIEndpoints:GatewayAdapterAPI:Essentials:APIKey", "api_key_header_name": "X-API-KEY" }, "url": "${env:SERVICE_GATEWAY_ADAPTER_API_ENDPOINT_URL}", diff --git a/deploy/quick-start/data/resource-provider/FoundationaLLM.Configuration/LangChainAPI.template.json b/deploy/quick-start/data/resource-provider/FoundationaLLM.Configuration/LangChainAPI.template.json index 7878578120..dbebce8290 100644 --- a/deploy/quick-start/data/resource-provider/FoundationaLLM.Configuration/LangChainAPI.template.json +++ b/deploy/quick-start/data/resource-provider/FoundationaLLM.Configuration/LangChainAPI.template.json @@ -8,7 +8,7 @@ "category": "Orchestration", "authentication_type": "APIKey", "authentication_parameters":{ - "api_key_configuration_name": "FoundationaLLM:APIEndpoints:LangChainAPI:APIKey", + "api_key_configuration_name": "FoundationaLLM:APIEndpoints:LangChainAPI:Essentials:APIKey", "api_key_header_name": "X-API-KEY" }, "url": "${env:SERVICE_LANGCHAIN_API_ENDPOINT_URL}", diff --git a/deploy/quick-start/data/resource-provider/FoundationaLLM.Configuration/OrchestrationAPI.template.json b/deploy/quick-start/data/resource-provider/FoundationaLLM.Configuration/OrchestrationAPI.template.json index 8aac220eff..a3d24b8f70 100644 --- a/deploy/quick-start/data/resource-provider/FoundationaLLM.Configuration/OrchestrationAPI.template.json +++ b/deploy/quick-start/data/resource-provider/FoundationaLLM.Configuration/OrchestrationAPI.template.json @@ -8,7 +8,7 @@ "category": "General", "authentication_type": "APIKey", "authentication_parameters": { - "api_key_configuration_name": "FoundationaLLM:APIEndpoints:OrchestrationAPI:APIKey", + "api_key_configuration_name": "FoundationaLLM:APIEndpoints:OrchestrationAPI:Essentials:APIKey", "api_key_header_name": "X-API-KEY" }, "url": "${env:SERVICE_ORCHESTRATION_API_ENDPOINT_URL}", diff --git a/deploy/quick-start/data/resource-provider/FoundationaLLM.Configuration/SemanticKernelAPI.template.json b/deploy/quick-start/data/resource-provider/FoundationaLLM.Configuration/SemanticKernelAPI.template.json index 54e77fc860..c7b193a94d 100644 --- a/deploy/quick-start/data/resource-provider/FoundationaLLM.Configuration/SemanticKernelAPI.template.json +++ b/deploy/quick-start/data/resource-provider/FoundationaLLM.Configuration/SemanticKernelAPI.template.json @@ -8,7 +8,7 @@ "category": "Orchestration", "authentication_type": "APIKey", "authentication_parameters": { - "api_key_configuration_name": "FoundationaLLM:APIEndpoints:SemanticKernelAPI:APIKey", + "api_key_configuration_name": "FoundationaLLM:APIEndpoints:SemanticKernelAPI:Essentials:APIKey", "api_key_header_name": "X-API-KEY" }, "url": "${env:SERVICE_SEMANTIC_KERNEL_API_ENDPOINT_URL}", diff --git a/deploy/quick-start/data/resource-provider/FoundationaLLM.Configuration/StateAPI.template.json b/deploy/quick-start/data/resource-provider/FoundationaLLM.Configuration/StateAPI.template.json index 0b4a0c3721..36c73aa2c9 100644 --- a/deploy/quick-start/data/resource-provider/FoundationaLLM.Configuration/StateAPI.template.json +++ b/deploy/quick-start/data/resource-provider/FoundationaLLM.Configuration/StateAPI.template.json @@ -8,7 +8,7 @@ "category": "General", "authentication_type": "APIKey", "authentication_parameters": { - "api_key_configuration_name": "FoundationaLLM:APIEndpoints:StateAPI:APIKey", + "api_key_configuration_name": "FoundationaLLM:APIEndpoints:StateAPI:Essentials:APIKey", "api_key_header_name": "X-API-KEY" }, "url": "${env:SERVICE_STATE_API_ENDPOINT_URL}", diff --git a/deploy/quick-start/data/resource-provider/FoundationaLLM.Configuration/VectorizationAPI.template.json b/deploy/quick-start/data/resource-provider/FoundationaLLM.Configuration/VectorizationAPI.template.json index 9e1db3107c..b8b7c7bea8 100644 --- a/deploy/quick-start/data/resource-provider/FoundationaLLM.Configuration/VectorizationAPI.template.json +++ b/deploy/quick-start/data/resource-provider/FoundationaLLM.Configuration/VectorizationAPI.template.json @@ -8,7 +8,7 @@ "category": "General", "authentication_type": "APIKey", "authentication_parameters": { - "api_key_configuration_name": "FoundationaLLM:APIEndpoints:VectorizationAPI:APIKey", + "api_key_configuration_name": "FoundationaLLM:APIEndpoints:VectorizationAPI:Essentials:APIKey", "api_key_header_name": "X-API-KEY" }, "url": "${env:SERVICE_VECTORIZATION_API_ENDPOINT_URL}", diff --git a/deploy/quick-start/data/resource-provider/FoundationaLLM.Configuration/VectorizationWorker.template.json b/deploy/quick-start/data/resource-provider/FoundationaLLM.Configuration/VectorizationWorker.template.json index 5b32971200..55a1d30af6 100644 --- a/deploy/quick-start/data/resource-provider/FoundationaLLM.Configuration/VectorizationWorker.template.json +++ b/deploy/quick-start/data/resource-provider/FoundationaLLM.Configuration/VectorizationWorker.template.json @@ -8,7 +8,7 @@ "category": "General", "authentication_type": "APIKey", "authentication_parameters": { - "api_key_configuration_name": "FoundationaLLM:APIEndpoints:VectorizationWorker:APIKey", + "api_key_configuration_name": "FoundationaLLM:APIEndpoints:VectorizationWorker:Essentials:APIKey", "api_key_header_name": "X-API-KEY" }, "url": "${env:SERVICE_VECTORIZATION_JOB_ENDPOINT_URL}", diff --git a/deploy/standard/data/resource-provider/FoundationaLLM.Configuration/AzureContentSafety.template.json b/deploy/standard/data/resource-provider/FoundationaLLM.Configuration/AzureContentSafety.template.json index ba30c47311..bf0886eeeb 100644 --- a/deploy/standard/data/resource-provider/FoundationaLLM.Configuration/AzureContentSafety.template.json +++ b/deploy/standard/data/resource-provider/FoundationaLLM.Configuration/AzureContentSafety.template.json @@ -8,7 +8,7 @@ "category": "Gatekeeper", "authentication_type": "APIKey", "authentication_parameters":{ - "api_key_configuration_name": "FoundationaLLM:APIEndpoints:AzureContentSafety:APIKey", + "api_key_configuration_name": "FoundationaLLM:APIEndpoints:AzureContentSafety:Essentials:APIKey", "api_key_header_name": "Ocp-Apim-Subscription-Key" }, "url": "{{contentSafetyEndpointUri}}", diff --git a/deploy/standard/data/resource-provider/FoundationaLLM.Configuration/AzureEventGrid.template.json b/deploy/standard/data/resource-provider/FoundationaLLM.Configuration/AzureEventGrid.template.json index 79803b9182..6fa182fa2f 100644 --- a/deploy/standard/data/resource-provider/FoundationaLLM.Configuration/AzureEventGrid.template.json +++ b/deploy/standard/data/resource-provider/FoundationaLLM.Configuration/AzureEventGrid.template.json @@ -8,7 +8,7 @@ "category": "General", "authentication_type": "APIKey", "authentication_parameters": { - "api_key_configuration_name": "FoundationaLLM:APIEndpoints:AzureEventGrid:APIKey" + "api_key_configuration_name": "FoundationaLLM:APIEndpoints:AzureEventGrid:Essentials:APIKey" }, "url": "{{eventGridNamespaceEndpoint}}", "url_exceptions": [], diff --git a/deploy/standard/data/resource-provider/FoundationaLLM.Configuration/AzureOpenAI.template.json b/deploy/standard/data/resource-provider/FoundationaLLM.Configuration/AzureOpenAI.template.json index e7fbd2db81..65faad122f 100644 --- a/deploy/standard/data/resource-provider/FoundationaLLM.Configuration/AzureOpenAI.template.json +++ b/deploy/standard/data/resource-provider/FoundationaLLM.Configuration/AzureOpenAI.template.json @@ -8,7 +8,7 @@ "category": "General", "authentication_type": "APIKey", "authentication_parameters": { - "api_key_configuration_name": "FoundationaLLM:APIEndpoints:AzureOpenAI:APIKey" + "api_key_configuration_name": "FoundationaLLM:APIEndpoints:AzureOpenAI:Essentials:APIKey" }, "url": "{{openAiEndpointUri}}", "url_exceptions": [], diff --git a/deploy/standard/data/resource-provider/FoundationaLLM.Configuration/GatekeeperAPI.template.json b/deploy/standard/data/resource-provider/FoundationaLLM.Configuration/GatekeeperAPI.template.json index 328c6af407..1efe991957 100644 --- a/deploy/standard/data/resource-provider/FoundationaLLM.Configuration/GatekeeperAPI.template.json +++ b/deploy/standard/data/resource-provider/FoundationaLLM.Configuration/GatekeeperAPI.template.json @@ -8,7 +8,7 @@ "category": "Gatekeeper", "authentication_type": "APIKey", "authentication_parameters":{ - "api_key_configuration_name": "FoundationaLLM:APIEndpoints:GatekeeperAPI:APIKey", + "api_key_configuration_name": "FoundationaLLM:APIEndpoints:GatekeeperAPI:Essentials:APIKey", "api_key_header_name": "X-API-KEY" }, "url": "http://gatekeeper-api/gatekeeper", diff --git a/deploy/standard/data/resource-provider/FoundationaLLM.Configuration/GatekeeperIntegrationAPI.template.json b/deploy/standard/data/resource-provider/FoundationaLLM.Configuration/GatekeeperIntegrationAPI.template.json index 4038a9f24f..2c8371ea30 100644 --- a/deploy/standard/data/resource-provider/FoundationaLLM.Configuration/GatekeeperIntegrationAPI.template.json +++ b/deploy/standard/data/resource-provider/FoundationaLLM.Configuration/GatekeeperIntegrationAPI.template.json @@ -8,7 +8,7 @@ "category": "Gatekeeper", "authentication_type": "APIKey", "authentication_parameters":{ - "api_key_configuration_name": "FoundationaLLM:APIEndpoints:GatekeeperIntegrationAPI:APIKey", + "api_key_configuration_name": "FoundationaLLM:APIEndpoints:GatekeeperIntegrationAPI:Essentials:APIKey", "api_key_header_name": "X-API-KEY" }, "url": "http://gatekeeper-integration-api/gatekeeperintegration", diff --git a/deploy/standard/data/resource-provider/FoundationaLLM.Configuration/GatewayAPI.template.json b/deploy/standard/data/resource-provider/FoundationaLLM.Configuration/GatewayAPI.template.json index e53dc4d784..36a8825a75 100644 --- a/deploy/standard/data/resource-provider/FoundationaLLM.Configuration/GatewayAPI.template.json +++ b/deploy/standard/data/resource-provider/FoundationaLLM.Configuration/GatewayAPI.template.json @@ -8,7 +8,7 @@ "category": "General", "authentication_type": "APIKey", "authentication_parameters":{ - "api_key_configuration_name": "FoundationaLLM:APIEndpoints:GatewayAPI:APIKey", + "api_key_configuration_name": "FoundationaLLM:APIEndpoints:GatewayAPI:Essentials:APIKey", "api_key_header_name": "X-API-KEY" }, "url": "http://gateway-api/gateway", diff --git a/deploy/standard/data/resource-provider/FoundationaLLM.Configuration/GatewayAdapterAPI.template.json b/deploy/standard/data/resource-provider/FoundationaLLM.Configuration/GatewayAdapterAPI.template.json index 604dad6d82..cca8dcde0e 100644 --- a/deploy/standard/data/resource-provider/FoundationaLLM.Configuration/GatewayAdapterAPI.template.json +++ b/deploy/standard/data/resource-provider/FoundationaLLM.Configuration/GatewayAdapterAPI.template.json @@ -8,7 +8,7 @@ "category": "General", "authentication_type": "APIKey", "authentication_parameters": { - "api_key_configuration_name": "FoundationaLLM:APIEndpoints:GatewayAdapterAPI:APIKey", + "api_key_configuration_name": "FoundationaLLM:APIEndpoints:GatewayAdapterAPI:Essentials:APIKey", "api_key_header_name": "X-API-KEY" }, "url": "http://gateway-adapter-api/gatewayadapter", diff --git a/deploy/standard/data/resource-provider/FoundationaLLM.Configuration/LangChainAPI.template.json b/deploy/standard/data/resource-provider/FoundationaLLM.Configuration/LangChainAPI.template.json index 9218e6360b..e4040519f2 100644 --- a/deploy/standard/data/resource-provider/FoundationaLLM.Configuration/LangChainAPI.template.json +++ b/deploy/standard/data/resource-provider/FoundationaLLM.Configuration/LangChainAPI.template.json @@ -8,7 +8,7 @@ "category": "Orchestration", "authentication_type": "APIKey", "authentication_parameters":{ - "api_key_configuration_name": "FoundationaLLM:APIEndpoints:LangChainAPI:APIKey", + "api_key_configuration_name": "FoundationaLLM:APIEndpoints:LangChainAPI:Essentials:APIKey", "api_key_header_name": "X-API-KEY" }, "url": "http://langchain-api/langchain", diff --git a/deploy/standard/data/resource-provider/FoundationaLLM.Configuration/OrchestrationAPI.template.json b/deploy/standard/data/resource-provider/FoundationaLLM.Configuration/OrchestrationAPI.template.json index 03ac69320d..1b0648992f 100644 --- a/deploy/standard/data/resource-provider/FoundationaLLM.Configuration/OrchestrationAPI.template.json +++ b/deploy/standard/data/resource-provider/FoundationaLLM.Configuration/OrchestrationAPI.template.json @@ -8,7 +8,7 @@ "category": "General", "authentication_type": "APIKey", "authentication_parameters": { - "api_key_configuration_name": "FoundationaLLM:APIEndpoints:OrchestrationAPI:APIKey", + "api_key_configuration_name": "FoundationaLLM:APIEndpoints:OrchestrationAPI:Essentials:APIKey", "api_key_header_name": "X-API-KEY" }, "url": "http://orchestration-api/orchestration", diff --git a/deploy/standard/data/resource-provider/FoundationaLLM.Configuration/SemanticKernelAPI.template.json b/deploy/standard/data/resource-provider/FoundationaLLM.Configuration/SemanticKernelAPI.template.json index b16bcc7d5d..820d73cc4b 100644 --- a/deploy/standard/data/resource-provider/FoundationaLLM.Configuration/SemanticKernelAPI.template.json +++ b/deploy/standard/data/resource-provider/FoundationaLLM.Configuration/SemanticKernelAPI.template.json @@ -8,7 +8,7 @@ "category": "Orchestration", "authentication_type": "APIKey", "authentication_parameters": { - "api_key_configuration_name": "FoundationaLLM:APIEndpoints:SemanticKernelAPI:APIKey", + "api_key_configuration_name": "FoundationaLLM:APIEndpoints:SemanticKernelAPI:Essentials:APIKey", "api_key_header_name": "X-API-KEY" }, "url": "http://semantic-kernel-api/semantickernel", diff --git a/deploy/standard/data/resource-provider/FoundationaLLM.Configuration/StateAPI.template.json b/deploy/standard/data/resource-provider/FoundationaLLM.Configuration/StateAPI.template.json index 37af904b34..976b26042b 100644 --- a/deploy/standard/data/resource-provider/FoundationaLLM.Configuration/StateAPI.template.json +++ b/deploy/standard/data/resource-provider/FoundationaLLM.Configuration/StateAPI.template.json @@ -8,7 +8,7 @@ "category": "General", "authentication_type": "APIKey", "authentication_parameters": { - "api_key_configuration_name": "FoundationaLLM:APIEndpoints:StateAPI:APIKey", + "api_key_configuration_name": "FoundationaLLM:APIEndpoints:StateAPI:Essentials:APIKey", "api_key_header_name": "X-API-KEY" }, "url": "http://state-api/state", diff --git a/deploy/standard/data/resource-provider/FoundationaLLM.Configuration/VectorizationAPI.template.json b/deploy/standard/data/resource-provider/FoundationaLLM.Configuration/VectorizationAPI.template.json index 812b04da64..a71707b9ee 100644 --- a/deploy/standard/data/resource-provider/FoundationaLLM.Configuration/VectorizationAPI.template.json +++ b/deploy/standard/data/resource-provider/FoundationaLLM.Configuration/VectorizationAPI.template.json @@ -8,7 +8,7 @@ "category": "General", "authentication_type": "APIKey", "authentication_parameters": { - "api_key_configuration_name": "FoundationaLLM:APIEndpoints:VectorizationAPI:APIKey", + "api_key_configuration_name": "FoundationaLLM:APIEndpoints:VectorizationAPI:Essentials:APIKey", "api_key_header_name": "X-API-KEY" }, "url": "http://vectorization-api/vectorization", diff --git a/deploy/standard/data/resource-provider/FoundationaLLM.Configuration/VectorizationWorker.template.json b/deploy/standard/data/resource-provider/FoundationaLLM.Configuration/VectorizationWorker.template.json index ec537685a2..59fafe9091 100644 --- a/deploy/standard/data/resource-provider/FoundationaLLM.Configuration/VectorizationWorker.template.json +++ b/deploy/standard/data/resource-provider/FoundationaLLM.Configuration/VectorizationWorker.template.json @@ -8,7 +8,7 @@ "category": "General", "authentication_type": "APIKey", "authentication_parameters": { - "api_key_configuration_name": "FoundationaLLM:APIEndpoints:VectorizationWorker:APIKey", + "api_key_configuration_name": "FoundationaLLM:APIEndpoints:VectorizationWorker:Essentials:APIKey", "api_key_header_name": "X-API-KEY" }, "url": "http://vectorization-job/vectorization", From 47bef6a352728c16f0e7d04ed1e13a827e783617 Mon Sep 17 00:00:00 2001 From: codingbandit Date: Tue, 30 Jul 2024 17:52:02 -0400 Subject: [PATCH 04/22] Multiple config loading fixes Load Orchestration Essentials namespace to Core API startup Add null check for response from the polling client In LangChainAPI add Essentials to API Key lookup for key verification. --- src/dotnet/CoreAPI/Program.cs | 2 +- src/dotnet/Orchestration/Services/LangChainService.cs | 3 ++- src/python/LangChainAPI/app/dependencies.py | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/dotnet/CoreAPI/Program.cs b/src/dotnet/CoreAPI/Program.cs index 805d647847..2891a27707 100644 --- a/src/dotnet/CoreAPI/Program.cs +++ b/src/dotnet/CoreAPI/Program.cs @@ -54,7 +54,7 @@ public static void Main(string[] args) options.Select(AppConfigurationKeyFilters.FoundationaLLM_APIEndpoints_CoreAPI_Configuration_Entra); options.Select(AppConfigurationKeyFilters.FoundationaLLM_APIEndpoints_CoreAPI_Essentials); options.Select(AppConfigurationKeyFilters.FoundationaLLM_APIEndpoints_CoreAPI_Configuration); - + options.Select(AppConfigurationKeyFilters.FoundationaLLM_APIEndpoints_OrchestrationAPI_Essentials); options.Select(AppConfigurationKeyFilters.FoundationaLLM_APIEndpoints_AuthorizationAPI_Essentials); options.Select(AppConfigurationKeyFilters.FoundationaLLM_ResourceProviders_Agent_Storage); options.Select(AppConfigurationKeyFilters.FoundationaLLM_ResourceProviders_Attachment_Storage); diff --git a/src/dotnet/Orchestration/Services/LangChainService.cs b/src/dotnet/Orchestration/Services/LangChainService.cs index 0f85ed0caf..00cb5572b4 100644 --- a/src/dotnet/Orchestration/Services/LangChainService.cs +++ b/src/dotnet/Orchestration/Services/LangChainService.cs @@ -78,7 +78,8 @@ public async Task GetCompletion(string instanceId, LLMCom try { var completionResponse = await pollingClient.GetResponseAsync(); - + if (completionResponse == null) + throw new Exception("The LangChain orchestration service did not return a valid completion response."); return new LLMCompletionResponse { OperationId = request.OperationId, diff --git a/src/python/LangChainAPI/app/dependencies.py b/src/python/LangChainAPI/app/dependencies.py index 72b8fc5fc0..b69d754275 100644 --- a/src/python/LangChainAPI/app/dependencies.py +++ b/src/python/LangChainAPI/app/dependencies.py @@ -45,7 +45,7 @@ async def validate_api_key_header(x_api_key: str = Depends(APIKeyHeader(name='X- Otherwise, returns False. """ - result = x_api_key == get_config().get_value(f'FoundationaLLM:APIEndpoints:{API_NAME}:APIKey') + result = x_api_key == get_config().get_value(f'FoundationaLLM:APIEndpoints:{API_NAME}:Essentials:APIKey') if not result: logging.error('Invalid API key. You must provide a valid API key in the X-API-KEY header.') From 61dcfd60e33383c68654d61cd1cce95b03751138 Mon Sep 17 00:00:00 2001 From: codingbandit Date: Tue, 30 Jul 2024 21:09:20 -0400 Subject: [PATCH 05/22] Add StateAPI URL Configuration for Python APIs to read. --- .../Constants/Configuration/AppConfigurationKeys.cs | 7 +++++++ src/dotnet/Common/Constants/Data/AppConfiguration.json | 8 ++++++++ .../foundationallm/operations/operations_manager.py | 6 +++--- 3 files changed, 18 insertions(+), 3 deletions(-) diff --git a/src/dotnet/Common/Constants/Configuration/AppConfigurationKeys.cs b/src/dotnet/Common/Constants/Configuration/AppConfigurationKeys.cs index 6c945b2c87..ef0eda53d2 100644 --- a/src/dotnet/Common/Constants/Configuration/AppConfigurationKeys.cs +++ b/src/dotnet/Common/Constants/Configuration/AppConfigurationKeys.cs @@ -614,6 +614,13 @@ public static class AppConfigurationKeys #region FoundationaLLM:APIEndpoints:StateAPI:Essentials + /// + /// The app configuration key for the FoundationaLLM:APIEndpoints:StateAPI:Essentials:APIUrl setting. + /// Value description:
The URL of the State API. This entry supports the dependency of the Orchestration implementations to retrieve the URL. Python APIs do not have a resource provider implementation to retrieve the details.
+ ///
+ public const string FoundationaLLM_APIEndpoints_StateAPI_Essentials_APIUrl = + "FoundationaLLM:APIEndpoints:StateAPI:Essentials:APIUrl"; + /// /// The app configuration key for the FoundationaLLM:APIEndpoints:StateAPI:Essentials:APIKey setting. /// Value description:
The name of the Azure Key Vault secret holding the API key for the State API.
diff --git a/src/dotnet/Common/Constants/Data/AppConfiguration.json b/src/dotnet/Common/Constants/Data/AppConfiguration.json index 6b2b0c9167..682d96f3f1 100644 --- a/src/dotnet/Common/Constants/Data/AppConfiguration.json +++ b/src/dotnet/Common/Constants/Data/AppConfiguration.json @@ -850,6 +850,14 @@ "description": "Configuration section used to identify the essential settings for the State API." }, "configuration_keys": [ + { + "name": "APIUrl", + "description": "The URL of the State API. This entry supports the dependency of the Orchestration implementations to retrieve the URL. Python APIs do not have a resource provider implementation to retrieve the details.", + "secret": "", + "value": "${env:SERVICE_STATE_API_ENDPOINT_URL}", + "content_type": "", + "first_version": "0.8.0" + }, { "name": "APIKey", "description": "The name of the Azure Key Vault secret holding the API key for the State API.", diff --git a/src/python/PythonSDK/foundationallm/operations/operations_manager.py b/src/python/PythonSDK/foundationallm/operations/operations_manager.py index 31ee3f1c61..c52f693a2d 100644 --- a/src/python/PythonSDK/foundationallm/operations/operations_manager.py +++ b/src/python/PythonSDK/foundationallm/operations/operations_manager.py @@ -17,8 +17,8 @@ class OperationsManager(): def __init__(self, config: Configuration): self.config = config # Retrieve the State API configuration settings. - self.state_api_url = config.get_value('FoundationaLLM:APIEndpoints:StateAPI:APIUrl').rstrip('/') - self.state_api_key = config.get_value('FoundationaLLM:APIEndpoints:StateAPI:APIKey') + self.state_api_url = config.get_value('FoundationaLLM:APIEndpoints:StateAPI:Essentials:APIUrl').rstrip('/') # https://localhost:7068' + self.state_api_key = config.get_value('FoundationaLLM:APIEndpoints:StateAPI:Essentials:APIKey') env = os.environ.get('FOUNDATIONALLM_ENV', 'prod') self.verify_certs = False if env == 'dev' else True @@ -49,7 +49,7 @@ async def create_operation( "charset":"utf-8", "Content-Type":"application/json" } - + print(f'{self.state_api_url}/instances/{instance_id}/operations/{operation_id}') # Call the State API to create a new operation. r = requests.post( f'{self.state_api_url}/instances/{instance_id}/operations/{operation_id}', From 19f7498881cb80e93130fb43a26ec17dc362a212 Mon Sep 17 00:00:00 2001 From: saimachi Date: Wed, 31 Jul 2024 08:25:37 -0400 Subject: [PATCH 06/22] Vectorization changes for startup. --- src/dotnet/GatewayAPI/Program.cs | 1 + src/dotnet/ManagementAPI/Program.cs | 1 + src/dotnet/VectorizationAPI/Program.cs | 5 ++++- 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/dotnet/GatewayAPI/Program.cs b/src/dotnet/GatewayAPI/Program.cs index 8114b7a37d..adf2b6c895 100644 --- a/src/dotnet/GatewayAPI/Program.cs +++ b/src/dotnet/GatewayAPI/Program.cs @@ -26,6 +26,7 @@ options.SetCredential(DefaultAuthentication.AzureCredential); }); options.Select(AppConfigurationKeyFilters.FoundationaLLM_APIEndpoints_GatewayAPI_Essentials); + options.Select(AppConfigurationKeyFilters.FoundationaLLM_APIEndpoints_GatewayAPI_Configuration); }); 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 864d87bf4c..1fe5af8813 100644 --- a/src/dotnet/ManagementAPI/Program.cs +++ b/src/dotnet/ManagementAPI/Program.cs @@ -49,6 +49,7 @@ public static void Main(string[] args) options.Select(AppConfigurationKeyFilters.FoundationaLLM_APIEndpoints_ManagementAPI_Configuration_Entra); options.Select(AppConfigurationKeyFilters.FoundationaLLM_APIEndpoints_ManagementAPI_Essentials); options.Select(AppConfigurationKeyFilters.FoundationaLLM_APIEndpoints_AuthorizationAPI_Essentials); + options.Select(AppConfigurationKeyFilters.FoundationaLLM_APIEndpoints_VectorizationAPI_Essentials); options.Select(AppConfigurationKeyFilters.FoundationaLLM_ResourceProviders_Vectorization_Storage); options.Select(AppConfigurationKeyFilters.FoundationaLLM_ResourceProviders_Agent_Storage); options.Select(AppConfigurationKeyFilters.FoundationaLLM_ResourceProviders_Prompt_Storage); diff --git a/src/dotnet/VectorizationAPI/Program.cs b/src/dotnet/VectorizationAPI/Program.cs index f697ad2b51..aabcc88429 100644 --- a/src/dotnet/VectorizationAPI/Program.cs +++ b/src/dotnet/VectorizationAPI/Program.cs @@ -51,8 +51,11 @@ options.Select(AppConfigurationKeyFilters.FoundationaLLM_Vectorization_StateService_Storage); options.Select(AppConfigurationKeyFilters.FoundationaLLM_APIEndpoints_VectorizationAPI_Essentials); options.Select(AppConfigurationKeyFilters.FoundationaLLM_Events_Profiles_VectorizationAPI); - + options.Select(AppConfigurationKeys.FoundationaLLM_Vectorization_Worker); + + options.Select(AppConfigurationKeyFilters.FoundationaLLM_ResourceProviders_Configuration_Storage); options.Select(AppConfigurationKeyFilters.FoundationaLLM_ResourceProviders_DataSource_Storage); //resource provider settings + options.Select(AppConfigurationKeyFilters.FoundationaLLM_ResourceProviders_Vectorization_Storage); options.Select(AppConfigurationKeyFilters.FoundationaLLM_DataSources); //data source settings }); if (builder.Environment.IsDevelopment()) From 44ead3a9243de5efe3b3c9879536e2f855ddc7d4 Mon Sep 17 00:00:00 2001 From: saimachi Date: Wed, 31 Jul 2024 09:06:52 -0400 Subject: [PATCH 07/22] Changes to support Azure OpenAI Direct. --- .../AzureOpenAI.template.json | 5 ++++- .../AzureOpenAI.template.json | 5 ++++- .../Common/Models/Orchestration/LLMCompletionRequest.cs | 8 ++++---- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/deploy/quick-start/data/resource-provider/FoundationaLLM.Configuration/AzureOpenAI.template.json b/deploy/quick-start/data/resource-provider/FoundationaLLM.Configuration/AzureOpenAI.template.json index c9802c2995..eba9e49828 100644 --- a/deploy/quick-start/data/resource-provider/FoundationaLLM.Configuration/AzureOpenAI.template.json +++ b/deploy/quick-start/data/resource-provider/FoundationaLLM.Configuration/AzureOpenAI.template.json @@ -7,9 +7,12 @@ "cost_center": null, "category": "General", "authentication_type": "APIKey", + "api_version": "2023-05-15", "authentication_parameters": { - "api_key_configuration_name": "FoundationaLLM:APIEndpoints:AzureOpenAI:Essentials:APIKey" + "api_key_configuration_name": "FoundationaLLM:APIEndpoints:AzureOpenAI:Essentials:APIKey", + "api_key_header_name": "api-key" }, + "operation_type": "chat", "url": "${env:AZURE_OPENAI_ENDPOINT}", "url_exceptions": [], "timeout_seconds": 60, diff --git a/deploy/standard/data/resource-provider/FoundationaLLM.Configuration/AzureOpenAI.template.json b/deploy/standard/data/resource-provider/FoundationaLLM.Configuration/AzureOpenAI.template.json index 65faad122f..2381d48f43 100644 --- a/deploy/standard/data/resource-provider/FoundationaLLM.Configuration/AzureOpenAI.template.json +++ b/deploy/standard/data/resource-provider/FoundationaLLM.Configuration/AzureOpenAI.template.json @@ -7,9 +7,12 @@ "cost_center": null, "category": "General", "authentication_type": "APIKey", + "api_version": "2023-05-15", "authentication_parameters": { - "api_key_configuration_name": "FoundationaLLM:APIEndpoints:AzureOpenAI:Essentials:APIKey" + "api_key_configuration_name": "FoundationaLLM:APIEndpoints:AzureOpenAI:Essentials:APIKey", + "api_key_header_name": "api-key" }, + "operation_type": "chat", "url": "{{openAiEndpointUri}}", "url_exceptions": [], "timeout_seconds": 60, diff --git a/src/dotnet/Common/Models/Orchestration/LLMCompletionRequest.cs b/src/dotnet/Common/Models/Orchestration/LLMCompletionRequest.cs index 6cee679de3..1cbec9c085 100644 --- a/src/dotnet/Common/Models/Orchestration/LLMCompletionRequest.cs +++ b/src/dotnet/Common/Models/Orchestration/LLMCompletionRequest.cs @@ -199,7 +199,7 @@ public AIModelBase AIModel if (_aiModel != null) return _aiModel; - EnsureIsValid(); + Validate(); var aiModelObject = Objects[Agent.AIModelObjectId!]; _aiModel = aiModelObject is JsonElement aiModelJsonElement @@ -224,7 +224,7 @@ public APIEndpointConfiguration AIModelEndpointConfiguration if (_aiModelEndpointConfiguration != null) return _aiModelEndpointConfiguration; - EnsureIsValid(); + Validate(); var endpointObject = Objects[AIModel.EndpointObjectId!]; @@ -250,7 +250,7 @@ public Dictionary OtherAgentsDescriptions if (_otherAgentsDescriptions != null) return _otherAgentsDescriptions; - EnsureIsValid(); + Validate(); _otherAgentsDescriptions = Objects.TryGetValue(CompletionRequestObjectsKeys.AllAgents, out var allAgentDescriptions) @@ -277,7 +277,7 @@ public MultipartPrompt Prompt if (_prompt != null) return _prompt; - EnsureIsValid(); + Validate(); var promptObject = Objects[Agent.PromptObjectId!]; From d1b7e9ec2c66f3f259a7b4d8c912d00b0491e18a Mon Sep 17 00:00:00 2001 From: Andrei Alistar Date: Wed, 31 Jul 2024 16:49:07 +0300 Subject: [PATCH 08/22] Use operationResultPath in polling client --- src/dotnet/Common/Clients/PollingHttpClient`2.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/dotnet/Common/Clients/PollingHttpClient`2.cs b/src/dotnet/Common/Clients/PollingHttpClient`2.cs index affe09bfcf..94aee75818 100644 --- a/src/dotnet/Common/Clients/PollingHttpClient`2.cs +++ b/src/dotnet/Common/Clients/PollingHttpClient`2.cs @@ -115,7 +115,7 @@ public class PollingHttpClient( switch(currentStatus.Status) { case OperationStatus.Completed: - var resultResponse = await _httpClient.GetAsync(operationStatusPath, cancellationToken); + var resultResponse = await _httpClient.GetAsync(operationResultPath, cancellationToken); var resultContent = await resultResponse.Content.ReadAsStringAsync(); return JsonSerializer.Deserialize(resultContent, _jsonSerializerOptions); case OperationStatus.InProgress: From 195bd7d5dd379053550961827f24f15bc16a8246 Mon Sep 17 00:00:00 2001 From: Andrei Alistar Date: Wed, 31 Jul 2024 16:49:42 +0300 Subject: [PATCH 09/22] Add default values for Optional fields in api_endpoint_configuration --- .../configuration/api_endpoint_configuration.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/python/PythonSDK/foundationallm/models/resource_providers/configuration/api_endpoint_configuration.py b/src/python/PythonSDK/foundationallm/models/resource_providers/configuration/api_endpoint_configuration.py index 94f3d08103..26bff8c971 100644 --- a/src/python/PythonSDK/foundationallm/models/resource_providers/configuration/api_endpoint_configuration.py +++ b/src/python/PythonSDK/foundationallm/models/resource_providers/configuration/api_endpoint_configuration.py @@ -18,6 +18,6 @@ class APIEndpointConfiguration(ResourceBase): authentication_parameters: dict = Field(default={}, description="Dictionary with values used for authentication.") timeout_seconds: int = Field(default=60, description="The timeout duration in seconds for API calls.") retry_strategy_name: str = Field(description="The name of the retry strategy to use for API calls.") - provider: Optional[str] = Field(description="The provider of the API endpoint.") - api_version: Optional[str] = Field(description="The version to use when calling the API represented by the endpoint.") - operation_type: Optional[str] = Field(description="The type of operation the API endpoint is performing.") + provider: Optional[str] = Field(default=None, description="The provider of the API endpoint.") + api_version: Optional[str] = Field(default=None, description="The version to use when calling the API represented by the endpoint.") + operation_type: Optional[str] = Field(default=None, description="The type of operation the API endpoint is performing.") From 1211a9fc1cedb1e33de025569c189662395ec15a Mon Sep 17 00:00:00 2001 From: saimachi Date: Tue, 30 Jul 2024 14:32:08 -0400 Subject: [PATCH 10/22] Updated key names in main.parameter.json. --- deploy/quick-start/infra/main.parameters.json | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/deploy/quick-start/infra/main.parameters.json b/deploy/quick-start/infra/main.parameters.json index 8df0141ac1..f8497e382f 100644 --- a/deploy/quick-start/infra/main.parameters.json +++ b/deploy/quick-start/infra/main.parameters.json @@ -149,7 +149,7 @@ "hasIngress": false, "image": "${SERVICE_COREJOB_IMAGE=cropseastus2svinternal.azurecr.io/core-job:${FLLM_VERSION}}", "appConfigEnvironmentVarName": "FoundationaLLM_AppConfig_ConnectionString", - "apiKeySecretName": "foundationallm-apis-corejob-apikey", + "apiKeySecretName": "foundationallm-apiendpoints-coreworker-apikey", "cpu": "${SERVICE_COREJOB_CPU=1.0}", "memory": "${SERVICE_COREJOB_MEMORY=2.0Gi}", "replicaCount": "${SERVICE_COREJOB_REPLICAS}" @@ -171,7 +171,7 @@ "hasIngress": true, "image": "${SERVICE_GATEKEEPERAPI_IMAGE=cropseastus2svinternal.azurecr.io/gatekeeper-api:${FLLM_VERSION}}", "appConfigEnvironmentVarName": "FoundationaLLM_AppConfig_ConnectionString", - "apiKeySecretName": "foundationallm-apis-gatekeeperapi-apikey", + "apiKeySecretName": "foundationallm-apiendpoints-gatekeeperapi-apikey", "cpu": "${SERVICE_GATEKEEPERAPI_CPU=1.0}", "memory": "${SERVICE_GATEKEEPERAPI_MEMORY=2.0Gi}", "replicaCount": "${SERVICE_GATEKEEPERAPI_REPLICAS}" @@ -182,7 +182,7 @@ "hasIngress": true, "image": "${SERVICE_GATEKEEPERINTEGRATIONAPI_IMAGE=cropseastus2svinternal.azurecr.io/gatekeeper-integration-api:${FLLM_VERSION}}", "appConfigEnvironmentVarName": "FOUNDATIONALLM_APP_CONFIGURATION_URI", - "apiKeySecretName": "foundationallm-apis-gatekeeperintegrationapi-apikey", + "apiKeySecretName": "foundationallm-apiendpoints-gatekeeperintegrationapi-apikey", "cpu": "${SERVICE_GATEKEEPERINTEGRATIONAPI_CPU=1.0}", "memory": "${SERVICE_GATEKEEPERINTEGRATIONAPI_MEMORY=2.0Gi}", "replicaCount": "${SERVICE_GATEKEEPERINTEGRATIONAPI_REPLICAS}" @@ -193,7 +193,7 @@ "hasIngress": true, "image": "${SERVICE_GATEWAYADAPTERAPI_IMAGE=cropseastus2svinternal.azurecr.io/gateway-adapter-api:${FLLM_VERSION}}", "appConfigEnvironmentVarName": "FoundationaLLM_AppConfig_ConnectionString", - "apiKeySecretName": "foundationallm-apis-gatewayadapterapi-apikey", + "apiKeySecretName": "foundationallm-apiendpoints-gatewayadapterapi-apikey", "cpu": "${SERVICE_GATEWAYADAPTERAPI_CPU=1.0}", "memory": "${SERVICE_GATEWAYADAPTERAPI_MEMORY=2.0Gi}", "replicaCount": "${SERVICE_GATEWAYADAPTERAPI_REPLICAS}" @@ -204,7 +204,7 @@ "hasIngress": true, "image": "${SERVICE_GATEWAYAPI_IMAGE=cropseastus2svinternal.azurecr.io/gateway-api:${FLLM_VERSION}}", "appConfigEnvironmentVarName": "FoundationaLLM_AppConfig_ConnectionString", - "apiKeySecretName": "foundationallm-apis-gatewayapi-apikey", + "apiKeySecretName": "foundationallm-apiendpoints-gatewayapi-apikey", "cpu": "${SERVICE_GATEWAYAPI_CPU=1.0}", "memory": "${SERVICE_GATEWAYAPI_MEMORY=2.0Gi}", "replicaCount": "${SERVICE_GATEWAYAPI_REPLICAS}" @@ -215,7 +215,7 @@ "hasIngress": true, "image": "${SERVICE_LANGCHAINAPI_IMAGE=cropseastus2svinternal.azurecr.io/langchain-api:${FLLM_VERSION}}", "appConfigEnvironmentVarName": "FOUNDATIONALLM_APP_CONFIGURATION_URI", - "apiKeySecretName": "foundationallm-apis-langchainapi-apikey", + "apiKeySecretName": "foundationallm-apiendpoints-langchainapi-apikey", "cpu": "${SERVICE_LANGCHAINAPI_CPU=1.0}", "memory": "${SERVICE_LANGCHAINAPI_MEMORY=2.0Gi}", "replicaCount": "${SERVICE_LANGCHAINAPI_REPLICAS}" @@ -248,7 +248,7 @@ "hasIngress": true, "image": "${SERVICE_ORCHESTRATIONAPI_IMAGE=cropseastus2svinternal.azurecr.io/orchestration-api:${FLLM_VERSION}}", "appConfigEnvironmentVarName": "FoundationaLLM_AppConfig_ConnectionString", - "apiKeySecretName": "foundationallm-apis-orchestrationapi-apikey", + "apiKeySecretName": "foundationallm-apiendpoints-orchestrationapi-apikey", "cpu": "${SERVICE_ORCHESTRATIONAPI_CPU=1.0}", "memory": "${SERVICE_ORCHESTRATIONAPI_MEMORY=2.0Gi}", "replicaCount": "${SERVICE_ORCHESTRATIONAPI_REPLICAS}" @@ -270,7 +270,7 @@ "hasIngress": true, "image": "${SERVICE_SEMANTICKERNELAPI_IMAGE=cropseastus2svinternal.azurecr.io/semantic-kernel-api:${FLLM_VERSION}}", "appConfigEnvironmentVarName": "FoundationaLLM_AppConfig_ConnectionString", - "apiKeySecretName": "foundationallm-apis-semantickernelapi-apikey", + "apiKeySecretName": "foundationallm-apiendpoints-semantickernelapi-apikey", "cpu": "${SERVICE_SEMANTICKERNELAPI_CPU=1.0}", "memory": "${SERVICE_SEMANTICKERNELAPI_MEMORY=2.0Gi}", "replicaCount": "${SERVICE_SEMANTICKERNELAPI_REPLICAS}" @@ -281,7 +281,7 @@ "hasIngress": true, "image": "${SERVICE_STATEAPI_IMAGE=cropseastus2svinternal.azurecr.io/state-api:${FLLM_VERSION}}", "appConfigEnvironmentVarName": "FoundationaLLM_AppConfig_ConnectionString", - "apiKeySecretName": "foundationallm-apis-stateapi-apikey", + "apiKeySecretName": "foundationallm-apiendpoints-stateapi-apikey", "cpu": "${SERVICE_STATEAPI_CPU=1.0}", "memory": "${SERVICE_STATEAPI_MEMORY=2.0Gi}", "replicaCount": "${SERVICE_STATEAPI_REPLICAS}" @@ -292,7 +292,7 @@ "hasIngress": true, "image": "${SERVICE_VECTORIZATIONAPI_IMAGE=cropseastus2svinternal.azurecr.io/vectorization-api:${FLLM_VERSION}}", "appConfigEnvironmentVarName": "FoundationaLLM_AppConfig_ConnectionString", - "apiKeySecretName": "foundationallm-apis-vectorizationapi-apikey", + "apiKeySecretName": "foundationallm-apiendpoints-vectorizationapi-apikey", "cpu": "${SERVICE_VECTORIZATIONAPI_CPU=1.0}", "memory": "${SERVICE_VECTORIZATIONAPI_MEMORY=2.0Gi}", "replicaCount": "${SERVICE_VECTORIZATIONAPI_REPLICAS}" @@ -303,7 +303,7 @@ "hasIngress": true, "image": "${SERVICE_VECTORIZATIONJOB_IMAGE=cropseastus2svinternal.azurecr.io/vectorization-job:${FLLM_VERSION}}", "appConfigEnvironmentVarName": "FoundationaLLM_AppConfig_ConnectionString", - "apiKeySecretName": "foundationallm-apis-vectorizationworker-apikey", + "apiKeySecretName": "foundationallm-apiendpoints-vectorizationworker-apikey", "cpu": "${SERVICE_VECTORIZATIONJOB_CPU=1.0}", "memory": "${SERVICE_VECTORIZATIONJOB_MEMORY=2.0Gi}", "replicaCount": "${SERVICE_VECTORIZATIONJOB_REPLICAS}" From 477a6420f138091b58335e5862d0d8acae0e2a5d Mon Sep 17 00:00:00 2001 From: codingbandit Date: Wed, 31 Jul 2024 10:37:31 -0400 Subject: [PATCH 11/22] removed a comment --- .../PythonSDK/foundationallm/operations/operations_manager.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/python/PythonSDK/foundationallm/operations/operations_manager.py b/src/python/PythonSDK/foundationallm/operations/operations_manager.py index c52f693a2d..6d94fd5d28 100644 --- a/src/python/PythonSDK/foundationallm/operations/operations_manager.py +++ b/src/python/PythonSDK/foundationallm/operations/operations_manager.py @@ -17,7 +17,7 @@ class OperationsManager(): def __init__(self, config: Configuration): self.config = config # Retrieve the State API configuration settings. - self.state_api_url = config.get_value('FoundationaLLM:APIEndpoints:StateAPI:Essentials:APIUrl').rstrip('/') # https://localhost:7068' + self.state_api_url = config.get_value('FoundationaLLM:APIEndpoints:StateAPI:Essentials:APIUrl').rstrip('/') self.state_api_key = config.get_value('FoundationaLLM:APIEndpoints:StateAPI:Essentials:APIKey') env = os.environ.get('FOUNDATIONALLM_ENV', 'prod') self.verify_certs = False if env == 'dev' else True From a0575250ea590a21abeb3266369f7dcd37556945 Mon Sep 17 00:00:00 2001 From: saimachi Date: Wed, 31 Jul 2024 11:29:00 -0400 Subject: [PATCH 12/22] Added CosmosDB role assignment for State API. --- deploy/quick-start/infra/main.bicep | 1 + deploy/standard/infra/app-rg.bicep | 12 ++++++++++++ 2 files changed, 13 insertions(+) diff --git a/deploy/quick-start/infra/main.bicep b/deploy/quick-start/infra/main.bicep index e348419a46..80d8839ca6 100644 --- a/deploy/quick-start/infra/main.bicep +++ b/deploy/quick-start/infra/main.bicep @@ -608,6 +608,7 @@ module acaServices './app/acaService.bicep' = [ var cosmosRoleTargets = [ 'core-api' 'core-job' + 'state-api' ] module cosmosRoles './shared/sqlRoleAssignments.bicep' = [ diff --git a/deploy/standard/infra/app-rg.bicep b/deploy/standard/infra/app-rg.bicep index c51f887b62..ac74c4cc23 100644 --- a/deploy/standard/infra/app-rg.bicep +++ b/deploy/standard/infra/app-rg.bicep @@ -412,6 +412,18 @@ module cosmosRoles './modules/sqlRoleAssignments.bicep' = { } } +module stateApiCosmosRoles './modules/sqlRoleAssignments.bicep' = { + scope: resourceGroup(storageResourceGroupName) + name: 'state-api-cosmos-role' + params: { + accountName: cosmosDb.name + principalId: srBackend[indexOf(backendServiceNames, 'state-api')].outputs.servicePrincipalId + roleDefinitionIds: { + 'Cosmos DB Built-in Data Contributor': '00000000-0000-0000-0000-000000000002' + } + } +} + module searchIndexDataReaderRole 'modules/utility/roleAssignments.bicep' = { name: 'searchIndexDataRole-${timestamp}' scope: resourceGroup(vectorizationResourceGroupName) From 633ee2c7047e7d2e98979d38f288ac516d276f08 Mon Sep 17 00:00:00 2001 From: joelhulen Date: Wed, 31 Jul 2024 11:33:47 -0400 Subject: [PATCH 13/22] Update config keys to match latest changes --- src/ui/UserPortal/server/api/config.ts | 12 ++++++------ src/ui/UserPortal/stores/appConfigStore.ts | 12 ++++++------ 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/ui/UserPortal/server/api/config.ts b/src/ui/UserPortal/server/api/config.ts index 6e05f5ba3e..f85f853091 100644 --- a/src/ui/UserPortal/server/api/config.ts +++ b/src/ui/UserPortal/server/api/config.ts @@ -6,7 +6,7 @@ import { AppConfigurationClient } from '@azure/app-configuration'; dns.setDefaultResultOrder('ipv4first'); const allowedKeys = [ - 'FoundationaLLM:APIs:CoreAPI:APIUrl', + 'FoundationaLLM:APIEndpoints:CoreAPI:Essentials:APIUrl', '.appconfig.featureflag/FoundationaLLM-AllowAgentHint', 'FoundationaLLM:Branding:AllowAgentSelection', 'FoundationaLLM:Branding:KioskMode', @@ -27,11 +27,11 @@ const allowedKeys = [ 'FoundationaLLM:Branding:SecondaryButtonTextColor', 'FoundationaLLM:Branding:FooterText', 'FoundationaLLM:Instance:Id', - 'FoundationaLLM:Chat:Entra:ClientId', - 'FoundationaLLM:Chat:Entra:Instance', - 'FoundationaLLM:Chat:Entra:TenantId', - 'FoundationaLLM:Chat:Entra:Scopes', - 'FoundationaLLM:Chat:Entra:CallbackPath', + 'FoundationaLLM:UserPortal:Authentication:Entra:ClientId', + 'FoundationaLLM:UserPortal:Authentication:Entra:Instance', + 'FoundationaLLM:UserPortal:Authentication:Entra:TenantId', + 'FoundationaLLM:UserPortal:Authentication:Entra:Scopes', + 'FoundationaLLM:UserPortal:Authentication:Entra:CallbackPath', ]; export default defineEventHandler(async (event) => { diff --git a/src/ui/UserPortal/stores/appConfigStore.ts b/src/ui/UserPortal/stores/appConfigStore.ts index f000ef9985..7399fb4cdf 100644 --- a/src/ui/UserPortal/stores/appConfigStore.ts +++ b/src/ui/UserPortal/stores/appConfigStore.ts @@ -76,7 +76,7 @@ export const useAppConfigStore = defineStore('appConfig', { authScopes, authCallbackPath ] = await Promise.all([ - api.getConfigValue('FoundationaLLM:APIs:CoreAPI:APIUrl'), + api.getConfigValue('FoundationaLLM:APIEndpoints:CoreAPI:Essentials:APIUrl'), getConfigValueSafe('FoundationaLLM:Branding:KioskMode'), getConfigValueSafe('FoundationaLLM:Branding:PageTitle'), @@ -96,11 +96,11 @@ export const useAppConfigStore = defineStore('appConfig', { getConfigValueSafe('FoundationaLLM:Branding:SecondaryButtonTextColor', '#fff'), getConfigValueSafe('FoundationaLLM:Branding:FooterText'), getConfigValueSafe('FoundationaLLM:Instance:Id','00000000-0000-0000-0000-000000000000'), - api.getConfigValue('FoundationaLLM:Chat:Entra:ClientId'), - api.getConfigValue('FoundationaLLM:Chat:Entra:Instance'), - api.getConfigValue('FoundationaLLM:Chat:Entra:TenantId'), - api.getConfigValue('FoundationaLLM:Chat:Entra:Scopes'), - api.getConfigValue('FoundationaLLM:Chat:Entra:CallbackPath') + api.getConfigValue('FoundationaLLM:UserPortal:Authentication:Entra:ClientId'), + api.getConfigValue('FoundationaLLM:UserPortal:Authentication:Entra:Instance'), + api.getConfigValue('FoundationaLLM:UserPortal:Authentication:Entra:TenantId'), + api.getConfigValue('FoundationaLLM:UserPortal:Authentication:Entra:Scopes'), + api.getConfigValue('FoundationaLLM:UserPortal:Authentication:Entra:CallbackPath') ]); this.apiUrl = apiUrl; From 23cfb103504fd492632806921ff640852c0bf8fe Mon Sep 17 00:00:00 2001 From: joelhulen Date: Wed, 31 Jul 2024 11:34:18 -0400 Subject: [PATCH 14/22] Bicep updates --- deploy/quick-start/infra/main.bicep | 1 + deploy/standard/infra/app-rg.bicep | 12 ++++++++++++ 2 files changed, 13 insertions(+) diff --git a/deploy/quick-start/infra/main.bicep b/deploy/quick-start/infra/main.bicep index e348419a46..80d8839ca6 100644 --- a/deploy/quick-start/infra/main.bicep +++ b/deploy/quick-start/infra/main.bicep @@ -608,6 +608,7 @@ module acaServices './app/acaService.bicep' = [ var cosmosRoleTargets = [ 'core-api' 'core-job' + 'state-api' ] module cosmosRoles './shared/sqlRoleAssignments.bicep' = [ diff --git a/deploy/standard/infra/app-rg.bicep b/deploy/standard/infra/app-rg.bicep index c51f887b62..ac74c4cc23 100644 --- a/deploy/standard/infra/app-rg.bicep +++ b/deploy/standard/infra/app-rg.bicep @@ -412,6 +412,18 @@ module cosmosRoles './modules/sqlRoleAssignments.bicep' = { } } +module stateApiCosmosRoles './modules/sqlRoleAssignments.bicep' = { + scope: resourceGroup(storageResourceGroupName) + name: 'state-api-cosmos-role' + params: { + accountName: cosmosDb.name + principalId: srBackend[indexOf(backendServiceNames, 'state-api')].outputs.servicePrincipalId + roleDefinitionIds: { + 'Cosmos DB Built-in Data Contributor': '00000000-0000-0000-0000-000000000002' + } + } +} + module searchIndexDataReaderRole 'modules/utility/roleAssignments.bicep' = { name: 'searchIndexDataRole-${timestamp}' scope: resourceGroup(vectorizationResourceGroupName) From a6acff81e60176401e1393c717569ab8e8cd072e Mon Sep 17 00:00:00 2001 From: codingbandit Date: Wed, 31 Jul 2024 12:02:09 -0400 Subject: [PATCH 15/22] Updates to polling client and langchain polling interval --- src/dotnet/Common/Clients/PollingHttpClient`2.cs | 7 +++++-- src/dotnet/Orchestration/Services/LangChainService.cs | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/dotnet/Common/Clients/PollingHttpClient`2.cs b/src/dotnet/Common/Clients/PollingHttpClient`2.cs index 94aee75818..d3005c0883 100644 --- a/src/dotnet/Common/Clients/PollingHttpClient`2.cs +++ b/src/dotnet/Common/Clients/PollingHttpClient`2.cs @@ -80,10 +80,11 @@ public class PollingHttpClient( var pollingStartTime = DateTime.UtcNow; var pollingCounter = 0; + var currentPollingInterval = _pollingInterval; while (true) { - await Task.Delay(_pollingInterval, cancellationToken); + await Task.Delay(currentPollingInterval, cancellationToken); var totalPollingTime = DateTime.UtcNow - pollingStartTime; pollingCounter++; @@ -123,9 +124,11 @@ public class PollingHttpClient( { _logger.LogWarning("Total polling time ({TotalTime} seconds) exceeded to maximum allowed ({MaxTime} seconds).", totalPollingTime.TotalSeconds, - _maxWaitTime.TotalSeconds); + _maxWaitTime.TotalSeconds); return default; } + // Exponential backoff + currentPollingInterval = TimeSpan.FromSeconds(currentPollingInterval.TotalSeconds * 2); continue; default: _logger.LogError("An error occurred while polling for the response. The response status code was {StatusCode}.", responseMessage.StatusCode); diff --git a/src/dotnet/Orchestration/Services/LangChainService.cs b/src/dotnet/Orchestration/Services/LangChainService.cs index 00cb5572b4..8e9ae2c4ba 100644 --- a/src/dotnet/Orchestration/Services/LangChainService.cs +++ b/src/dotnet/Orchestration/Services/LangChainService.cs @@ -71,7 +71,7 @@ public async Task GetCompletion(string instanceId, LLMCom client, request, $"instances/{instanceId}/async-completions", - TimeSpan.FromSeconds(10), + TimeSpan.FromSeconds(0.5), client.Timeout.Subtract(TimeSpan.FromSeconds(1)), _logger); From 1796c3430fc478fbfe4e676c071abb9e07cbecd1 Mon Sep 17 00:00:00 2001 From: codingbandit Date: Wed, 31 Jul 2024 12:15:54 -0400 Subject: [PATCH 16/22] moved polling to the end of the while loop --- src/dotnet/Common/Clients/PollingHttpClient`2.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/dotnet/Common/Clients/PollingHttpClient`2.cs b/src/dotnet/Common/Clients/PollingHttpClient`2.cs index d3005c0883..b1edb30abd 100644 --- a/src/dotnet/Common/Clients/PollingHttpClient`2.cs +++ b/src/dotnet/Common/Clients/PollingHttpClient`2.cs @@ -84,8 +84,6 @@ public class PollingHttpClient( while (true) { - await Task.Delay(currentPollingInterval, cancellationToken); - var totalPollingTime = DateTime.UtcNow - pollingStartTime; pollingCounter++; _logger.LogInformation( @@ -127,13 +125,15 @@ public class PollingHttpClient( _maxWaitTime.TotalSeconds); return default; } - // Exponential backoff - currentPollingInterval = TimeSpan.FromSeconds(currentPollingInterval.TotalSeconds * 2); - continue; + + break; default: _logger.LogError("An error occurred while polling for the response. The response status code was {StatusCode}.", responseMessage.StatusCode); return default; } + await Task.Delay(currentPollingInterval, cancellationToken); + // Exponential backoff + currentPollingInterval = TimeSpan.FromSeconds(currentPollingInterval.TotalSeconds * 2); } } catch (Exception ex) From e7a585e755ec13bc75b5a3f77f2fae157deaa808 Mon Sep 17 00:00:00 2001 From: joelhulen Date: Wed, 31 Jul 2024 12:24:08 -0400 Subject: [PATCH 17/22] Update App Config keys --- src/ui/ManagementPortal/server/api/config.ts | 39 ++++----- .../ManagementPortal/stores/appConfigStore.ts | 83 ++++++++++--------- 2 files changed, 63 insertions(+), 59 deletions(-) diff --git a/src/ui/ManagementPortal/server/api/config.ts b/src/ui/ManagementPortal/server/api/config.ts index fbf156bc66..6f83ac8d26 100644 --- a/src/ui/ManagementPortal/server/api/config.ts +++ b/src/ui/ManagementPortal/server/api/config.ts @@ -6,14 +6,14 @@ import { AppConfigurationClient } from '@azure/app-configuration'; dns.setDefaultResultOrder('ipv4first'); const allowedKeys = [ - 'FoundationaLLM:APIs:ManagementAPI:APIUrl', + 'FoundationaLLM:APIEndpoints:ManagementAPI:Essentials:APIUrl', 'FoundationaLLM:Instance:Id', - 'FoundationaLLM:Management:Entra:ClientId', - 'FoundationaLLM:Management:Entra:Instance', - 'FoundationaLLM:Management:Entra:TenantId', - 'FoundationaLLM:Management:Entra:Scopes', - 'FoundationaLLM:Management:Entra:CallbackPath', + 'FoundationaLLM:ManagementPortal:Authentication:Entra:ClientId', + 'FoundationaLLM:ManagementPortal:Authentication:Entra:Instance', + 'FoundationaLLM:ManagementPortal:Authentication:Entra:TenantId', + 'FoundationaLLM:ManagementPortal:Authentication:Entra:Scopes', + 'FoundationaLLM:ManagementPortal:Authentication:Entra:CallbackPath', 'FoundationaLLM:Branding:FavIconUrl', 'FoundationaLLM:Branding:LogoUrl', @@ -31,19 +31,20 @@ const allowedKeys = [ 'FoundationaLLM:Branding:SecondaryButtonTextColor', 'FoundationaLLM:Branding:FooterText', 'FoundationaLLM:Instance:Id', - 'FoundationaLLM:APIs:AgentHubAPI:APIUrl', - 'FoundationaLLM:APIs:AuthorizationAPI:APIUrl', - 'FoundationaLLM:APIs:CoreAPI:APIUrl', - 'FoundationaLLM:APIs:DataSourceHubAPI:APIUrl', - 'FoundationaLLM:APIs:GatekeeperAPI:APIUrl', - 'FoundationaLLM:APIs:GatekeeperIntegrationAPI:APIUrl', - 'FoundationaLLM:APIs:GatewayAPI:APIUrl', - 'FoundationaLLM:APIs:LangChainAPI:APIUrl', - 'FoundationaLLM:APIs:OrchestrationAPI:APIUrl', - 'FoundationaLLM:APIs:PromptHubAPI:APIUrl', - 'FoundationaLLM:APIs:SemanticKernelAPI:APIUrl', - 'FoundationaLLM:APIs:VectorizationAPI:APIUrl', - 'FoundationaLLM:APIs:VectorizationWorker:APIUrl', + // 'FoundationaLLM:APIEndpoints:AgentHubAPI:Essentials:APIUrl', + 'FoundationaLLM:APIEndpoints:AuthorizationAPI:Essentials:APIUrl', + 'FoundationaLLM:APIEndpoints:CoreAPI:Essentials:APIUrl', + // 'FoundationaLLM:APIEndpoints:DataSourceHubAPI:Essentials:APIUrl', + // 'FoundationaLLM:APIEndpoints:GatekeeperAPI:Essentials:APIUrl', + // 'FoundationaLLM:APIEndpoints:GatekeeperIntegrationAPI:Essentials:APIUrl', + // 'FoundationaLLM:APIEndpoints:GatewayAPI:Essentials:APIUrl', + // 'FoundationaLLM:APIEndpoints:LangChainAPI:Essentials:APIUrl', + // 'FoundationaLLM:APIEndpoints:OrchestrationAPI:Essentials:APIUrl', + // 'FoundationaLLM:APIEndpoints:PromptHubAPI:Essentials:APIUrl', + // 'FoundationaLLM:APIEndpoints:SemanticKernelAPI:Essentials:APIUrl', + // 'FoundationaLLM:APIEndpoints:VectorizationAPI:Essentials:APIUrl', + // 'FoundationaLLM:APIEndpoints:VectorizationWorker:Essentials:APIUrl', + 'FoundationaLLM:APIEndpoints:StateAPI:Essentials:APIUrl', ]; export default defineEventHandler(async (event) => { diff --git a/src/ui/ManagementPortal/stores/appConfigStore.ts b/src/ui/ManagementPortal/stores/appConfigStore.ts index e6c33b6be0..8317feec99 100644 --- a/src/ui/ManagementPortal/stores/appConfigStore.ts +++ b/src/ui/ManagementPortal/stores/appConfigStore.ts @@ -8,14 +8,15 @@ export const useAppConfigStore = defineStore('appConfig', { apiUrl: null, authorizationApiUrl: null, coreApiUrl: null, - gatekeeperApiUrl: null, - gatekeeperIntegrationApiUrl: null, - gatewayApiUrl: null, - langChainApiUrl: null, - orchestrationApiUrl: null, - semanticKernelApiUrl: null, - vectorizationApiUrl: null, - vectorizationWorkerApiUrl: null, + stateApiUrl: null, + // gatekeeperApiUrl: null, + // gatekeeperIntegrationApiUrl: null, + // gatewayApiUrl: null, + // langChainApiUrl: null, + // orchestrationApiUrl: null, + // semanticKernelApiUrl: null, + // vectorizationApiUrl: null, + // vectorizationWorkerApiUrl: null, instanceId: null, @@ -61,14 +62,15 @@ export const useAppConfigStore = defineStore('appConfig', { apiUrl, authorizationApiUrl, coreApiUrl, - gatekeeperApiUrl, - gatekeeperIntegrationApiUrl, - gatewayApiUrl, - langChainApiUrl, - orchestrationApiUrl, - semanticKernelApiUrl, - vectorizationApiUrl, - vectorizationWorkerApiUrl, + stateApiUrl, + // gatekeeperApiUrl, + // gatekeeperIntegrationApiUrl, + // gatewayApiUrl, + // langChainApiUrl, + // orchestrationApiUrl, + // semanticKernelApiUrl, + // vectorizationApiUrl, + // vectorizationWorkerApiUrl, favIconUrl, logoUrl, logoText, @@ -91,17 +93,17 @@ export const useAppConfigStore = defineStore('appConfig', { authScopes, authCallbackPath, ] = await Promise.all([ - api.getConfigValue('FoundationaLLM:APIs:ManagementAPI:APIUrl'), - api.getConfigValue('FoundationaLLM:APIs:AuthorizationAPI:APIUrl'), - api.getConfigValue('FoundationaLLM:APIs:CoreAPI:APIUrl'), - api.getConfigValue('FoundationaLLM:APIs:GatekeeperAPI:APIUrl'), - api.getConfigValue('FoundationaLLM:APIs:GatekeeperIntegrationAPI:APIUrl'), - api.getConfigValue('FoundationaLLM:APIs:GatewayAPI:APIUrl'), - api.getConfigValue('FoundationaLLM:APIs:LangChainAPI:APIUrl'), - api.getConfigValue('FoundationaLLM:APIs:OrchestrationAPI:APIUrl'), - api.getConfigValue('FoundationaLLM:APIs:SemanticKernelAPI:APIUrl'), - api.getConfigValue('FoundationaLLM:APIs:VectorizationAPI:APIUrl'), - api.getConfigValue('FoundationaLLM:APIs:VectorizationWorker:APIUrl'), + api.getConfigValue('FoundationaLLM:APIEndpoints:ManagementAPI:Essentials:APIUrl'), + api.getConfigValue('FoundationaLLM:APIEndpoints:AuthorizationAPI:Essentials:APIUrl'), + api.getConfigValue('FoundationaLLM:APIEndpoints:CoreAPI:Essentials:APIUrl'), + api.getConfigValue('FoundationaLLM:APIEndpoints:StateAPI:Essentials:APIUrl'), + // api.getConfigValue('FoundationaLLM:APIEndpoints:GatekeeperIntegrationAPI:Essentials:APIUrl'), + // api.getConfigValue('FoundationaLLM:APIEndpoints:GatewayAPI:Essentials:APIUrl'), + // api.getConfigValue('FoundationaLLM:APIEndpoints:LangChainAPI:Essentials:APIUrl'), + // api.getConfigValue('FoundationaLLM:APIEndpoints:OrchestrationAPI:Essentials:APIUrl'), + // api.getConfigValue('FoundationaLLM:APIEndpoints:SemanticKernelAPI:Essentials:APIUrl'), + // api.getConfigValue('FoundationaLLM:APIEndpoints:VectorizationAPI:Essentials:APIUrl'), + // api.getConfigValue('FoundationaLLM:APIEndpoints:VectorizationWorker:Essentials:APIUrl'), getConfigValueSafe('FoundationaLLM:Branding:FavIconUrl'), getConfigValueSafe('FoundationaLLM:Branding:LogoUrl', 'foundationallm-logo-white.svg'), @@ -120,24 +122,25 @@ export const useAppConfigStore = defineStore('appConfig', { getConfigValueSafe('FoundationaLLM:Branding:FooterText'), getConfigValueSafe('FoundationaLLM:Instance:Id','00000000-0000-0000-0000-000000000000'), - api.getConfigValue('FoundationaLLM:Management:Entra:ClientId'), - api.getConfigValue('FoundationaLLM:Management:Entra:Instance'), - api.getConfigValue('FoundationaLLM:Management:Entra:TenantId'), - api.getConfigValue('FoundationaLLM:Management:Entra:Scopes'), - api.getConfigValue('FoundationaLLM:Management:Entra:CallbackPath'), + api.getConfigValue('FoundationaLLM:ManagementPortal:Authentication:Entra:ClientId'), + api.getConfigValue('FoundationaLLM:ManagementPortal:Authentication:Entra:Instance'), + api.getConfigValue('FoundationaLLM:ManagementPortal:Authentication:Entra:TenantId'), + api.getConfigValue('FoundationaLLM:ManagementPortal:Authentication:Entra:Scopes'), + api.getConfigValue('FoundationaLLM:ManagementPortal:Authentication:Entra:CallbackPath'), ]); this.apiUrl = apiUrl; this.authorizationApiUrl = authorizationApiUrl; this.coreApiUrl = coreApiUrl; - this.gatekeeperApiUrl = gatekeeperApiUrl; - this.gatekeeperIntegrationApiUrl = gatekeeperIntegrationApiUrl; - this.gatewayApiUrl = gatewayApiUrl; - this.langChainApiUrl = langChainApiUrl; - this.orchestrationApiUrl = orchestrationApiUrl; - this.semanticKernelApiUrl = semanticKernelApiUrl; - this.vectorizationApiUrl = vectorizationApiUrl; - this.vectorizationWorkerApiUrl = vectorizationWorkerApiUrl; + this.stateApiUrl = stateApiUrl; + // this.gatekeeperApiUrl = gatekeeperApiUrl; + // this.gatekeeperIntegrationApiUrl = gatekeeperIntegrationApiUrl; + // this.gatewayApiUrl = gatewayApiUrl; + // this.langChainApiUrl = langChainApiUrl; + // this.orchestrationApiUrl = orchestrationApiUrl; + // this.semanticKernelApiUrl = semanticKernelApiUrl; + // this.vectorizationApiUrl = vectorizationApiUrl; + // this.vectorizationWorkerApiUrl = vectorizationWorkerApiUrl; this.instanceId = instanceId; From 6a96f3a5b74c4d4c4f89b8df5b42dc6b533f48c2 Mon Sep 17 00:00:00 2001 From: joelhulen Date: Wed, 31 Jul 2024 12:25:01 -0400 Subject: [PATCH 18/22] Update external orchestration service type --- src/ui/ManagementPortal/js/api.ts | 9 ++------- src/ui/ManagementPortal/js/types.ts | 3 +-- 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/src/ui/ManagementPortal/js/api.ts b/src/ui/ManagementPortal/js/api.ts index 30ba1497ae..af0bda26e0 100644 --- a/src/ui/ManagementPortal/js/api.ts +++ b/src/ui/ManagementPortal/js/api.ts @@ -582,7 +582,7 @@ export default { async getExternalOrchestrationServices(resolveApiKey: boolean = false): Promise[]> { const data = await this.fetch( - `/instances/${this.instanceId}/providers/FoundationaLLM.Configuration/apiEndpoints?api-version=${this.apiVersion}`, + `/instances/${this.instanceId}/providers/FoundationaLLM.Configuration/apiEndpointConfigurations?api-version=${this.apiVersion}`, ) as ResourceProviderGetResult[]; // Retrieve all the app config values for the external orchestration services.. @@ -591,13 +591,8 @@ export default { // Loop through the external orchestration services and replace the app config keys with the real values. for (const externalOrchestrationService of data) { - externalOrchestrationService.resource.resolved_api_url = ''; externalOrchestrationService.resource.resolved_api_key = ''; - // Find a matching app config for the API URL. The app config name should be in the format FoundationaLLM:ExternalAPIs::APIUrl - const apiUrlAppConfig = appConfigResults.find(appConfig => appConfig.resource.name === `FoundationaLLM:ExternalAPIs:${externalOrchestrationService.resource.name}:APIUrl`); - if (apiUrlAppConfig) { - externalOrchestrationService.resource.resolved_api_url = apiUrlAppConfig.resource.value; - } + if (resolveApiKey) { // Find a matching app config for the API Key. The app config name should be in the format FoundationaLLM:ExternalAPIs::APIKey const apiKeyAppConfig = appConfigResults.find(appConfig => appConfig.resource.name === `FoundationaLLM:ExternalAPIs:${externalOrchestrationService.resource.name}:APIKey`); diff --git a/src/ui/ManagementPortal/js/types.ts b/src/ui/ManagementPortal/js/types.ts index e9a08483d1..d1635f1ada 100644 --- a/src/ui/ManagementPortal/js/types.ts +++ b/src/ui/ManagementPortal/js/types.ts @@ -97,8 +97,7 @@ export type ExternalOrchestrationService = ResourceBase & { name: string; api_url_configuration_name: string; api_key_configuration_name: string; - // The resolved value of the API URL configuration reference for displaying in the UI and updating the configuration. - resolved_api_url: string; + url: string; // The resolved value of the API key configuration reference for displaying in the UI and updating the configuration. resolved_api_key: string; }; From 558ff0795d760675ad04031f4196556f2d7c6a8c Mon Sep 17 00:00:00 2001 From: joelhulen Date: Wed, 31 Jul 2024 12:25:08 -0400 Subject: [PATCH 19/22] Update info page --- src/ui/ManagementPortal/pages/info.vue | 97 +++++++++++++++----------- 1 file changed, 58 insertions(+), 39 deletions(-) diff --git a/src/ui/ManagementPortal/pages/info.vue b/src/ui/ManagementPortal/pages/info.vue index 944e8700e2..1ae2b89a5e 100644 --- a/src/ui/ManagementPortal/pages/info.vue +++ b/src/ui/ManagementPortal/pages/info.vue @@ -12,7 +12,7 @@ :key="api.name" :apiName="api.displayName" :apiUrl="api.url" - :description="api.description" + :description="api.description" /> @@ -22,8 +22,8 @@ v-for="api in externalOrchestrationServices" :key="api.name" :apiName="api.name" - :apiUrl="api.resolved_api_url" - :description="api.description" + :apiUrl="api.url" + :description="api.description" /> @@ -44,7 +44,7 @@ export default { data() { return { - apiUrls: [], + apiUrls: [] as Array, externalOrchestrationServices: [] as ExternalOrchestrationService[], loading: false as boolean, loadingStatusText: 'Retrieving data...' as string, @@ -58,57 +58,76 @@ export default { methods: { async fetchApiUrls() { this.loading = true; + let instancePart = `/instances/${this.$appConfigStore.instanceId}`; this.apiUrls = [ { name: 'coreApiUrl', displayName: 'Core API', description: 'The Core API is the main user-based API for the FoundationaLLM platform. It is accessed by the User Portal.', - url: this.$appConfigStore.coreApiUrl + url: `${this.$appConfigStore.coreApiUrl}${instancePart}`, }, { name: 'apiUrl', displayName: 'Management API', description: 'The Management API is used by the Management Portal to manage the FoundationaLLM platform.', - url: this.$appConfigStore.apiUrl - }, - { - name: 'gatekeeperApiUrl', - displayName: 'Gatekeeper API', - description: 'The Gatekeeper API adds an additional layer of security to the FoundationaLLM platform. It is accessed by the Core API.', - url: this.$appConfigStore.gatekeeperApiUrl, - }, - { - name: 'gatekeeperIntegrationApiUrl', - displayName: 'Gatekeeper Integration API', - description: 'The Gatekeeper Integration API is used to integrate additional filtering and safety services into the Gatekeeper API.', - url: this.$appConfigStore.gatekeeperIntegrationApiUrl, - }, - { - name: 'gatewayApiUrl', - displayName: 'Gateway API', - description: 'The Gateway API is used to manage the connection between the FoundationaLLM platform and LLMs.', - url: this.$appConfigStore.gatewayApiUrl, - }, - { - name: 'orchestrationApiUrl', - displayName: 'Orchestration API', - description: 'The Orchestration API is used to manage the orchestration of LLMs and other services in the FoundationaLLM platform.', - url: this.$appConfigStore.orchestrationApiUrl, + url: `${this.$appConfigStore.apiUrl}${instancePart}`, }, { - name: 'vectorizationApiUrl', - displayName: 'Vectorization API', - description: 'The Vectorization API is used to manage vectorization requests for the Vectorization Worker service.', - url: this.$appConfigStore.vectorizationApiUrl, + name: 'authorizationApiUrl', + displayName: 'Authorization API', + description: 'The Authorization API manages role-based access control (RBAC) and other auth-related functions for the FoundationaLLM platform.', + url: `${this.$appConfigStore.authorizationApiUrl}`, }, { - name: 'vectorizationWorkerApiUrl', - displayName: 'Vectorization Worker API', - description: 'The Vectorization Worker API provides access to the internal state of the vectorization workers.', - url: this.$appConfigStore.vectorizationWorkerApiUrl, + name: 'stateApiUrl', + displayName: 'State API', + description: 'The State API manages background task and long-running operation state information for the FoundationaLLM platform.', + url: `${this.$appConfigStore.stateApiUrl}`, }, - ]; + // { + // name: 'gatekeeperApiUrl', + // displayName: 'Gatekeeper API', + // description: 'The Gatekeeper API adds an additional layer of security to the FoundationaLLM platform. It is accessed by the Core API.', + // url: `${this.$appConfigStore.gatekeeperApiUrl}${instancePart}`, + // }, + // { + // name: 'gatekeeperIntegrationApiUrl', + // displayName: 'Gatekeeper Integration API', + // description: 'The Gatekeeper Integration API is used to integrate additional filtering and safety services into the Gatekeeper API.', + // url: `${this.$appConfigStore.gatekeeperIntegrationApiUrl}${instancePart}`, + // }, + // { + // name: 'gatewayApiUrl', + // displayName: 'Gateway API', + // description: 'The Gateway API is used to manage the connection between the FoundationaLLM platform and LLMs.', + // url: `${this.$appConfigStore.gatewayApiUrl}${instancePart}`, + // }, + // { + // name: 'orchestrationApiUrl', + // displayName: 'Orchestration API', + // description: 'The Orchestration API is used to manage the orchestration of LLMs and other services in the FoundationaLLM platform.', + // url: `${this.$appConfigStore.orchestrationApiUrl}${instancePart}`, + // }, + // { + // name: 'semanticKernelApiUrl', + // displayName: 'SemanticKernel API', + // description: 'The SemanticKernel API provides SemanticKernel-based orchestration services to facilitate communicating with large-language models.', + // url: `${this.$appConfigStore.semanticKernelApiUrl}${instancePart}`, + // }, + // { + // name: 'vectorizationApiUrl', + // displayName: 'Vectorization API', + // description: 'The Vectorization API is used to manage vectorization requests for the Vectorization Worker service.', + // url: `${this.$appConfigStore.vectorizationApiUrl}${instancePart}`, + // }, + // { + // name: 'vectorizationWorkerApiUrl', + // displayName: 'Vectorization Worker API', + // description: 'The Vectorization Worker API provides access to the internal state of the vectorization workers.', + // url: `${this.$appConfigStore.vectorizationWorkerApiUrl}${instancePart}`, + // }, + ] as Array; try { this.loadingStatusText = 'Retrieving external orchestration services...'; From ee92132b8c21cc6302e3231b687ecc6f6e3b0f6a Mon Sep 17 00:00:00 2001 From: joelhulen Date: Wed, 31 Jul 2024 12:25:18 -0400 Subject: [PATCH 20/22] Merge --- src/dotnet/Common/Clients/PollingHttpClient`2.cs | 11 +++++++---- src/dotnet/Orchestration/Services/LangChainService.cs | 2 +- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/dotnet/Common/Clients/PollingHttpClient`2.cs b/src/dotnet/Common/Clients/PollingHttpClient`2.cs index 94aee75818..b1edb30abd 100644 --- a/src/dotnet/Common/Clients/PollingHttpClient`2.cs +++ b/src/dotnet/Common/Clients/PollingHttpClient`2.cs @@ -80,11 +80,10 @@ public class PollingHttpClient( var pollingStartTime = DateTime.UtcNow; var pollingCounter = 0; + var currentPollingInterval = _pollingInterval; while (true) { - await Task.Delay(_pollingInterval, cancellationToken); - var totalPollingTime = DateTime.UtcNow - pollingStartTime; pollingCounter++; _logger.LogInformation( @@ -123,14 +122,18 @@ public class PollingHttpClient( { _logger.LogWarning("Total polling time ({TotalTime} seconds) exceeded to maximum allowed ({MaxTime} seconds).", totalPollingTime.TotalSeconds, - _maxWaitTime.TotalSeconds); + _maxWaitTime.TotalSeconds); return default; } - continue; + + break; default: _logger.LogError("An error occurred while polling for the response. The response status code was {StatusCode}.", responseMessage.StatusCode); return default; } + await Task.Delay(currentPollingInterval, cancellationToken); + // Exponential backoff + currentPollingInterval = TimeSpan.FromSeconds(currentPollingInterval.TotalSeconds * 2); } } catch (Exception ex) diff --git a/src/dotnet/Orchestration/Services/LangChainService.cs b/src/dotnet/Orchestration/Services/LangChainService.cs index 00cb5572b4..8e9ae2c4ba 100644 --- a/src/dotnet/Orchestration/Services/LangChainService.cs +++ b/src/dotnet/Orchestration/Services/LangChainService.cs @@ -71,7 +71,7 @@ public async Task GetCompletion(string instanceId, LLMCom client, request, $"instances/{instanceId}/async-completions", - TimeSpan.FromSeconds(10), + TimeSpan.FromSeconds(0.5), client.Timeout.Subtract(TimeSpan.FromSeconds(1)), _logger); From df5b3a49ea5b49810eef5e0ccdf36aaf283c8436 Mon Sep 17 00:00:00 2001 From: codingbandit Date: Wed, 31 Jul 2024 13:31:18 -0400 Subject: [PATCH 21/22] Remove debug code --- .../PythonSDK/foundationallm/operations/operations_manager.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/python/PythonSDK/foundationallm/operations/operations_manager.py b/src/python/PythonSDK/foundationallm/operations/operations_manager.py index 6d94fd5d28..5b286dc6fd 100644 --- a/src/python/PythonSDK/foundationallm/operations/operations_manager.py +++ b/src/python/PythonSDK/foundationallm/operations/operations_manager.py @@ -17,7 +17,7 @@ class OperationsManager(): def __init__(self, config: Configuration): self.config = config # Retrieve the State API configuration settings. - self.state_api_url = config.get_value('FoundationaLLM:APIEndpoints:StateAPI:Essentials:APIUrl').rstrip('/') + self.state_api_url = config.get_value('FoundationaLLM:APIEndpoints:StateAPI:Essentials:APIUrl').rstrip('/') self.state_api_key = config.get_value('FoundationaLLM:APIEndpoints:StateAPI:Essentials:APIKey') env = os.environ.get('FOUNDATIONALLM_ENV', 'prod') self.verify_certs = False if env == 'dev' else True @@ -49,7 +49,7 @@ async def create_operation( "charset":"utf-8", "Content-Type":"application/json" } - print(f'{self.state_api_url}/instances/{instance_id}/operations/{operation_id}') + # Call the State API to create a new operation. r = requests.post( f'{self.state_api_url}/instances/{instance_id}/operations/{operation_id}', From b4c429bb7f67e46a3a3663b8a2dce400c4c9d7ab Mon Sep 17 00:00:00 2001 From: joelhulen Date: Wed, 31 Jul 2024 13:33:04 -0400 Subject: [PATCH 22/22] Null check --- src/ui/ManagementPortal/pages/agents/create.vue | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/ui/ManagementPortal/pages/agents/create.vue b/src/ui/ManagementPortal/pages/agents/create.vue index 1b6063711d..33eaa75d41 100644 --- a/src/ui/ManagementPortal/pages/agents/create.vue +++ b/src/ui/ManagementPortal/pages/agents/create.vue @@ -1016,14 +1016,15 @@ export default { this.gatekeeperEnabled = Boolean(agent.gatekeeper?.use_system_setting); - this.selectedGatekeeperContentSafety = this.gatekeeperContentSafetyOptions.filter((localOption) => - agent.gatekeeper.options.includes(localOption.code) - ) || this.selectedGatekeeperContentSafety; + if (agent.gatekeeper && agent.gatekeeper.options) { + this.selectedGatekeeperContentSafety = this.gatekeeperContentSafetyOptions.filter((localOption) => + agent.gatekeeper?.options?.includes(localOption.code) + ) || this.selectedGatekeeperContentSafety; - this.selectedGatekeeperDataProtection = - this.gatekeeperDataProtectionOptions.filter((localOption) => - agent.gatekeeper.options.includes(localOption.code) + this.selectedGatekeeperDataProtection = this.gatekeeperDataProtectionOptions.filter((localOption) => + agent.gatekeeper?.options?.includes(localOption.code) ) || this.selectedGatekeeperDataProtection; + } }, async checkName() {