mirror of
https://github.com/crewAIInc/crewAI.git
synced 2026-01-11 00:58:30 +00:00
Revert tool validation
This commit is contained in:
@@ -409,9 +409,15 @@ class ToolUsage:
|
|||||||
|
|
||||||
def _validate_tool_input(self, tool_input: str) -> Dict[str, Any]:
|
def _validate_tool_input(self, tool_input: str) -> Dict[str, Any]:
|
||||||
try:
|
try:
|
||||||
# Replace 'None', 'True', 'False' with their JSON equivalents
|
# Replace Python literals with JSON equivalents
|
||||||
tool_input = tool_input.replace('"None"', "null")
|
replacements = {
|
||||||
tool_input = tool_input.replace("True", "true").replace("False", "false")
|
r"'": '"',
|
||||||
|
r"None": "null",
|
||||||
|
r"True": "true",
|
||||||
|
r"False": "false",
|
||||||
|
}
|
||||||
|
for pattern, replacement in replacements.items():
|
||||||
|
tool_input = re.sub(pattern, replacement, tool_input)
|
||||||
|
|
||||||
arguments = json.loads(tool_input)
|
arguments = json.loads(tool_input)
|
||||||
except json.JSONDecodeError:
|
except json.JSONDecodeError:
|
||||||
|
|||||||
@@ -12,7 +12,6 @@ class InternalAgentTool(BaseAgentTool):
|
|||||||
return "Test response"
|
return "Test response"
|
||||||
|
|
||||||
|
|
||||||
# new comment
|
|
||||||
@pytest.mark.parametrize(
|
@pytest.mark.parametrize(
|
||||||
"role_name,should_match",
|
"role_name,should_match",
|
||||||
[
|
[
|
||||||
|
|||||||
Reference in New Issue
Block a user