Skip to content

Commit c90a17d

Browse files
committed
Revert "model : gpt-oss add response_format support (ggml-org#15494)"
This reverts commit 32732f2.
1 parent df59a57 commit c90a17d

File tree

1 file changed

+1
-21
lines changed

1 file changed

+1
-21
lines changed

common/chat.cpp

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1361,26 +1361,6 @@ static common_chat_params common_chat_params_init_gpt_oss(const common_chat_temp
13611361
"<|end|>",
13621362
};
13631363

1364-
if (!inputs.json_schema.is_null()) {
1365-
data.grammar_lazy = false;
1366-
data.grammar = build_grammar([&](const common_grammar_builder & builder) {
1367-
auto schema = inputs.json_schema;
1368-
builder.resolve_refs(schema);
1369-
1370-
auto not_end = builder.add_rule("not-end",
1371-
"[^<] | \"<\" [^|] | \"<|\" [^e] | \"<|e\" [^n] | \"<|en\" [^d] | \"<|end\" [^|] | \"<|end|\" [^>]");
1372-
auto analysis = builder.add_rule("analysis",
1373-
"\"<|channel|>analysis<|message|>\" ( " + not_end + " )* \"<|end|>\"");
1374-
auto constraint = builder.add_rule("constraint", "\"<|constrain|>\"? [a-zA-Z0-9_-]+");
1375-
auto final = builder.add_rule("final",
1376-
"\"<|channel|>final\" ( \" \" " + constraint + " )? \"<|message|>\" " +
1377-
builder.add_schema("response", schema)
1378-
);
1379-
1380-
builder.add_rule("root", "( " + analysis + " \"<|start|>assistant\" )? " + final);
1381-
});
1382-
}
1383-
13841364
if (inputs.tools.is_array() && !inputs.tools.empty()) {
13851365
data.grammar_lazy = inputs.tool_choice != COMMON_CHAT_TOOL_CHOICE_REQUIRED;
13861366
data.grammar = build_grammar([&](const common_grammar_builder & builder) {
@@ -2141,7 +2121,7 @@ static common_chat_params common_chat_templates_apply_jinja(
21412121
}
21422122

21432123
// GPT-OSS
2144-
if (src.find("<|channel|>") != std::string::npos) {
2124+
if (src.find("<|channel|>") != std::string::npos && params.json_schema.is_null()) {
21452125
return common_chat_params_init_gpt_oss(tmpl, params);
21462126
}
21472127

0 commit comments

Comments
 (0)