test bedrock tool call names

This commit is contained in:
Ishaan Jaff 2024-08-09 17:14:56 -07:00
parent 43ff70348d
commit 42617c207a

View file

@ -1006,7 +1006,7 @@ def test_bedrock_tool_calling():
"type": "function",
"function": {
"name": "-DoSomethingVeryCool-forLitellm_Testin999229291-0293993",
"description": "do something very cool",
"description": "use this to get the current weather",
"parameters": {"type": "object", "properties": {}},
},
}
@ -1016,6 +1016,18 @@ def test_bedrock_tool_calling():
print("bedrock response")
print(response)
# Assert that the tools in response have the same function name as the input
_choice_1 = response.choices[0]
if _choice_1.message.tool_calls is not None:
print(_choice_1.message.tool_calls)
for tool_call in _choice_1.message.tool_calls:
_tool_Call_name = tool_call.function.name
if _tool_Call_name is not None and "DoSomethingVeryCool" in _tool_Call_name:
assert (
_tool_Call_name
== "-DoSomethingVeryCool-forLitellm_Testin999229291-0293993"
)
def test_bedrock_tools_pt_valid_names():
"""