Files
autogen/sk-azfunc-server
2023-07-17 11:14:26 -07:00
..
2023-06-09 17:10:41 +02:00
2023-06-15 12:34:32 +00:00
2023-06-01 10:58:29 -07:00
2023-06-01 10:58:29 -07:00
2023-06-01 10:58:29 -07:00
2023-07-17 11:14:26 -07:00
2023-06-01 10:58:29 -07:00
2023-06-01 10:58:29 -07:00
2023-06-01 10:58:29 -07:00
2023-06-01 10:58:29 -07:00

Semantic Kernel Azure Functions Starter

The sk-csharp-azure-functions Azure Functions application demonstrates how to execute a semantic function.

Prerequisites

Configuring the starter

The starter can be configured by using either:

For Debugging the console application alone, we suggest using .NET Secret Manager to avoid the risk of leaking secrets into the repository, branches and pull requests.

Using .NET Secret Manager

Configure an OpenAI endpoint

cd sk-csharp-azure-functions
dotnet user-secrets set "serviceType" "OpenAI"
dotnet user-secrets set "serviceId" "text-davinci-003"
dotnet user-secrets set "deploymentOrModelId" "text-davinci-003"
dotnet user-secrets set "apiKey" "... your OpenAI key ..."

Configure an Azure OpenAI endpoint

cd sk-csharp-azure-functions
dotnet user-secrets set "serviceType" "AzureOpenAI"
dotnet user-secrets set "serviceId" "text-davinci-003"
dotnet user-secrets set "deploymentOrModelId" "text-davinci-003"
dotnet user-secrets set "endpoint" "https:// ... your endpoint ... .openai.azure.com/"
dotnet user-secrets set "apiKey" "... your Azure OpenAI key ..."

Configure the Semantic Kernel logging level

dotnet user-secrets set "LogLevel" 0

Log levels:

  • 0 = Trace
  • 1 = Debug
  • 2 = Information
  • 3 = Warning
  • 4 = Error
  • 5 = Critical
  • 6 = None

Using appsettings.json

Configure an OpenAI endpoint

  1. Copy settings.json.openai-example to ./config/appsettings.json
  2. Edit the file to add your OpenAI endpoint configuration

Configure an Azure OpenAI endpoint

  1. Copy settings.json.azure-example to ./config/appsettings.json
  2. Edit the file to add your Azure OpenAI endpoint configuration

Running the starter

To run the Azure Functions application just hit F5.

To build and run the Azure Functions application from a terminal use the following commands:

dotnet build
func start --csharp