mirror of
https://github.com/microsoft/autogen.git
synced 2025-10-14 01:18:55 +00:00
72 lines
2.1 KiB
Plaintext
72 lines
2.1 KiB
Plaintext
![]() |
//----------------------
|
|||
|
// <auto-generated>
|
|||
|
// This code was generated by a tool.
|
|||
|
// </auto-generated>
|
|||
|
//----------------------
|
|||
|
using System.Text.Json;
|
|||
|
using System.Text.Json.Serialization;
|
|||
|
using System.Threading.Tasks;
|
|||
|
using System;
|
|||
|
using AutoGen.Core;
|
|||
|
using AutoGen.OpenAI.Extension;
|
|||
|
|
|||
|
namespace AutoGen.SourceGenerator.Tests
|
|||
|
{
|
|||
|
public partial class FunctionExamples
|
|||
|
{
|
|||
|
|
|||
|
private class AddAsyncSchema
|
|||
|
{
|
|||
|
[JsonPropertyName(@"a")]
|
|||
|
public System.Int32 a {get; set;}
|
|||
|
[JsonPropertyName(@"b")]
|
|||
|
public System.Int32 b {get; set;}
|
|||
|
}
|
|||
|
|
|||
|
public System.Threading.Tasks.Task`1[System.String] AddAsyncWrapper(string arguments)
|
|||
|
{
|
|||
|
var schema = JsonSerializer.Deserialize<AddAsyncSchema>(
|
|||
|
arguments,
|
|||
|
new JsonSerializerOptions
|
|||
|
{
|
|||
|
PropertyNamingPolicy = JsonNamingPolicy.CamelCase,
|
|||
|
});
|
|||
|
|
|||
|
return AddAsync(schema.a, schema.b);
|
|||
|
}
|
|||
|
|
|||
|
public FunctionContract AddAsyncFunctionContract
|
|||
|
{
|
|||
|
get => new FunctionContract
|
|||
|
{
|
|||
|
Name = @"AddAsync",
|
|||
|
Description = @"Add two numbers.",
|
|||
|
ReturnType = typeof(System.Threading.Tasks.Task`1[System.String]),
|
|||
|
Parameters = new []
|
|||
|
{
|
|||
|
new FunctionParameterContract
|
|||
|
{
|
|||
|
Name = @"a",
|
|||
|
Description = @"The first number.",
|
|||
|
ParameterType = typeof(System.Int32),
|
|||
|
IsRequired = true,
|
|||
|
},
|
|||
|
new FunctionParameterContract
|
|||
|
{
|
|||
|
Name = @"b",
|
|||
|
Description = @"The second number.",
|
|||
|
ParameterType = typeof(System.Int32),
|
|||
|
IsRequired = true,
|
|||
|
},
|
|||
|
},
|
|||
|
};
|
|||
|
}
|
|||
|
|
|||
|
public global::Azure.AI.OpenAI.FunctionDefinition AddAsyncFunction
|
|||
|
{
|
|||
|
get => this.AddAsyncFunctionContract.ToOpenAIFunctionDefinition();
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
|