@@ -226,23 +226,23 @@ def test_chat_completion_with_timings_per_token():
226226}
227227
228228
229- @pytest .mark .parametrize ("template_name,n_predict,tool,expected_arguments " , [
230- ("meetkai-functionary-medium-v3.1" , 128 , TEST_TOOL , { "success" : True } ),
231- ("meetkai-functionary-medium-v3.1" , 128 , PYTHON_TOOL , { "code" : ". She was so excited to go to the park and climble agace. She was so excited to go to the park and play with her friends. \n They played together and had lots of fun. They were very happy. At the park, they found the park and had a great time. After a while, they found" } ),
232- ("meetkai-functionary-medium-v3.2" , 128 , TEST_TOOL , { "success" : True } ),
233- ("meetkai-functionary-medium-v3.2" , 128 , PYTHON_TOOL , { "code" : "It's a spector." } ),
234- ("NousResearch-Hermes-2-Pro-Llama-3-8B-tool_use" , 128 , TEST_TOOL , { "success" : True } ),
235- ("NousResearch-Hermes-2-Pro-Llama-3-8B-tool_use" , 128 , PYTHON_TOOL , { "code" : "Yes, you can." } ),
236- ("NousResearch-Hermes-3-Llama-3.1-8B-tool_use" , 128 , TEST_TOOL , { "success" : True } ),
237- ("NousResearch-Hermes-3-Llama-3.1-8B-tool_use" , 128 , PYTHON_TOOL , { "code" : "Yes, you can." } ),
238- ("meta-llama-Meta-Llama-3.1-8B-Instruct" , 128 , TEST_TOOL , { "success" : True } ),
239- ("meta-llama-Meta-Llama-3.1-8B-Instruct" , 128 , PYTHON_TOOL , { "code" : "It's a spector." } ),
240- ("meta-llama-Llama-3.2-3B-Instruct" , 128 , TEST_TOOL , { "success" : True } ),
241- ("meta-llama-Llama-3.2-3B-Instruct" , 128 , PYTHON_TOOL , { "code" : "It's a spectork." } ),
242- ("mistralai-Mistral-Nemo-Instruct-2407" , 128 , TEST_TOOL , { "success" : True } ),
243- ("mistralai-Mistral-Nemo-Instruct-2407" , 128 , PYTHON_TOOL , { "code" : "It's a speciachy!" } ),
229+ @pytest .mark .parametrize ("template_name,n_predict,tool,argument_key " , [
230+ ("meetkai-functionary-medium-v3.1" , 128 , TEST_TOOL , "success" ),
231+ ("meetkai-functionary-medium-v3.1" , 128 , PYTHON_TOOL , "code" ),
232+ ("meetkai-functionary-medium-v3.2" , 128 , TEST_TOOL , "success" ),
233+ ("meetkai-functionary-medium-v3.2" , 128 , PYTHON_TOOL , "code" ),
234+ ("NousResearch-Hermes-2-Pro-Llama-3-8B-tool_use" , 128 , TEST_TOOL , "success" ),
235+ ("NousResearch-Hermes-2-Pro-Llama-3-8B-tool_use" , 128 , PYTHON_TOOL , "code" ),
236+ ("NousResearch-Hermes-3-Llama-3.1-8B-tool_use" , 128 , TEST_TOOL , "success" ),
237+ ("NousResearch-Hermes-3-Llama-3.1-8B-tool_use" , 128 , PYTHON_TOOL , "code" ),
238+ ("meta-llama-Meta-Llama-3.1-8B-Instruct" , 128 , TEST_TOOL , "success" ),
239+ ("meta-llama-Meta-Llama-3.1-8B-Instruct" , 128 , PYTHON_TOOL , "code" ),
240+ ("meta-llama-Llama-3.2-3B-Instruct" , 128 , TEST_TOOL , "success" ),
241+ ("meta-llama-Llama-3.2-3B-Instruct" , 128 , PYTHON_TOOL , "code" ),
242+ ("mistralai-Mistral-Nemo-Instruct-2407" , 128 , TEST_TOOL , "success" ),
243+ ("mistralai-Mistral-Nemo-Instruct-2407" , 128 , PYTHON_TOOL , "code" ),
244244])
245- def test_completion_with_required_tool (template_name : str , n_predict : int , tool : dict , expected_arguments : dict ):
245+ def test_completion_with_required_tool (template_name : str , n_predict : int , tool : dict , argument_key : str ):
246246 global server
247247 # server = ServerPreset.stories15m_moe()
248248 server .jinja = True
@@ -269,7 +269,7 @@ def test_completion_with_required_tool(template_name: str, n_predict: int, tool:
269269 tool_call = tool_calls [0 ]
270270 assert tool ["function" ]["name" ] == tool_call ["function" ]["name" ]
271271 actual_arguments = json .loads (tool_call ["function" ]["arguments" ])
272- assert json . dumps ( expected_arguments ) == json . dumps ( actual_arguments ) , f"tool arguments: { json .dumps (actual_arguments )} , expected: { json . dumps ( expected_arguments ) } "
272+ assert argument_key in actual_arguments , f"tool arguments: { json .dumps (actual_arguments )} , expected: { argument_key } "
273273
274274
275275@pytest .mark .parametrize ("template_name,n_predict,tools,tool_choice" , [
0 commit comments