AzureCognitiveServicesProjectExtensions Methods
ClassMethods7 members
Extension methods for adding Microsoft Foundry project resources to the distributed application model.
AddCapabilityHost(IResourceBuilder<AzureCognitiveServicesProjectResource>, string)Section titled AddCapabilityHost(IResourceBuilder<AzureCognitiveServicesProjectResource>, string)extensionCapabilityHostBuilder Adds a capability host to the Microsoft Foundry project, enabling agent capabilities with external Azure resources such as CosmosDB, Storage, and Search.
public static class AzureCognitiveServicesProjectExtensions{ public static CapabilityHostBuilder AddCapabilityHost( this IResourceBuilder<AzureCognitiveServicesProjectResource> builder, string name) { // ... }}Parameters
builderIResourceBuilder<AzureCognitiveServicesProjectResource>The resource builder for the Microsoft Foundry project.namestringThe name of the capability host.Returns
CapabilityHostBuilderA CapabilityHostBuilder for fluent configuration of the capability host resources.Remarks
This method is not available in polyglot app hosts.
Examples
project.AddCapabilityHost("cap-host") .WithCosmosDB(cosmosDb) .WithStorage(storage) .WithSearch(search) .WithAzureOpenAI(foundry);AddModelDeployment(IResourceBuilder<AzureCognitiveServicesProjectResource>, string, FoundryModel)Section titled AddModelDeployment(IResourceBuilder<AzureCognitiveServicesProjectResource>, string, FoundryModel)extensionIResourceBuilder<FoundryDeploymentResource> Adds a model deployment to the parent Microsoft Foundry resource of the Microsoft Foundry project.
public static class AzureCognitiveServicesProjectExtensions{ public static IResourceBuilder<FoundryDeploymentResource> AddModelDeployment( this IResourceBuilder<AzureCognitiveServicesProjectResource> builder, string name, FoundryModel model) { // ... }}Parameters
builderIResourceBuilder<AzureCognitiveServicesProjectResource>Aspire resource builder for a projectnamestringName to give the model deploymentmodelFoundryModelThe FoundryModel to deploy.Returns
IResourceBuilder<FoundryDeploymentResource>A reference to the ApplicationModel.IResourceBuilder`1 for the deployment resource.AddModelDeployment(IResourceBuilder<AzureCognitiveServicesProjectResource>, string, string, string, string)Section titled AddModelDeployment(IResourceBuilder<AzureCognitiveServicesProjectResource>, string, string, string, string)extensionIResourceBuilder<FoundryDeploymentResource> Adds a model deployment to the parent Microsoft Foundry resource of the Microsoft Foundry project.
public static class AzureCognitiveServicesProjectExtensions{ public static IResourceBuilder<FoundryDeploymentResource> AddModelDeployment( this IResourceBuilder<AzureCognitiveServicesProjectResource> builder, string name, string modelName, string modelVersion, string format) { // ... }}Parameters
builderIResourceBuilder<AzureCognitiveServicesProjectResource>namestringmodelNamestringmodelVersionstringformatstringAddProject(IResourceBuilder<FoundryResource>, string)Section titled AddProject(IResourceBuilder<FoundryResource>, string)extensionIResourceBuilder<AzureCognitiveServicesProjectResource> Adds a Microsoft Foundry project resource to the application model. This will also attach the project as a deployment target for agents.
public static class AzureCognitiveServicesProjectExtensions{ public static IResourceBuilder<AzureCognitiveServicesProjectResource> AddProject( this IResourceBuilder<FoundryResource> builder, string name) { // ... }}Parameters
builderIResourceBuilder<FoundryResource>The ApplicationModel.IResourceBuilder`1 for the parent Microsoft Foundry account resource.namestringThe name of the Microsoft Foundry project resource.Returns
IResourceBuilder<AzureCognitiveServicesProjectResource>A reference to the ApplicationModel.IResourceBuilder`1 for the Microsoft Foundry project resource.WithAppInsights(IResourceBuilder<AzureCognitiveServicesProjectResource>, IResourceBuilder<AzureApplicationInsightsResource>)Section titled WithAppInsights(IResourceBuilder<AzureCognitiveServicesProjectResource>, IResourceBuilder<AzureApplicationInsightsResource>)extensionIResourceBuilder<AzureCognitiveServicesProjectResource> Adds an Application Insights resource to the Microsoft Foundry project, overriding the default (which is to create a new Application Insights resource).
public static class AzureCognitiveServicesProjectExtensions{ public static IResourceBuilder<AzureCognitiveServicesProjectResource> WithAppInsights( this IResourceBuilder<AzureCognitiveServicesProjectResource> builder, IResourceBuilder<AzureApplicationInsightsResource> appInsights) { // ... }}Parameters
builderIResourceBuilder<AzureCognitiveServicesProjectResource>The resource builder for the Microsoft Foundry project.appInsightsIResourceBuilder<AzureApplicationInsightsResource>The Application Insights resource to associate with the project.Returns
IResourceBuilder<AzureCognitiveServicesProjectResource>A reference to the ApplicationModel.IResourceBuilder`1 for chaining.WithKeyVault(IResourceBuilder<AzureCognitiveServicesProjectResource>, IResourceBuilder<AzureKeyVaultResource>)Section titled WithKeyVault(IResourceBuilder<AzureCognitiveServicesProjectResource>, IResourceBuilder<AzureKeyVaultResource>)extensionIResourceBuilder<AzureCognitiveServicesProjectResource> Adds a Key Vault connection to the Microsoft Foundry project.
public static class AzureCognitiveServicesProjectExtensions{ public static IResourceBuilder<AzureCognitiveServicesProjectResource> WithKeyVault( this IResourceBuilder<AzureCognitiveServicesProjectResource> builder, IResourceBuilder<AzureKeyVaultResource> keyVault) { // ... }}Parameters
builderIResourceBuilder<AzureCognitiveServicesProjectResource>The resource builder for the Microsoft Foundry project.keyVaultIResourceBuilder<AzureKeyVaultResource>The Key Vault resource to associate with the project.Returns
IResourceBuilder<AzureCognitiveServicesProjectResource>A reference to the ApplicationModel.IResourceBuilder`1 for chaining.Exceptions
InvalidOperationExceptionThrown when the project already has a Key Vault connection configured.WithReference(IResourceBuilder<TDestination>, IResourceBuilder<AzureCognitiveServicesProjectResource>)Section titled WithReference(IResourceBuilder<TDestination>, IResourceBuilder<AzureCognitiveServicesProjectResource>)extensionIResourceBuilder<TDestination> Adds a reference to a Microsoft Foundry project resource to the destination resource.
public static class AzureCognitiveServicesProjectExtensions{ public static IResourceBuilder<TDestination> WithReference<TDestination>( this IResourceBuilder<TDestination> builder, IResourceBuilder<AzureCognitiveServicesProjectResource> project) { // ... }}Parameters
builderIResourceBuilder<TDestination>projectIResourceBuilder<AzureCognitiveServicesProjectResource>Remarks
This overload is not available in polyglot app hosts. Use the standard
WithReference overload instead.