@@ -627,20 +627,26 @@ def set_default_model_params(
627627 )
628628 return params
629629
630+
630631def set_structured_decoding_parameters (
631632 spec : Any ,
632- parameters : Optional [dict [str , Any ]],
633+ parameters : Optional [dict [str , Any ]],
633634) -> dict [str , Any ]:
634635 if parameters is None :
635636 parameters = {}
636-
637- if spec is not None and parameters ["response_format" ] is None and "guided_decoding_backend" not in parameters :
637+
638+ if (
639+ spec is not None
640+ and parameters ["response_format" ] is None
641+ and "guided_decoding_backend" not in parameters
642+ ):
638643 schema = pdltype_to_jsonschema (spec , True )
639644 parameters ["guided_decoding_backend" ] = "lm-format-enforcer"
640645 parameters ["guided_json" ] = schema
641- #parameters["response_format"] = { "type": "json_schema", "json_schema": schema , "strict": True }
646+ # parameters["response_format"] = { "type": "json_schema", "json_schema": schema , "strict": True }
642647 return parameters
643648
649+
644650def set_default_granite_model_parameters (
645651 model_id : str ,
646652 spec : Any ,
@@ -652,12 +658,12 @@ def set_default_granite_model_parameters(
652658 if "watsonx" in model_id :
653659 if "decoding_method" not in parameters :
654660 parameters ["decoding_method" ] = (
655- DECODING_METHOD # pylint: disable=attribute-defined-outside-init
656- )
661+ DECODING_METHOD # pylint: disable=attribute-defined-outside-init
662+ )
657663 if "max_tokens" in parameters and parameters ["max_tokens" ] is None :
658664 parameters ["max_tokens" ] = (
659- MAX_NEW_TOKENS # pylint: disable=attribute-defined-outside-init
660- )
665+ MAX_NEW_TOKENS # pylint: disable=attribute-defined-outside-init
666+ )
661667 if "min_new_tokens" not in parameters :
662668 parameters ["min_new_tokens" ] = (
663669 MIN_NEW_TOKENS # pylint: disable=attribute-defined-outside-init
0 commit comments