Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
small tweaks
  • Loading branch information
KrzysztofCwalina committed Oct 14, 2024
commit ec6bf10a4adf4b2204ff484327b0cfd805925242
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

## 1.0.0-beta.1 (Unreleased)

## 1.0.0-beta.2 (Unreleased)

### Features Added

### Breaking Changes
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,32 +21,32 @@ public class OpenAIFeature : CloudMachineFeature

public OpenAIFeature(string model, string modelVersion) { Model = model; ModelVersion = modelVersion; }

public override void AddTo(CloudMachineInfrastructure infrastructure)
public override void AddTo(CloudMachineInfrastructure cloudMachine)
{
CognitiveServicesAccount cognitiveServices = new("openai", "2023-05-01")
{
Name = infrastructure.Id,
Name = cloudMachine.Id,
Kind = "OpenAI",
Sku = new CognitiveServicesSku { Name = "S0" },
Properties = new CognitiveServicesAccountProperties()
{
PublicNetworkAccess = ServiceAccountPublicNetworkAccess.Enabled,
CustomSubDomainName = infrastructure.Id
CustomSubDomainName = cloudMachine.Id
},
};

infrastructure.AddResource(cognitiveServices.CreateRoleAssignment(
cloudMachine.AddResource(cognitiveServices.CreateRoleAssignment(
CognitiveServicesBuiltInRole.CognitiveServicesOpenAIContributor,
RoleManagementPrincipalType.User,
infrastructure.PrincipalIdParameter)
cloudMachine.PrincipalIdParameter)
);

// TODO: if we every support more than one deployment, they need to be chained using DependsOn.
// The reason is that deployments need to be deployed/created serially.
CognitiveServicesAccountDeployment deployment = new("openai_deployment", "2023-05-01")
{
Parent = cognitiveServices,
Name = infrastructure.Id,
Name = cloudMachine.Id,
Properties = new CognitiveServicesAccountDeploymentProperties()
{
Model = new CognitiveServicesAccountDeploymentModel() {
Expand All @@ -57,8 +57,8 @@ public override void AddTo(CloudMachineInfrastructure infrastructure)
},
};

infrastructure.AddResource(cognitiveServices);
infrastructure.AddResource(deployment);
cloudMachine.AddResource(cognitiveServices);
cloudMachine.AddResource(deployment);
}
}

Expand Down