Skip to content

Commit

Permalink
Merge pull request #1398 from solliancenet/cp_080_azureopenai_resourc…
Browse files Browse the repository at this point in the history
…e_provider
  • Loading branch information
ciprianjichici authored Aug 10, 2024
2 parents b7fea8e + cdf2b40 commit 04b1ad8
Show file tree
Hide file tree
Showing 87 changed files with 1,676 additions and 344 deletions.
2 changes: 1 addition & 1 deletion deploy/standard-hub/infra/core/networking/vpnGateway.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ param location string
param project string
param subnetId string
param tags object
param vpnClientAddressPool string = '192.168.101.0/28'
param vpnClientAddressPool string

@allowed([
'VpnGw1'
Expand Down
2 changes: 2 additions & 0 deletions deploy/standard-hub/infra/main.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ param environmentName string
param location string
param project string
param timestamp string = utcNow()
param vpnClientAddressPool string

// Locals
var abbrs = loadJsonContent('./abbreviations.json')
Expand Down Expand Up @@ -130,6 +131,7 @@ module vpn './core/networking/vpnGateway.bicep' = {
project: project
subnetId: '${vnet.outputs.vnetId}/subnets/GatewaySubnet'
tags: tags
vpnClientAddressPool: vpnClientAddressPool
}
scope: rg
}
Expand Down
6 changes: 6 additions & 0 deletions deploy/standard-hub/infra/main.parameters.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,17 @@
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentParameters.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"cidrVnet": {
"value": "${FLLM_HUB_CIDR_VNET=192.168.100.0/24}"
},
"environmentName": {
"value": "${AZURE_ENV_NAME}"
},
"location": {
"value": "${AZURE_LOCATION}"
},
"vpnClientAddressPool": {
"value": "${VPN_CLIENT_ADDRESS_POOL=192.168.101.0/24}"
}
}
}
6 changes: 6 additions & 0 deletions docs/release-notes/breaking-changes.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,12 @@ The `FoundationaLLM:APIs` and `FoundationaLLM:ExternalAPIs` configuration namesp
The `FoundationaLLM:AzureAIStudio` configuration namespace expects an `APIEndpointConfigurationName` property instead of `BaseUrl`.

A new configuration setting named `FoundationaLLM:Instance:SecurityGroupRetrievalStrategy` with a value of `IdentityManagementService` must exist in the app configuration. It will be added by default in new deployments.

Two new configuration settings required by the new `FoundationaLLM.AzureOpenAI` resource provider:
- `FoundationaLLM:ResourceProviders:AzureOpenAI:Storage:AuthenticationType`
- `FoundationaLLM:ResourceProviders:AzureOpenAI:Storage:AccountName`

### Pre-0.8.0

