Allow tool use + streaming

This commit is contained in:
Olivier Chafik 2025-01-28 09:22:03 +00:00
parent ef9efc9ed3
commit 62717145f7

View file

@ -586,16 +586,9 @@ static json oaicompat_completion_params_parse(
json llama_params;
auto tools = json_value(body, "tools", json());
auto stream = json_value(body, "stream", false);
if (tools.is_array() && !tools.empty()) {
if (stream) {
throw std::runtime_error("Cannot use tools with stream");
}
if (!use_jinja) {
if (tools.is_array() && !tools.empty() && !use_jinja) {
throw std::runtime_error("tools param requires --jinja flag");
}
}
// Handle "stop" field
if (body.contains("stop") && body.at("stop").is_string()) {