Skip to main content

Resolving 404 Error with OpenAI Azure Function Binding

· 2 min read

When attempting to work with Azure Open AI, you may want to work with an Azure Functions to adjust or massage the response, to do so you can use the Azure Functions bindings for OpenAI's GPT engine to query the OpenAI API. However, you may encounter a 404 Not Found error when attempting to query OpenAI using the Azure Function binding.

Azure Function - 404 Not Found

If you encounter this error, it could be likely that you are using the Azure Function ExtensionBundle, which does not contain the necessary dependencies to query the OpenAI API.

The binding requires at least the following:

  • Microsoft.Azure.WebJobs.Extensions.OpenAI: 0.12.0-alpha
  • Microsoft.Azure.WebJobs.Extensions.OpenAI.Kusto: 0.12.0-alpha

Nuget Webjob extensions

warning

The binding type(s) 'textCompletion' were not found in the configured extension bundle. Please ensure the correct version of the extension bundle is configured.

Both packages are not integrated into the 4.13.2 version of the ExtensionBundle, which, at the time of writing, is not available in the production ExtensionBundle shipped with new Azure Functions (which is 4.13.2).

However, it is integrated into the Extension Bundle Preview. For example, Extension Bundle Preview for 4.18.0 features:

  • Microsoft.Azure.WebJobs.Extensions.OpenAI: 0.13.0-alpha
  • Microsoft.Azure.WebJobs.Extensions.OpenAI.Kusto: 0.13.0-alpha

Extensions Bundles Preview release4.18.0

🔧 To use the latest Preview Bundle and enable the OpenAI binding extension, you need to update your function apps: host.json file:

{
"version": "2.0",
"managedDependency": {
"Enabled": true
},
"extensionBundle": {
"id": "Microsoft.Azure.Functions.ExtensionBundle.Preview",
"version": "[4.*, 5.0.0)"
}
}

Update the id of Microsoft.Azure.Functions.ExtensionBundle.Preview and the version to [4.*, 5.0.0) in accordance with the latest bundle releases to ensure you are using the latest Preview Bundle. The wildcard * will ensure you use the latest Extension Bundle Preview version within that major release.

You should now be able to query the OpenAI API using the Azure Function binding.

Run After Binding