[GPT-OSS] Structure_Tag support for gpt-oss tool-call in cot (#25515)
Signed-off-by: Hanchenli <lihanc2002@gmail.com> Signed-off-by: Hanchenli <61769611+Hanchenli@users.noreply.github.com> Signed-off-by: Wei Wei <wwei6@meta.com> Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> Co-authored-by: Wei Wei <wwei6@meta.com> Co-authored-by: Wei Wei <weiweinpu@gmail.com> Co-authored-by: Cyrus Leung <tlleungac@connect.ust.hk>
This commit is contained in:
@@ -58,6 +58,7 @@ class StructuredOutputsParams:
|
||||
self.choice is not None,
|
||||
self.grammar is not None,
|
||||
self.json_object is not None,
|
||||
self.structural_tag is not None,
|
||||
]
|
||||
)
|
||||
if count > 1:
|
||||
@@ -66,6 +67,37 @@ class StructuredOutputsParams:
|
||||
f"but multiple are specified: {self.__dict__}"
|
||||
)
|
||||
|
||||
def all_constraints_none(self) -> bool:
|
||||
"""
|
||||
Returns True if all structured-output constraint fields are None.
|
||||
"""
|
||||
return all(
|
||||
getattr(self, field) is None
|
||||
for field in (
|
||||
"json",
|
||||
"regex",
|
||||
"choice",
|
||||
"grammar",
|
||||
"json_object",
|
||||
"structural_tag",
|
||||
)
|
||||
)
|
||||
|
||||
def all_non_structural_tag_constraints_none(self) -> bool:
|
||||
"""
|
||||
Returns True if all structured-output constraint fields are None.
|
||||
"""
|
||||
return all(
|
||||
getattr(self, field) is None
|
||||
for field in (
|
||||
"json",
|
||||
"regex",
|
||||
"choice",
|
||||
"grammar",
|
||||
"json_object",
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
@dataclass
|
||||
class GuidedDecodingParams(StructuredOutputsParams):
|
||||
|
||||
Reference in New Issue
Block a user