pass vocab to common_chat_params_init

This commit is contained in:
ochafik 2025-02-03 01:16:02 +00:00
parent d3b60b8ad8
commit 87de852b7f
4 changed files with 11 additions and 10 deletions

View file

@ -582,7 +582,8 @@ static json oaicompat_completion_params_parse(const json & body) {
static json oaicompat_completion_params_parse(
const json & body, /* openai api json semantics */
bool use_jinja,
const common_chat_templates & chat_templates)
const common_chat_templates & chat_templates,
const llama_vocab * vocab)
{
json llama_params;
const auto & tmpl = body.contains("tools") && chat_templates.template_tool_use
@ -648,7 +649,7 @@ static json oaicompat_completion_params_parse(
inputs.stream = stream;
// TODO: support mixing schema w/ tools beyond generic format.
inputs.json_schema = json_value(llama_params, "json_schema", json());
auto chat_params = common_chat_params_init(tmpl, inputs);
auto chat_params = common_chat_params_init(tmpl, inputs, vocab);
llama_params["chat_format"] = static_cast<int>(chat_params.format);
llama_params["prompt"] = chat_params.prompt;