GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — semantic-kernel-starters/sk-csharp-azure-functions at main · microsoft/semantic-kernel-starters

Expand file tree

/

sk-csharp-azure-functions

/
Copy path

Directory actions

More options

More options

Directory actions

More options

More options

Latest commit

 

History

History
History
/

sk-csharp-azure-functions

/
Copy path

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
.vscode
.vscode
 
 
Models
Models
 
 
config
config
 
 
skills/FunSkill
skills/FunSkill
 
 
Directory.Build.props
Directory.Build.props
 
 
Directory.Build.targets
Directory.Build.targets
 
 
ExecuteFunctionEndpoint.cs
ExecuteFunctionEndpoint.cs
 
 
Program.cs
Program.cs
 
 
README.md
README.md
 
 
host.json
host.json
 
 
local.settings.json
local.settings.json
 
 
sk-csharp-azure-functions.csproj
sk-csharp-azure-functions.csproj
 
 

README.md

Outline

Semantic Kernel Azure Functions Starter

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

Prerequisites

  • .NET 6 is required to run this starter.
  • Azure Functions Core Tools is required to run this starter.
  • Install the recommended extensions
    • C#
    • Semantic Kernel Tools

Configuring the starter

The starter can be configured by using either:

  • Enter secrets at the command line with .NET Secret Manager
  • Enter secrets in appsettings.json

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" "gpt-3.5-turbo"
dotnet user-secrets set "deploymentOrModelId" "gpt-3.5-turbo"
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" "gpt-35-turbo"
dotnet user-secrets set "deploymentOrModelId" "gpt-35-turbo"
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

Troubleshooting

Getting a 400 (BadRequest) and error "Azure.RequestFailedException: logprobs, best_of and echo parameters are not available on gpt-35-turbo model. Please remove the parameter and try again."

A chat completion model (gpt-35-turbo) was set in serviceId/deploymentOrModelId while the kernel was configured to use a text completion model. The type of model used by the kernel can be configured with the endpointType secret. To fix, you can either:

  • change endpointType to chat-completion
dotnet user-secrets set "endpointType" "chat-completion"
  • change serviceId and deploymentOrModelId to a text completion service like "text-davinci-003": See Using .NET Secret Manager. Please note that the text-davinci-003 model will be phased out in the future.
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.