Skip to content

Instantiating Semantic Kernel in multi session AI Web/API Application #6816

Answered by dmytrostruk
jamesmkfoo23 asked this question in Q&A
Discussion options

You must be logged in to vote

@jamesmkfoo23 Here is an example for your scenario for .NET version of Semantic Kernel:

skprompt.txt

Question: {{$input}}

config.json

{
  "schema": 1,
  "description": "Answer any question",
  "execution_settings": {
    "gpt-3.5-turbo": {
      "max_tokens": 4000,
      "temperature": 0.1
    }
  }
}

C#:

var builder = Kernel.CreateBuilder()
    .AddOpenAIChatCompletion(
        modelId: "gpt-3.5-turbo-0613",
        apiKey: Environment.GetEnvironmentVariable("OPENAI_APIKEY"),
        serviceId: "gpt-3.5-turbo")
    .AddOpenAIChatCompletion(
        modelId: "gpt-4-1106-preview",
        apiKey: Environment.GetEnvironmentVariable("OPENAI_APIKEY"),
        serviceId: "gpt-4");

builder.Plu…

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@jamesmkfoo23
Comment options

@dmytrostruk
Comment options

Answer selected by sophialagerkranspandey
@jamesmkfoo23
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants