Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions Examples/Examples/Chat/ChatExampleToolsSimple.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@ public async Task Start()
{
OpenAiExample.Setup(); //We need to provide OpenAi API key

Console.WriteLine("(OpenAi) ChatExample with tools is running!");
Console.WriteLine("(OpenAi) ChatExample with tools is running!");

var model = AIHub.Model();

await AIHub.Chat()
.WithModel("gpt-5-nano")
Expand All @@ -25,4 +27,4 @@ await AIHub.Chat()
.Build())
.CompleteAsync(interactive: true);
}
}
}
27 changes: 27 additions & 0 deletions Examples/Examples/Chat/ChatExampleToolsSimpleLocalLLM.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
using Examples.Utils;
using MaIN.Core.Hub;
using MaIN.Core.Hub.Utils;

namespace Examples.Chat;

public class ChatExampleToolsSimpleLocalLLM : IExample
{
public async Task Start()
{
Console.WriteLine("Local LLM ChatExample with tools is running!");

var model = AIHub.Model();

await AIHub.Chat()
.WithModel("gemma3:4b")
.WithMessage("What time is it right now?")
.WithTools(new ToolsConfigurationBuilder()
.AddTool(
name: "get_current_time",
description: "Get the current date and time",
execute: Tools.GetCurrentTime)
.WithToolChoice("auto")
.Build())
.CompleteAsync(interactive: true);
}
}
2 changes: 2 additions & 0 deletions Examples/Examples/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ static void RegisterExamples(IServiceCollection services)
services.AddTransient<ChatFromExistingExample>();
services.AddTransient<ChatWithReasoningExample>();
services.AddTransient<ChatExampleToolsSimple>();
services.AddTransient<ChatExampleToolsSimpleLocalLLM>();
services.AddTransient<AgentExampleTools>();
services.AddTransient<AgentExample>();
services.AddTransient<AgentConversationExample>();
Expand Down Expand Up @@ -146,6 +147,7 @@ public class ExampleRegistry(IServiceProvider serviceProvider)
("\u25a0 Chat with Files from stream", serviceProvider.GetRequiredService<ChatWithFilesFromStreamExample>()),
("\u25a0 Chat with Vision", serviceProvider.GetRequiredService<ChatWithVisionExample>()),
("\u25a0 Chat with Tools (simple)", serviceProvider.GetRequiredService<ChatExampleToolsSimple>()),
("\u25a0 Chat with Tools (simple) Local LLM", serviceProvider.GetRequiredService<ChatExampleToolsSimpleLocalLLM>()),
("\u25a0 Chat with Image Generation", serviceProvider.GetRequiredService<ChatWithImageGenExample>()),
("\u25a0 Chat from Existing", serviceProvider.GetRequiredService<ChatFromExistingExample>()),
("\u25a0 Chat with reasoning", serviceProvider.GetRequiredService<ChatWithReasoningExample>()),
Expand Down
Loading
Loading