@@ -279,18 +279,17 @@ static common_chat_params common_chat_params_init_generic(const common_chat_temp
279279 /*
280280 This kind of turns any model into a thinking model by requiring the output to be (in TypeScript notation):
281281
282- // ResponseSchema is json_schema if set, otherwisestring
282+ // ResponseSchema is json_schema if set, otherwise string
283283
284- Schema = ( {thoughts: string} & ToolCallSchema) | {thoughts: string, response: ResponseSchema}
285- SchemaToolRequired = {thoughts: string} & ToolCallSchema
284+ type SchemaToolRequired = {thoughts: string} & ToolCallSchema
285+ type Schema = ( {thoughts: string} & ToolCallSchema) | {thoughts: string, response: ResponseSchema}
286286
287+ type ToolCallSchema = SingleToolCallSchema | ParallelToolCallSchema
288+ type SingleToolCallSchema = {tool_call: ToolCall}
289+ type ParallelToolCallSchema = {tool_calls: ToolCall[]} // If parallel_tool_calls is true
287290
288- ToolCallSchema = SingleToolCallSchema | ParallelToolCallSchema
289- SingleToolCallSchema = {tool_call: ToolCall}
290- ParallelToolCallSchema = {tool_calls: ToolCall[]} // If parallel_tool_calls is true
291-
292- ToolCall = {name: string, arguments: ParametersSchema, id?: string} // id only if parallel_tool_calls is true
293- ParametersSchema = tool1_params | tool2_params | ...
291+ type ToolCall = {name: string, arguments: ParametersSchema, id?: string} // id only if parallel_tool_calls is true
292+ type ParametersSchema = tool1_params | tool2_params | ...
294293 */
295294
296295 // TODO(ochafik): make the prompts configurable (jinja template?).
@@ -1041,7 +1040,7 @@ common_chat_params common_chat_params_init(const common_chat_template & tmpl, co
10411040
10421041 // Use generic handler when forcing thoughts or JSON schema for final output
10431042 // TODO: support thinking mode and/or JSON schema in handlers below this.
1044- if (inputs.think || !inputs.tools .is_null () && inputs.json_schema .is_object ()) {
1043+ if (inputs.think || ( !inputs.tools .is_null () && inputs.json_schema .is_object () )) {
10451044 return common_chat_params_init_generic (tmpl, inputs);
10461045 }
10471046
0 commit comments