Fix prompt formatting biases affecting JSON output

Co-Authored-By: Joe Moura <joao@crewai.com>
This commit is contained in:
Devin AI
2025-05-13 17:52:58 +00:00
parent 409892d65f
commit 48f7721baf
4 changed files with 85 additions and 6 deletions

View File

@@ -102,15 +102,15 @@ def test_tool_usage_render():
rendered = tool_usage._render()
# Updated checks to match the actual output
# Updated checks to match the actual output with JSON formatting
assert "Tool Name: Random Number Generator" in rendered
assert "Tool Arguments:" in rendered
assert (
"'min_value': {'description': 'The minimum value of the range (inclusive)', 'type': 'int'}"
'"min_value": {"description": "The minimum value of the range (inclusive)", "type": "int"}'
in rendered
)
assert (
"'max_value': {'description': 'The maximum value of the range (inclusive)', 'type': 'int'}"
'"max_value": {"description": "The maximum value of the range (inclusive)", "type": "int"}'
in rendered
)
assert (
@@ -118,6 +118,6 @@ def test_tool_usage_render():
in rendered
)
assert (
"Tool Name: Random Number Generator\nTool Arguments: {'min_value': {'description': 'The minimum value of the range (inclusive)', 'type': 'int'}, 'max_value': {'description': 'The maximum value of the range (inclusive)', 'type': 'int'}}\nTool Description: Generates a random number within a specified range"
'Tool Name: Random Number Generator\nTool Arguments: {"min_value": {"description": "The minimum value of the range (inclusive)", "type": "int"}, "max_value": {"description": "The maximum value of the range (inclusive)", "type": "int"}}\nTool Description: Generates a random number within a specified range'
in rendered
)