Skip to content

Commit 70a4a13

Browse files
implement Function Calling
1 parent 04964d6 commit 70a4a13

File tree

5 files changed

+470
-46
lines changed

5 files changed

+470
-46
lines changed
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
#if NET472_OR_GREATER || NETSTANDARD2_0
2+
using System.Text.Json.Serialization;
3+
#endif
4+
5+
namespace Mscc.GenerativeAI
6+
{
7+
[JsonConverter(typeof(JsonStringEnumConverter<ParameterType>))]
8+
public enum ParameterType
9+
{
10+
/// <summary>
11+
/// Unspecified means not specified, should not be used.
12+
/// </summary>
13+
Unspecified = 0,
14+
/// <summary>
15+
/// String means openAPI string type
16+
/// </summary>
17+
String = 1,
18+
/// <summary>
19+
/// Number means openAPI number type
20+
/// </summary>
21+
Number = 2,
22+
/// <summary>
23+
/// Integer means openAPI integer type
24+
/// </summary>
25+
Integer = 3,
26+
/// <summary>
27+
/// Boolean means openAPI boolean type
28+
/// </summary>
29+
Boolean = 4,
30+
/// <summary>
31+
/// Array means openAPI array type
32+
/// </summary>
33+
Array = 5,
34+
/// <summary>
35+
/// Object means openAPI object type
36+
/// </summary>
37+
Object = 6
38+
}
39+
}

src/Mscc.GenerativeAI/Enums/Type.cs

Lines changed: 0 additions & 37 deletions
This file was deleted.

src/Mscc.GenerativeAI/Types/Schema.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ public class Schema
77
/// <summary>
88
/// Optional. The type of the data.
99
/// </summary>
10-
public Type? Type { get; set; }
10+
public ParameterType? Type { get; set; }
1111
/// <summary>
1212
/// Optional. The format of the data.
1313
/// Supported formats:
@@ -22,7 +22,7 @@ public class Schema
2222
/// <summary>
2323
/// Optional. Indicates if the value may be null.
2424
/// </summary>
25-
public bool Nullable { get; set; }
25+
public bool? Nullable { get; set; }
2626
/// <summary>
2727
/// Optional. Schema of the elements of Type.ARRAY.
2828
/// </summary>
@@ -36,7 +36,7 @@ public class Schema
3636
/// <summary>
3737
/// Optional. Properties of Type.OBJECT.
3838
/// </summary>
39-
public Schema? Properties { get; set; }
39+
public dynamic? Properties { get; set; }
4040
/// <summary>
4141
/// Optional. Required properties of Type.OBJECT.
4242
/// </summary>

src/Mscc.GenerativeAI/Types/Tool.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
using System.Collections.Generic;
1+
#if NET472_OR_GREATER || NETSTANDARD2_0
2+
using System.Collections.Generic;
3+
#endif
24

35
namespace Mscc.GenerativeAI
46
{
@@ -14,6 +16,7 @@ public class Tool
1416
/// final response back to the user. Maximum 64 function declarations can be
1517
/// provided.
1618
/// </summary>
19+
// [JsonPropertyName("function_declarations")]
1720
public List<FunctionDeclaration>? FunctionDeclarations { get; set; }
1821
}
1922
}

0 commit comments

Comments
 (0)