1. Vectorization resource stores use a unique collection name, `Resources`. They also add a new top-level property named `DefaultResourceName`.
Expand Down
30 changes: 20 additions & 10 deletions src/FoundationaLLM.sln
Original file line number Diff line number Diff line change
Expand Up @@ -117,9 +117,13 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AIModel", "dotnet\AIModel\A
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GatewayAdapterAPI", "dotnet\GatewayAdapterAPI\GatewayAdapterAPI.csproj", "{F826A354-9DF5-4DE5-97CB-F8F0D4566C0F}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "State", "dotnet\State\State.csproj", "{BF7614CE-4E64-4E69-A56D-A7E72EDA8ABD}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "State", "dotnet\State\State.csproj", "{BF7614CE-4E64-4E69-A56D-A7E72EDA8ABD}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "StateAPI", "dotnet\StateAPI\StateAPI.csproj", "{B0D4EBB4-2057-4081-8A80-65390BFBA654}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "StateAPI", "dotnet\StateAPI\StateAPI.csproj", "{B0D4EBB4-2057-4081-8A80-65390BFBA654}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "resource_providers", "resource_providers", "{2C948535-3001-4852-9686-492A23E9E356}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AzureOpenAI", "dotnet\AzureOpenAI\AzureOpenAI.csproj", "{71DD0475-532B-49C0-8699-6552FF3A4A6E}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand Down Expand Up @@ -310,6 +314,10 @@ Global
{B0D4EBB4-2057-4081-8A80-65390BFBA654}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B0D4EBB4-2057-4081-8A80-65390BFBA654}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B0D4EBB4-2057-4081-8A80-65390BFBA654}.Release|Any CPU.Build.0 = Release|Any CPU
{71DD0475-532B-49C0-8699-6552FF3A4A6E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{71DD0475-532B-49C0-8699-6552FF3A4A6E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{71DD0475-532B-49C0-8699-6552FF3A4A6E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{71DD0475-532B-49C0-8699-6552FF3A4A6E}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down Expand Up @@ -337,7 +345,7 @@ Global
{8FACDBA2-3FAD-4DBA-812A-67B9D1892F32} = {23275624-C0DA-4E93-9291-081D75E8CCD2}
{A09449F4-008C-4BD8-AF3A-A98B7603D85D} = {23275624-C0DA-4E93-9291-081D75E8CCD2}
{0DEF31F7-72E4-428A-A32B-C11F9C28B192} = {B6DC1190-2873-44A3-85B3-63D7BDE99231}
{3A73EEED-1602-4CAC-BAAD-56062A3431CC} = {B6DC1190-2873-44A3-85B3-63D7BDE99231}
{3A73EEED-1602-4CAC-BAAD-56062A3431CC} = {2C948535-3001-4852-9686-492A23E9E356}
{3D8E64BB-C0D0-433A-AC4C-B9FFCFA4E013} = {B6DC1190-2873-44A3-85B3-63D7BDE99231}
{7EE65CBF-9052-4C02-BCDD-61C88A1E10E1} = {B6DC1190-2873-44A3-85B3-63D7BDE99231}
{F74CBB5A-97B9-4F68-8077-8BAB49C841DC} = {32FD7A00-B42E-4B0B-B09C-9CE48D8E047B}
Expand All @@ -346,28 +354,30 @@ Global
{46FB5F1B-57C6-4CA3-B626-887DF6D806DD} = {B6DC1190-2873-44A3-85B3-63D7BDE99231}
{2D54392A-8D86-4F54-9993-FB3B6C4C090E} = {B6DC1190-2873-44A3-85B3-63D7BDE99231}
{CDB843FE-108B-435A-BF17-68052C64F500} = {B6DC1190-2873-44A3-85B3-63D7BDE99231}
{9BE97AEC-032C-454B-BDAA-29418A769237} = {B6DC1190-2873-44A3-85B3-63D7BDE99231}
{E04B4AA1-2C79-4153-87A0-2BAC1256E4DE} = {B6DC1190-2873-44A3-85B3-63D7BDE99231}
{9BE97AEC-032C-454B-BDAA-29418A769237} = {2C948535-3001-4852-9686-492A23E9E356}
{E04B4AA1-2C79-4153-87A0-2BAC1256E4DE} = {2C948535-3001-4852-9686-492A23E9E356}
{D2257807-4A0A-4324-A10B-D160550C9E1E} = {28E0E967-A94D-4820-8A61-0B71D3B2780F}
{7DD70AFD-69C4-4C82-9B67-5EE4A671D741} = {28E0E967-A94D-4820-8A61-0B71D3B2780F}
{9273591A-0499-4DAB-ACDA-3565586B9881} = {28E0E967-A94D-4820-8A61-0B71D3B2780F}
{355E060E-2214-4001-8810-5E2381E1C075} = {B6DC1190-2873-44A3-85B3-63D7BDE99231}
{9E243B01-0DA5-4E7B-9539-7E5BF87106EE} = {B6DC1190-2873-44A3-85B3-63D7BDE99231}
{10D4F412-0F01-485F-957E-9EA8F16AED10} = {B6DC1190-2873-44A3-85B3-63D7BDE99231}
{355E060E-2214-4001-8810-5E2381E1C075} = {2C948535-3001-4852-9686-492A23E9E356}
{9E243B01-0DA5-4E7B-9539-7E5BF87106EE} = {2C948535-3001-4852-9686-492A23E9E356}
{10D4F412-0F01-485F-957E-9EA8F16AED10} = {2C948535-3001-4852-9686-492A23E9E356}
{63D7285C-0C40-49E9-BB4D-8AD2E0A29E62} = {B6DC1190-2873-44A3-85B3-63D7BDE99231}
{35833700-B5EF-4211-91C7-E12A03DE3B82} = {B6DC1190-2873-44A3-85B3-63D7BDE99231}
{2A51F9EB-BFCB-4285-A6FC-80CCA46228FB} = {B6DC1190-2873-44A3-85B3-63D7BDE99231}
{6230C568-E97B-4959-8ECE-33D97D1BBD4C} = {28E0E967-A94D-4820-8A61-0B71D3B2780F}
{8F66055B-3A50-4F9B-A774-7D17F2D4A523} = {B6DC1190-2873-44A3-85B3-63D7BDE99231}
{8F66055B-3A50-4F9B-A774-7D17F2D4A523} = {2C948535-3001-4852-9686-492A23E9E356}
{31062ADB-88CD-401A-8DFE-B070DD91CFFD} = {B6DC1190-2873-44A3-85B3-63D7BDE99231}
{C757E76C-AE42-4700-A92C-ED321D9CDB39} = {28E0E967-A94D-4820-8A61-0B71D3B2780F}
{95676184-9498-465C-B4FE-C67AA09A0397} = {C757E76C-AE42-4700-A92C-ED321D9CDB39}
{69E631C8-3266-4D40-9A7A-D67C07972BE2} = {B6DC1190-2873-44A3-85B3-63D7BDE99231}
{2B369949-0297-485E-9455-E8F54D078DB3} = {C757E76C-AE42-4700-A92C-ED321D9CDB39}
{58D9C40B-3BE6-42CC-9FAB-ECF20FDA2E84} = {B6DC1190-2873-44A3-85B3-63D7BDE99231}
{58D9C40B-3BE6-42CC-9FAB-ECF20FDA2E84} = {2C948535-3001-4852-9686-492A23E9E356}
{F826A354-9DF5-4DE5-97CB-F8F0D4566C0F} = {B6DC1190-2873-44A3-85B3-63D7BDE99231}
{BF7614CE-4E64-4E69-A56D-A7E72EDA8ABD} = {B6DC1190-2873-44A3-85B3-63D7BDE99231}
{B0D4EBB4-2057-4081-8A80-65390BFBA654} = {B6DC1190-2873-44A3-85B3-63D7BDE99231}
{2C948535-3001-4852-9686-492A23E9E356} = {B6DC1190-2873-44A3-85B3-63D7BDE99231}
{71DD0475-532B-49C0-8699-6552FF3A4A6E} = {2C948535-3001-4852-9686-492A23E9E356}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {FF5DE858-4B85-4EE8-8A6D-46E8E4FBA078}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using FluentValidation;
using FoundationaLLM.Agent.Models.Resources;
using FoundationaLLM.Common.Constants;
using FoundationaLLM.Common.Constants.Agents;
using FoundationaLLM.Common.Constants.Authorization;
using FoundationaLLM.Common.Constants.Configuration;
using FoundationaLLM.Common.Constants.ResourceProviders;
Expand Down Expand Up @@ -234,7 +235,6 @@ private async Task<ResourceProviderUpsertResult> UpdateAgent(ResourcePath resour
};

agent.ObjectId = resourcePath.GetObjectId(_instanceSettings.Id, _name);
agent.Capabilities ??= [AgentCapabilities.OpenAIAssistants];

if ((agent is KnowledgeManagementAgent {Vectorization.DedicatedPipeline: true, InlineContext: false} kmAgent))
{
Expand Down Expand Up @@ -312,8 +312,8 @@ protected override async Task<object> ExecuteActionAsync(ResourcePath resourcePa
{
AgentResourceTypeNames.Agents => resourcePath.ResourceTypeInstances.Last().Action switch
{
AgentResourceProviderActions.CheckName => CheckAgentName(serializedAction),
AgentResourceProviderActions.Purge => await PurgeResource(resourcePath),
ResourceProviderActions.CheckName => CheckAgentName(serializedAction),
ResourceProviderActions.Purge => await PurgeResource(resourcePath),
_ => throw new ResourceProviderException($"The action {resourcePath.ResourceTypeInstances.Last().Action} is not supported by the {_name} resource provider.",
StatusCodes.Status400BadRequest)
},
Expand Down
50 changes: 35 additions & 15 deletions src/dotnet/Authorization/Data/AuthorizableActions.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,26 @@
}
]
},
{
"category": "AzureOpenAI",
"actions": [
{
"name": "FoundationaLLM.AzureOpenAI/assistantUserContexts/read",
"description": "Read assistant user contexts.",
"field_name": "FoundationaLLM_AzureOpenAI_AssistantUserContexts_Read"
},
{
"name": "FoundationaLLM.AzureOpenAI/assistantUserContexts/write",
"description": "Create or update assistant user contexts.",
"field_name": "FoundationaLLM_AzureOpenAI_AssistantUserContexts_Write"
},
{
"name": "FoundationaLLM.AzureOpenAI/assistantUserContexts/delete",
"description": "Delete assistant user contexts.",
"field_name": "FoundationaLLM_AzureOpenAI_AssistantUserContexts_Delete"
}
]
},
{
"category": "Configuration",
"actions": [
Expand Down Expand Up @@ -78,19 +98,19 @@
"field_name": "FoundationaLLM_Configuration_KeyVaultSecrets_Delete"
},
{
"name": "FoundationaLLM.Configuration/apiEndpoints/read",
"description": "Read API endpoints.",
"field_name": "FoundationaLLM_Configuration_APIEndpoints_Read"
"name": "FoundationaLLM.Configuration/apiEndpointConfigurations/read",
"description": "Read API endpoint configurations.",
"field_name": "FoundationaLLM_Configuration_APIEndpointConfigurations_Read"
},
{
"name": "FoundationaLLM.Configuration/apiEndpoints/write",
"description": "Create or update API endpoints.",
"field_name": "FoundationaLLM_Configuration_APIEndpoints_Write"
"name": "FoundationaLLM.Configuration/apiEndpointConfigurations/write",
"description": "Create or update API endpoint configurations.",
"field_name": "FoundationaLLM_Configuration_APIEndpointConfigurations_Write"
},
{
"name": "FoundationaLLM.Configuration/apiEndpoints/delete",
"description": "Delete API endpoints.",
"field_name": "FoundationaLLM_Configuration_APIEndpoints_Delete"
"name": "FoundationaLLM.Configuration/apiEndpointConfigurations/delete",
"description": "Delete API endpoint configurations.",
"field_name": "FoundationaLLM_Configuration_APIEndpoinConfigurations_Delete"
}
]
},
Expand Down Expand Up @@ -289,18 +309,18 @@
"actions": [
{
"name": "FoundationaLLM.AIModel/aiModels/read",
"description": "Read aiModels models",
"field_name": "FoundationaLLM_AIModel_Models_Read"
"description": "Read AI models",
"field_name": "FoundationaLLM_AIModel_AIModels_Read"
},
{
"name": "FoundationaLLM.AIModel/aiModels/write",
"description": "Create or update models.",
"field_name": "FoundationaLLM_AIModel_Models_Write"
"description": "Create or update AI models.",
"field_name": "FoundationaLLM_AIModel_AIModels_Write"
},
{
"name": "FoundationaLLM.AIModel/aiModels/delete",
"description": "Delete models.",
"field_name": "FoundationaLLM_AIModel_Models_Delete"
"description": "Delete AI models.",
"field_name": "FoundationaLLM_AIModel_AIModels_Delete"
}
]
}
Expand Down
45 changes: 33 additions & 12 deletions src/dotnet/Authorization/Models/AuthorizableActions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,27 @@ public static class AuthorizableActions
"Delete agents.",
"Agent")
},
{
AuthorizableActionNames.FoundationaLLM_AzureOpenAI_AssistantUserContexts_Read,
new AuthorizableAction(
AuthorizableActionNames.FoundationaLLM_AzureOpenAI_AssistantUserContexts_Read,
"Read assistant user contexts.",
"AzureOpenAI")
},
{
AuthorizableActionNames.FoundationaLLM_AzureOpenAI_AssistantUserContexts_Write,
new AuthorizableAction(
AuthorizableActionNames.FoundationaLLM_AzureOpenAI_AssistantUserContexts_Write,
"Create or update assistant user contexts.",
"AzureOpenAI")
},
{
AuthorizableActionNames.FoundationaLLM_AzureOpenAI_AssistantUserContexts_Delete,
new AuthorizableAction(
AuthorizableActionNames.FoundationaLLM_AzureOpenAI_AssistantUserContexts_Delete,
"Delete assistant user contexts.",
"AzureOpenAI")
},
{
AuthorizableActionNames.FoundationaLLM_Configuration_AppConfigurations_Read,
new AuthorizableAction(
Expand Down Expand Up @@ -104,24 +125,24 @@ public static class AuthorizableActions
"Configuration")
},
{
AuthorizableActionNames.FoundationaLLM_Configuration_APIEndpoints_Read,
AuthorizableActionNames.FoundationaLLM_Configuration_APIEndpointConfigurations_Read,
new AuthorizableAction(
AuthorizableActionNames.FoundationaLLM_Configuration_APIEndpoints_Read,
"Read API endpoints.",
AuthorizableActionNames.FoundationaLLM_Configuration_APIEndpointConfigurations_Read,
"Read API endpoint configurations.",
"Configuration")
},
{
AuthorizableActionNames.FoundationaLLM_Configuration_APIEndpoints_Write,
AuthorizableActionNames.FoundationaLLM_Configuration_APIEndpointConfigurations_Write,
new AuthorizableAction(
AuthorizableActionNames.FoundationaLLM_Configuration_APIEndpoints_Write,
"Create or update API endpoints.",
AuthorizableActionNames.FoundationaLLM_Configuration_APIEndpointConfigurations_Write,
"Create or update API endpoint configurations.",
"Configuration")
},
{
AuthorizableActionNames.FoundationaLLM_Configuration_APIEndpoints_Delete,
AuthorizableActionNames.FoundationaLLM_Configuration_APIEndpoinConfigurations_Delete,
new AuthorizableAction(
AuthorizableActionNames.FoundationaLLM_Configuration_APIEndpoints_Delete,
"Delete API endpoints.",
AuthorizableActionNames.FoundationaLLM_Configuration_APIEndpoinConfigurations_Delete,
"Delete API endpoint configurations.",
"Configuration")
},
{
Expand Down Expand Up @@ -359,21 +380,21 @@ public static class AuthorizableActions
AuthorizableActionNames.FoundationaLLM_AIModel_AIModels_Read,
new AuthorizableAction(
AuthorizableActionNames.FoundationaLLM_AIModel_AIModels_Read,
"Read AIModels.",
"Read AI models",
"AIModel")
},
{
AuthorizableActionNames.FoundationaLLM_AIModel_AIModels_Write,
new AuthorizableAction(
AuthorizableActionNames.FoundationaLLM_AIModel_AIModels_Write,
"Create or update AIModels.",
"Create or update AI models.",
"AIModel")
},
{
AuthorizableActionNames.FoundationaLLM_AIModel_AIModels_Delete,
new AuthorizableAction(
AuthorizableActionNames.FoundationaLLM_AIModel_AIModels_Delete,
"Delete AIModel.",
"Delete AI models.",
"AIModel")
},
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public class AuthorizationResourceProviderMetadata
new ResourceTypeAllowedTypes(HttpMethod.Delete.Method, [], [], [])
],
Actions = [
new ResourceTypeAction(AuthorizationResourceProviderActions.Filter, false, true, [
new ResourceTypeAction(ResourceProviderActions.Filter, false, true, [
new ResourceTypeAllowedTypes(HttpMethod.Post.Method, [], [typeof(RoleAssignmentQueryParameters)], [typeof(ResourceProviderGetResult<RoleAssignment>)])
])
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ protected override async Task<object> ExecuteActionAsync(ResourcePath resourcePa
{
AuthorizationResourceTypeNames.RoleAssignments => resourcePath.ResourceTypeInstances.Last().Action switch
{
AuthorizationResourceProviderActions.Filter => await FilterRoleAssignments(resourcePath.ResourceTypeInstances[0], serializedAction, userIdentity),
ResourceProviderActions.Filter => await FilterRoleAssignments(resourcePath.ResourceTypeInstances[0], serializedAction, userIdentity),
_ => throw new ResourceProviderException($"The action {resourcePath.ResourceTypeInstances.Last().Action} is not supported by the {_name} resource provider.",
StatusCodes.Status400BadRequest)
},
Expand Down
1 change: 1 addition & 0 deletions src/dotnet/Authorization/Utils/ResourcePathUtils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ private static Dictionary<string, ResourceTypeDescriptor> GetAllowedResourceType
ResourceProviderNames.FoundationaLLM_Attachment => AttachmentResourceProviderMetadata.AllowedResourceTypes,
ResourceProviderNames.FoundationaLLM_Authorization => AuthorizationResourceProviderMetadata.AllowedResourceTypes,
ResourceProviderNames.FoundationaLLM_AIModel => AIModelResourceProviderMetadata.AllowedResourceTypes,
ResourceProviderNames.FoundationaLLM_AzureOpenAI => AzureOpenAIResourceProviderMetadata.AllowedResourceTypes,
_ => []
};
}
Expand Down
16 changes: 16 additions & 0 deletions src/dotnet/AzureOpenAI/AzureOpenAI.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<AssemblyName>FoundationaLLM.AzureOpenAI</AssemblyName>
<RootNamespace>FoundationaLLM.AzureOpenAI</RootNamespace>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\Common\Common.csproj" />
<ProjectReference Include="..\Gateway\Gateway.csproj" />
</ItemGroup>

</Project>
Loading

0 comments on commit 04b1ad8

Please sign in to comment.