Created
April 13, 2026 15:16
-
-
Save wullemsb/3977eec6094337e649aba21341067c92 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| // Define tool functions | |
| static string GetWeather(string city) => $"Weather in {city}: 18°C, partly cloudy."; // Replace with real API call | |
| static string GetForecast(string city, int days) => $"{days}-day forecast for {city}: mostly sunny with occasional showers."; | |
| // Create tool descriptors | |
| var weatherTools = new[] | |
| { | |
| AIFunctionFactory.Create(GetWeather, "get_weather", "Get the current weather for a city"), | |
| AIFunctionFactory.Create(GetForecast, "get_forecast", "Get a multi-day weather forecast"), | |
| }; | |
| // Register an agent with tools | |
| builder | |
| .AddAIAgent( | |
| "WeatherBot", | |
| "You are a friendly weather assistant. Always ask the user for their city if they haven't provided it." | |
| ) | |
| .WithAITools(weatherTools); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment