diff --git a/src/AnthropicClient/Models/Tool.cs b/src/AnthropicClient/Models/Tool.cs index b060120..fd40d12 100644 --- a/src/AnthropicClient/Models/Tool.cs +++ b/src/AnthropicClient/Models/Tool.cs @@ -35,8 +35,8 @@ public class Tool internal Tool(string name, string description, AnthropicFunction function) { - ArgumentValidator.ThrowIfNull(name, nameof(name)); - ArgumentValidator.ThrowIfNull(description, nameof(description)); + ArgumentValidator.ThrowIfNullOrWhitespace(name, nameof(name)); + ArgumentValidator.ThrowIfNullOrWhitespace(description, nameof(description)); ArgumentValidator.ThrowIfNull(function, nameof(function)); Name = name; @@ -57,11 +57,6 @@ public class Tool /// The created tool as instance of . public static Tool CreateFromStaticMethod(string name, string description, Type type, string methodName) { - ArgumentValidator.ThrowIfNull(name, nameof(name)); - ArgumentValidator.ThrowIfNull(description, nameof(description)); - ArgumentValidator.ThrowIfNull(type, nameof(type)); - ArgumentValidator.ThrowIfNull(methodName, nameof(methodName)); - var method = type.GetMethod(methodName, BindingFlags.Public | BindingFlags.Static); if (method is null) @@ -84,11 +79,6 @@ public class Tool /// The created tool as instance of . public static Tool CreateFromInstanceMethod(string name, string description, object instance, string methodName) { - ArgumentValidator.ThrowIfNull(name, nameof(name)); - ArgumentValidator.ThrowIfNull(description, nameof(description)); - ArgumentValidator.ThrowIfNull(instance, nameof(instance)); - ArgumentValidator.ThrowIfNull(methodName, nameof(methodName)); - var method = instance.GetType().GetMethod(methodName, BindingFlags.Public | BindingFlags.Instance); if (method is null) @@ -102,7 +92,7 @@ public class Tool /// /// Creates a tool from a function. /// - /// The type of the result. + /// The type of the result for the delegate. /// The name of the tool. /// The description of the tool. /// The function. @@ -110,19 +100,21 @@ public class Tool /// The created tool as instance of . 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)); } + /// + /// Creates a tool from a function. + /// + /// The type of the first parameter for the delegate. + /// The type of the result for the delegate. + /// The name of the tool. + /// The description of the tool. + /// The function. + /// Thrown when , , or is null. + /// The created tool as instance of . 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 diff --git a/src/AnthropicClient/Models/ToolCall.cs b/src/AnthropicClient/Models/ToolCall.cs new file mode 100644 index 0000000..a1a9ed0 --- /dev/null +++ b/src/AnthropicClient/Models/ToolCall.cs @@ -0,0 +1,17 @@ +namespace AnthropicClient.Models; + +/// +/// Represents a tool call. +/// +public class ToolCall +{ + // TODO: Implementation + // - each tool call needs parameters + // - each tool call needs a tool name + // - each tool needs function to call + // - tool may or may not need an instance + // - tool call will be given input from tool use + // - tool call should have list of known functions + // - tool call should be able to find function by name + // - tool call should be able to translate input to function parameters +} \ No newline at end of file