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.

Functions.cs 779 B

12345678910111213141516171819202122232425262728
  1. // Copyright (c) Microsoft Corporation. All rights reserved.
  2. // Functions.cs
  3. using AutoGen.Core;
  4. namespace AutoGen.Gemini.Tests;
  5. public partial class Functions
  6. {
  7. /// <summary>
  8. /// Get weather for a city.
  9. /// </summary>
  10. /// <param name="city">city</param>
  11. /// <returns>weather</returns>
  12. [Function]
  13. public async Task<string> GetWeatherAsync(string city)
  14. {
  15. return await Task.FromResult($"The weather in {city} is sunny.");
  16. }
  17. [Function]
  18. public async Task<string> GetMovies(string location, string description)
  19. {
  20. var movies = new List<string> { "Barbie", "Spiderman", "Batman" };
  21. return await Task.FromResult($"Movies playing in {location} based on {description} are: {string.Join(", ", movies)}");
  22. }
  23. }