Function Schema from Data Annotation #429
-
Can you add data annotation support something like this? [Description("Weather Service")]
public class WeatherService : IFunction
{
[Description("Get the current weather in a given location")]
public Task<Weather> Handle(
[Description("The city and state, e.g. San Francisco, CA")]
string location,
Unit unit = Unit.Celsius, CancellationToken cancellationToken = default)
{
return Task.FromResult(new Weather
{
Location = location,
Temperature = 22.0,
Unit = unit,
Description = "Sunny",
});
}
} |
Beta Was this translation helpful? Give feedback.
Answered by
StephenHodgson
Mar 3, 2025
Replies: 1 comment
-
yes. See unit tests: OpenAI-DotNet/OpenAI-DotNet-Tests/TestServices/WeatherService.cs Lines 8 to 33 in d75292d |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
StephenHodgson
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
yes. See unit tests:
OpenAI-DotNet/OpenAI-DotNet-Tests/TestServices/WeatherService.cs
Lines 8 to 33 in d75292d