Griffin Bassman 850377c74a
fix: Various fixes and cleanups to dotnet autogen core (#5242)
Co-authored-by: Jack Gerrits <jack@jackgerrits.com>
Co-authored-by: Ryan Sweet <rysweet@microsoft.com>
2025-01-28 17:13:36 -05:00

33 lines
897 B
C#

// Copyright (c) Microsoft Corporation. All rights reserved.
// Chat_With_LLaMA.cs
#region Using
using AutoGen.Core;
using AutoGen.Ollama.Extension;
#endregion Using
namespace AutoGen.Ollama.Sample;
public class Chat_With_LLaMA
{
public static async Task RunAsync()
{
#region Create_Ollama_Agent
using var httpClient = new HttpClient()
{
BaseAddress = new Uri("http://localhost:11434"),
};
var ollamaAgent = new OllamaAgent(
httpClient: httpClient,
name: "ollama",
modelName: "llama3:latest",
systemMessage: "You are a helpful AI assistant")
.RegisterMessageConnector()
.RegisterPrintMessage();
var reply = await ollamaAgent.SendAsync("Can you write a piece of C# code to calculate 100th of fibonacci?");
#endregion Create_Ollama_Agent
}
}