Created
August 20, 2024 17:52
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var modelId = "doesntmatter"; | |
// local Podman Desktop endpoint | |
var endpoint = new Uri("http://localhost:65527"); | |
var kernelBuilder = Kernel.CreateBuilder(); | |
#pragma warning disable SKEXP0010 // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed. | |
var kernel = kernelBuilder | |
.AddOpenAIChatCompletion( | |
modelId, | |
endpoint, | |
apiKey: null) | |
.Build(); | |
#pragma warning restore SKEXP0010 // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed. | |
var chatService = kernel.GetRequiredService<IChatCompletionService>(); | |
ChatHistory chat = new(); | |
chat.AddSystemMessage("You are a helpful travel assistant."); | |
var executionSettings = new OpenAIPromptExecutionSettings | |
{ | |
MaxTokens = 1000, | |
Temperature = 0.5, | |
TopP = 1, | |
FrequencyPenalty = 0, | |
PresencePenalty = 0, | |
StopSequences = new[] { "Human:", "AI:" }, | |
}; | |
var prompt = "Why should I visit Paris?"; | |
var response = await chatService.GetChatMessageContentAsync(prompt, executionSettings); | |
Console.WriteLine(response.Content); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment