Skip to content

LLM inference in C/C++

C++ ggml

server: accept OpenAI video_url content type and data: video URIs (#27921)

calebrio02057494f93f85
diff --git a/tools/server/server-common.cpp b/tools/server/server-common.cpp
index 7bf1138c8a..2ff790a5de 100644
--- a/tools/server/server-common.cpp
+++ b/tools/server/server-common.cpp
@@ -1263,12 +1263,13 @@ json oaicompat_chat_params_parse(
p["text"] = get_media_marker();
p.erase("input_audio");
- } else if (type == "input_video") {
+ } else if (type == "input_video" || type == "video_url") {
if (!opt.allow_video) {
throw std::runtime_error("video input is not supported - hint: if this is unexpected, you may need to provide the mmproj");
}
- json input_video = json_value(p, "input_video", json::object());
+ // accept the OpenAI-style "video_url" key as an alias of "input_video"
+ json input_video = json_value(p, type, json::object());
std::string url = json_value(input_video, "data",
json_value(input_video, "url", std::string()));
handle_media(out_files, url, opt.media_path);
@@ -1276,6 +1277,7 @@ json oaicompat_chat_params_parse(
p["type"] = "media_marker";
p["text"] = get_media_marker();
p.erase("input_video");
+ p.erase("video_url");
} else if (type != "text") {
throw std::invalid_argument("unsupported content[].type");