From 4fd8ecd96b6ff6000a52ae24d90a19e6689704d2 Mon Sep 17 00:00:00 2001 From: Stevan Freeborn <65925598+StevanFreeborn@users.noreply.github.com> Date: Sun, 30 Jun 2024 13:57:10 -0500 Subject: [PATCH] fix: use json object type --- src/AnthropicClient/Models/Tool.cs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/AnthropicClient/Models/Tool.cs b/src/AnthropicClient/Models/Tool.cs index 85273f2..b060120 100644 --- a/src/AnthropicClient/Models/Tool.cs +++ b/src/AnthropicClient/Models/Tool.cs @@ -25,7 +25,7 @@ public class Tool /// Gets the input schema of the tool. /// [JsonPropertyName("input_schema")] - public JsonNode InputSchema { get; } + public JsonObject InputSchema { get; } /// /// 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(string name, string description, Func 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)); + } } \ No newline at end of file