// Copyright (c) Microsoft Corporation. All rights reserved.
// AnthropicTestFunctionCalls.cs
using System.Text.Json;
using System.Text.Json.Serialization;
using AutoGen.Core;
namespace AutoGen.Anthropic.Tests;
public partial class AnthropicTestFunctionCalls
{
private sealed class GetWeatherSchema
{
[JsonPropertyName("city")]
public string? City { get; set; }
[JsonPropertyName("date")]
public string? Date { get; set; }
}
///
/// Get weather report
///
/// city
/// date
[Function]
public async Task WeatherReport(string city, string date)
{
return $"Weather report for {city} on {date} is sunny";
}
public Task GetWeatherReportWrapper(string arguments)
{
var schema = JsonSerializer.Deserialize(
arguments,
new JsonSerializerOptions { PropertyNamingPolicy = JsonNamingPolicy.CamelCase });
return WeatherReport(schema?.City ?? string.Empty, schema?.Date ?? string.Empty);
}
}