You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

Chat_With_LLaMA.cs 897 B

1234567891011121314151617181920212223242526272829303132
  1. // Copyright (c) Microsoft Corporation. All rights reserved.
  2. // Chat_With_LLaMA.cs
  3. #region Using
  4. using AutoGen.Core;
  5. using AutoGen.Ollama.Extension;
  6. #endregion Using
  7. namespace AutoGen.Ollama.Sample;
  8. public class Chat_With_LLaMA
  9. {
  10. public static async Task RunAsync()
  11. {
  12. #region Create_Ollama_Agent
  13. using var httpClient = new HttpClient()
  14. {
  15. BaseAddress = new Uri("http://localhost:11434"),
  16. };
  17. var ollamaAgent = new OllamaAgent(
  18. httpClient: httpClient,
  19. name: "ollama",
  20. modelName: "llama3:latest",
  21. systemMessage: "You are a helpful AI assistant")
  22. .RegisterMessageConnector()
  23. .RegisterPrintMessage();
  24. var reply = await ollamaAgent.SendAsync("Can you write a piece of C# code to calculate 100th of fibonacci?");
  25. #endregion Create_Ollama_Agent
  26. }
  27. }