Skip to content

Commit

Permalink
Add test for claude tools to_dict
Browse files Browse the repository at this point in the history
  • Loading branch information
roaga committed Jul 17, 2024
1 parent b37aeeb commit a3bad9e
Showing 1 changed file with 42 additions and 17 deletions.
59 changes: 42 additions & 17 deletions tests/automation/agent/test_agent_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,22 +66,47 @@ def test_chained_exception_handling(self, function_tool):
assert result == expected
mock_logger.exception.assert_called_once()

def test_to_dict(self, function_tool):
expected = {
"type": "function",
"function": {
"name": "test_tool",
"description": "A test tool",
"parameters": {
"type": "object",
"properties": {
"param1": {
"type": "string",
"description": "",
}
@pytest.mark.parametrize(
"model, expected",
[
(
"gpt",
{
"type": "function",
"function": {
"name": "test_tool",
"description": "A test tool",
"parameters": {
"type": "object",
"properties": {
"param1": {
"type": "string",
"description": "",
}
},
"required": [],
},
},
"required": [],
},
},
}
assert function_tool.to_dict() == expected
),
(
"claude",
{
"name": "test_tool",
"description": "A test tool",
"input_schema": {
"type": "object",
"properties": {
"param1": {
"type": "string",
"description": "",
}
},
"required": [],
},
},
),
],
)
def test_to_dict(self, function_tool, model, expected):
assert function_tool.to_dict(model=model) == expected

0 comments on commit a3bad9e

Please sign in to comment.