From da93ffd1f02861b8a1154e6354b64b6c220787ae Mon Sep 17 00:00:00 2001
From: Stevan Freeborn <65925598+StevanFreeborn@users.noreply.github.com>
Date: Mon, 1 Jul 2024 10:51:54 -0500
Subject: [PATCH] fix: remove throw if name is invalid
---
src/AnthropicClient/Models/Tool.cs | 13 -------------
1 file changed, 13 deletions(-)
diff --git a/src/AnthropicClient/Models/Tool.cs b/src/AnthropicClient/Models/Tool.cs
index 3b1d07a..d5d0d1b 100644
--- a/src/AnthropicClient/Models/Tool.cs
+++ b/src/AnthropicClient/Models/Tool.cs
@@ -52,7 +52,6 @@ public class Tool
ArgumentValidator.ThrowIfNull(function, nameof(function));
var sanitizedName = SanitizeName(name);
- ThrowIfNameIsInvalid(sanitizedName);
Name = sanitizedName;
DisplayName = name;
@@ -70,7 +69,6 @@ public class Tool
/// The name of the method.
/// Thrown when , , , or is null.
/// Thrown when the method is not found in the type.
- /// Thrown when the name of the tool is invalid.
/// The created tool as instance of .
/// The name of the tool will be sanitized to conform to the Anthropic tool naming rules.
public static Tool CreateFromStaticMethod(string name, string description, Type type, string methodName)
@@ -94,7 +92,6 @@ public class Tool
/// The name of the method.
/// Thrown when , , , or is null.
/// Thrown when the method is not found in the type.
- /// Thrown when the name of the tool is invalid.
/// The created tool as instance of .
/// The name of the tool will be sanitized to conform to the Anthropic tool naming rules.
public static Tool CreateFromInstanceMethod(string name, string description, object instance, string methodName)
@@ -117,7 +114,6 @@ public class Tool
/// The description of the tool.
/// The function.
/// Thrown when , , or is null.
- /// Thrown when the name of the tool is invalid.
/// The created tool as instance of .
/// The name of the tool will be sanitized to conform to the Anthropic tool naming rules.
public static Tool CreateFromFunction(string name, string description, Func func)
@@ -134,7 +130,6 @@ public class Tool
/// The description of the tool.
/// The function.
/// Thrown when , , or is null.
- /// Thrown when the name of the tool is invalid.
/// The created tool as instance of .
/// The name of the tool will be sanitized to conform to the Anthropic tool naming rules.
public static Tool CreateFromFunction(string name, string description, Func func)
@@ -155,12 +150,4 @@ public class Tool
return sanitizedName;
}
-
- private void ThrowIfNameIsInvalid(string name)
- {
- if (_nameRegex.IsMatch(name) is false)
- {
- throw new ArgumentException("Tool name must be between 1 and 64 characters long and contain only letters, numbers, underscores, and hyphens.", nameof(name));
- }
- }
}
\ No newline at end of file