fix(sampling): reject conflicting structural tag constraints (#32525)
This commit is contained in:
@@ -196,9 +196,12 @@ class SamplingParams(msgspec.Struct, kw_only=True, array_like=True):
|
||||
self.json_schema,
|
||||
self.regex,
|
||||
self.ebnf,
|
||||
self.structural_tag,
|
||||
] # since mutually exclusive, only one can be set
|
||||
if sum(x is not None for x in grammars) > 1:
|
||||
raise ValueError("Only one of regex, json_schema, or ebnf can be set.")
|
||||
raise ValueError(
|
||||
"Only one of json_schema, regex, ebnf, or structural_tag can be set."
|
||||
)
|
||||
|
||||
def normalize(self, tokenizer):
|
||||
# Process stop strings
|
||||
|
||||
Reference in New Issue
Block a user