mirror of
https://github.com/microsoft/autogen.git
synced 2025-07-04 23:50:39 +00:00
41 lines
1.8 KiB
C#
41 lines
1.8 KiB
C#
![]() |
// Copyright (c) Microsoft Corporation. All rights reserved.
|
|||
|
// LLMConfiguration.cs
|
|||
|
|
|||
|
using AutoGen.OpenAI;
|
|||
|
|
|||
|
namespace AutoGen.BasicSample;
|
|||
|
|
|||
|
internal static class LLMConfiguration
|
|||
|
{
|
|||
|
public static OpenAIConfig GetOpenAIGPT3_5_Turbo()
|
|||
|
{
|
|||
|
var openAIKey = Environment.GetEnvironmentVariable("OPENAI_API_KEY") ?? throw new Exception("Please set OPENAI_API_KEY environment variable.");
|
|||
|
var modelId = "gpt-3.5-turbo";
|
|||
|
return new OpenAIConfig(openAIKey, modelId);
|
|||
|
}
|
|||
|
|
|||
|
public static OpenAIConfig GetOpenAIGPT4()
|
|||
|
{
|
|||
|
var openAIKey = Environment.GetEnvironmentVariable("OPENAI_API_KEY") ?? throw new Exception("Please set OPENAI_API_KEY environment variable.");
|
|||
|
var modelId = "gpt-4";
|
|||
|
|
|||
|
return new OpenAIConfig(openAIKey, modelId);
|
|||
|
}
|
|||
|
|
|||
|
public static AzureOpenAIConfig GetAzureOpenAIGPT3_5_Turbo(string deployName = "gpt-35-turbo-16k")
|
|||
|
{
|
|||
|
var azureOpenAIKey = Environment.GetEnvironmentVariable("AZURE_OPENAI_API_KEY") ?? throw new Exception("Please set AZURE_OPENAI_API_KEY environment variable.");
|
|||
|
var endpoint = Environment.GetEnvironmentVariable("AZURE_OPENAI_ENDPOINT") ?? throw new Exception("Please set AZURE_OPENAI_ENDPOINT environment variable.");
|
|||
|
|
|||
|
return new AzureOpenAIConfig(endpoint, deployName, azureOpenAIKey);
|
|||
|
}
|
|||
|
|
|||
|
public static AzureOpenAIConfig GetAzureOpenAIGPT4(string deployName = "gpt-4")
|
|||
|
{
|
|||
|
var azureOpenAIKey = Environment.GetEnvironmentVariable("AZURE_OPENAI_API_KEY") ?? throw new Exception("Please set AZURE_OPENAI_API_KEY environment variable.");
|
|||
|
var endpoint = Environment.GetEnvironmentVariable("AZURE_OPENAI_ENDPOINT") ?? throw new Exception("Please set AZURE_OPENAI_ENDPOINT environment variable.");
|
|||
|
|
|||
|
return new AzureOpenAIConfig(endpoint, deployName, azureOpenAIKey);
|
|||
|
}
|
|||
|
}
|