@@ -255,6 +255,16 @@ def test_consistency_between_runs(api_url, headers, consistent_payload):
255255 assert content1 == content2
256256
257257
258+ def test_with_metadata (api_url , headers , consistent_payload ):
259+ """
260+ Test that result is same as the base result.
261+ """
262+ # request
263+ consistent_payload ["metadata" ] = {"enable_thinking" : True }
264+ resp1 = requests .post (api_url , headers = headers , json = consistent_payload )
265+ assert resp1 .status_code == 200
266+
267+
258268# ==========================
259269# OpenAI Client Chat Completion Test
260270# ==========================
@@ -555,6 +565,46 @@ def test_chat_with_thinking(openai_client, capsys):
555565 assert reasoning_tokens <= reasoning_max_tokens
556566
557567
568+ def test_chat_with_completion_token_ids (openai_client ):
569+ """Test completion_token_ids"""
570+ response = openai_client .chat .completions .create (
571+ model = "default" ,
572+ messages = [{"role" : "user" , "content" : "Hello" }],
573+ extra_body = {
574+ "completion_token_ids" : [94936 ],
575+ "return_token_ids" : True ,
576+ "reasoning_max_tokens" : 20 ,
577+ "max_tokens" : 10 ,
578+ },
579+ max_tokens = 10 ,
580+ stream = False ,
581+ )
582+ assert hasattr (response , "choices" )
583+ assert len (response .choices ) > 0
584+ assert hasattr (response .choices [0 ], "message" )
585+ assert hasattr (response .choices [0 ].message , "prompt_token_ids" )
586+ assert isinstance (response .choices [0 ].message .prompt_token_ids , list )
587+ assert 94936 in response .choices [0 ].message .prompt_token_ids
588+
589+
590+ def test_chat_with_reasoning_max_tokens (openai_client ):
591+ """Test completion_token_ids"""
592+ assertion_executed = False
593+ try :
594+ openai_client .chat .completions .create (
595+ model = "default" ,
596+ messages = [{"role" : "user" , "content" : "Hello" }],
597+ extra_body = {"completion_token_ids" : [18900 ], "return_token_ids" : True , "reasoning_max_tokens" : - 1 },
598+ max_tokens = 10 ,
599+ stream = False ,
600+ )
601+ except Exception as e :
602+ error_message = str (e )
603+ assertion_executed = True
604+ assert "reasoning_max_tokens must be greater than 1" in error_message
605+ assert assertion_executed , "Assertion was not executed (no exception raised)"
606+
607+
558608def test_profile_reset_block_num ():
559609 """测试profile reset_block_num功能,与baseline diff不能超过5%"""
560610 log_file = "./log/config.log"
0 commit comments