@@ -296,3 +296,92 @@ def test_model_config_generation_type_from_dict():
296296 )
297297 assert isinstance (model_config .inference_parameters , ChatCompletionInferenceParams )
298298 assert model_config .generation_type == GenerationType .CHAT_COMPLETION
299+
300+
301+ def test_chat_completion_params_format_for_display_all_params ():
302+ """Test formatting chat completion model with all parameters."""
303+ params = ChatCompletionInferenceParams (
304+ temperature = 0.7 ,
305+ top_p = 0.9 ,
306+ max_tokens = 2048 ,
307+ max_parallel_requests = 4 ,
308+ timeout = 60 ,
309+ )
310+ result = params .format_for_display ()
311+ assert "generation_type=chat-completion" in result
312+ assert "temperature=0.70" in result
313+ assert "top_p=0.90" in result
314+ assert "max_tokens=2048" in result
315+ assert "max_parallel_requests=4" in result
316+ assert "timeout=60" in result
317+
318+
319+ def test_chat_completion_params_format_for_display_partial_params ():
320+ """Test formatting chat completion model with partial parameters (some None)."""
321+ params = ChatCompletionInferenceParams (
322+ temperature = 0.5 ,
323+ max_tokens = 1024 ,
324+ )
325+ result = params .format_for_display ()
326+ assert "generation_type=chat-completion" in result
327+ assert "temperature=0.50" in result
328+ assert "max_tokens=1024" in result
329+ # None values should be excluded
330+ assert "top_p" not in result
331+ assert "timeout" not in result
332+
333+
334+ def test_embedding_params_format_for_display ():
335+ """Test formatting embedding model parameters."""
336+ params = EmbeddingInferenceParams (
337+ encoding_format = "float" ,
338+ dimensions = 1024 ,
339+ max_parallel_requests = 8 ,
340+ )
341+ result = params .format_for_display ()
342+ assert "generation_type=embedding" in result
343+ assert "encoding_format=float" in result
344+ assert "dimensions=1024" in result
345+ assert "max_parallel_requests=8" in result
346+ # Chat completion params should not appear
347+ assert "temperature" not in result
348+ assert "top_p" not in result
349+
350+
351+ def test_chat_completion_params_format_for_display_with_distribution ():
352+ """Test formatting parameters with distribution (should show 'dist')."""
353+ params = ChatCompletionInferenceParams (
354+ temperature = UniformDistribution (
355+ distribution_type = "uniform" ,
356+ params = UniformDistributionParams (low = 0.5 , high = 0.9 ),
357+ ),
358+ max_tokens = 2048 ,
359+ )
360+ result = params .format_for_display ()
361+ assert "generation_type=chat-completion" in result
362+ assert "temperature=dist" in result
363+ assert "max_tokens=2048" in result
364+
365+
366+ def test_inference_params_format_for_display_float_formatting ():
367+ """Test that float values are formatted to 2 decimal places."""
368+ params = ChatCompletionInferenceParams (
369+ temperature = 0.123456 ,
370+ top_p = 0.987654 ,
371+ )
372+ result = params .format_for_display ()
373+ assert "temperature=0.12" in result
374+ assert "top_p=0.99" in result
375+
376+
377+ def test_inference_params_format_for_display_minimal_params ():
378+ """Test formatting with only required parameters."""
379+ params = ChatCompletionInferenceParams ()
380+ result = params .format_for_display ()
381+ assert "generation_type=chat-completion" in result
382+ assert "max_parallel_requests=4" in result # Default value
383+ # Optional params should not appear when None
384+ assert "temperature" not in result
385+ assert "top_p" not in result
386+ assert "max_tokens" not in result
387+ assert "timeout" not in result
0 commit comments