Azure-Samples / azure-search-openai-demo-csharp

A sample app for the Retrieval-Augmented Generation pattern running in Azure, using Azure Cognitive Search for retrieval and Azure OpenAI large language models to power ChatGPT-style and Q&A experiences.
MIT License
551 stars 345 forks source link

File cognitiveservices.bicep does not include the networkAcls property #250

Open gillesev opened 6 months ago

gillesev commented 6 months ago

The file https://github.com/Azure-Samples/azure-search-openai-demo-csharp/blob/main/infra/core/ai/cognitiveservices.bicep should be (following fix https://github.com/Azure-Samples/azure-search-openai-demo/pull/799 issued for the python version of the azure-search-openai-demo):

metadata description = 'Creates an Azure Cognitive Services instance.' param name string param location string = resourceGroup().location param tags object = {} @description('The custom subdomain name used to access the API. Defaults to the value of the name parameter.') param customSubDomainName string = name param deployments array = [] param kind string = 'OpenAI'

@allowed([ 'Enabled', 'Disabled' ]) param publicNetworkAccess string = 'Enabled' param sku object = { name: 'S0' }

param allowedIpRules array = [] param networkAcls object = empty(allowedIpRules) ? { defaultAction: 'Allow' } : { ipRules: allowedIpRules defaultAction: 'Deny' }

resource account 'Microsoft.CognitiveServices/accounts@2023-05-01' = { name: name location: location tags: tags kind: kind properties: { customSubDomainName: customSubDomainName publicNetworkAccess: publicNetworkAccess networkAcls: networkAcls } sku: sku }

@batchSize(1) resource deployment 'Microsoft.CognitiveServices/accounts/deployments@2023-05-01' = [for deployment in deployments: { parent: account name: deployment.name properties: { model: deployment.model raiPolicyName: contains(deployment, 'raiPolicyName') ? deployment.raiPolicyName : null } sku: contains(deployment, 'sku') ? deployment.sku : { name: 'Standard' capacity: 20 } }]

output endpoint string = account.properties.endpoint output id string = account.id output name string = account.name

luisquintanilla commented 6 months ago

Hi @gillesev,

Are you running into issues deploying the app because of this or are you noting that there are differences?

cc @jongio for visibility

gillesev commented 6 months ago

@luisquintanilla : indeed, when running the azd up command, I would receive an error related to the 'Document intelligence' resource being provisioned: "BadRequest: NetworkAcls is required for this resource." See the error that had been reported for the sister python project: https://github.com/Azure-Samples/azure-search-openai-demo/pull/799).

luisquintanilla commented 6 months ago

@gillesev and to confirm, you're running the latest version in the main branch?

gillesev commented 6 months ago

Yes

jongio commented 6 months ago

Here's the latest for AI cognitive services: https://github.com/Azure/azure-dev/blob/main/templates/common/infra/bicep/core/ai/cognitiveservices.bicep - You'll need to copy that over to this project.

Rickcau commented 5 months ago

I am getting this networkAcls error on my openai service. Has this fix not been merged to main yet? Basically, I already have AI and Cog Services up and running and working with other solutions. I simply want to run this sample in Codespaces and play around. I therefore run all the azd env set commands to setup AOPEN AI variables in the .env. The deployment fails on the openai service. Take a look at the screenshot below for more details.

Deploy-Failure

jongio commented 5 months ago

@Rickcau Try replacing your infra/core/ai/cognitiveservices.bicep file with the one found here and run it again.

https://github.com/Azure/azure-dev/blob/main/templates/common/infra/bicep/core/ai/cognitiveservices.bicep

Sorry for hassle, we are working on making this easier.