fix: use json object type

This commit is contained in:
Stevan Freeborn
2024-06-30 13:57:10 -05:00
parent 9c8162036e
commit 4fd8ecd96b
+10 -1
View File
@@ -25,7 +25,7 @@ public class Tool
/// Gets the input schema of the tool.
/// </summary>
[JsonPropertyName("input_schema")]
public JsonNode InputSchema { get; }
public JsonObject InputSchema { get; }
/// <summary>
/// Gets the function of the tool.
@@ -116,4 +116,13 @@ public class Tool
return new Tool(name, description, new AnthropicFunction(func.Method, func.Target));
}
public static Tool CreateFromFunction<T1, TResult>(string name, string description, Func<T1, TResult> func)
{
ArgumentValidator.ThrowIfNull(name, nameof(name));
ArgumentValidator.ThrowIfNull(description, nameof(description));
ArgumentValidator.ThrowIfNull(func, nameof(func));
return new Tool(name, description, new AnthropicFunction(func.Method, func.Target));
}
}