Archived
serve: the model entry carries the capabilities /server_info reports
OpenAI's model object has no field for what a model can be asked for, so a client learned it by sending a request and reading the refusal. The entry it already fetches now carries the same capabilities object /server_info does (tools, reasoning, grammar, media, logprobs, the reasoning efforts the template takes), built by one Server::capabilities() so the two cannot disagree.
This commit is contained in:
1 parent
d5b584a4c1
commit
7c0bd03841
8 files changed
+63
-20
No files matched your search
+25
-19
@@ -309,6 +309,30 @@ HttpResponse Server::handle_tokenizer_info(const HttpRequest& req) {
|
||||
return HttpResponse::json_body(200, json_dump(o));
|
||||
}
|
||||
|
||||
/* ================================================================== capabilities */
|
||||
json Server::capabilities() const {
|
||||
json caps;
|
||||
caps["chat"] = deps_.chat != nullptr;
|
||||
caps["tools"] = deps_.chat && deps_.chat->supports_tools();
|
||||
caps["reasoning"] = deps_.chat && deps_.chat->supports_reasoning();
|
||||
caps["grammar"] = deps_.grammar != nullptr;
|
||||
caps["embedding"] = deps_.embed != nullptr;
|
||||
caps["image"] = deps_.mm && deps_.mm->accepts(MediaKind::Image);
|
||||
caps["video"] = deps_.mm && deps_.mm->accepts(MediaKind::Video);
|
||||
caps["audio"] = deps_.mm && deps_.mm->accepts(MediaKind::Audio);
|
||||
caps["logprobs"] = opt_.supports_logprobs;
|
||||
/* THE EFFORTS A CHAT REQUEST MAY SEND, as probed from the template at startup: null when it
|
||||
* takes any word. "none" and "minimal" are this server's, and turn thinking off. */
|
||||
if (lim_.reasoning_efforts.empty()) {
|
||||
caps["reasoning_efforts"] = nullptr;
|
||||
} else {
|
||||
std::vector<std::string> e = { "none", "minimal" };
|
||||
e.insert(e.end(), lim_.reasoning_efforts.begin(), lim_.reasoning_efforts.end());
|
||||
caps["reasoning_efforts"] = e;
|
||||
}
|
||||
return caps;
|
||||
}
|
||||
|
||||
/* ================================================================== /server_info */
|
||||
/* vLLM returns the repr() of its config object, which is a Python string a client can only print.
|
||||
* This returns the same information as JSON, in two halves: what the SERVER decided, which is
|
||||
@@ -335,25 +359,7 @@ HttpResponse Server::handle_server_info(const HttpRequest&) {
|
||||
srv["uptime_s"] = unix_now() - started_at_;
|
||||
srv["in_flight"] = in_flight_.load(std::memory_order_relaxed);
|
||||
|
||||
json caps;
|
||||
caps["chat"] = deps_.chat != nullptr;
|
||||
caps["tools"] = deps_.chat && deps_.chat->supports_tools();
|
||||
caps["reasoning"] = deps_.chat && deps_.chat->supports_reasoning();
|
||||
caps["grammar"] = deps_.grammar != nullptr;
|
||||
caps["embedding"] = deps_.embed != nullptr;
|
||||
caps["image"] = deps_.mm && deps_.mm->accepts(MediaKind::Image);
|
||||
caps["video"] = deps_.mm && deps_.mm->accepts(MediaKind::Video);
|
||||
caps["audio"] = deps_.mm && deps_.mm->accepts(MediaKind::Audio);
|
||||
caps["logprobs"] = opt_.supports_logprobs;
|
||||
/* THE EFFORTS A CHAT REQUEST MAY SEND, as probed from the template at startup: null when it
|
||||
* takes any word. "none" and "minimal" are this server's, and turn thinking off. */
|
||||
if (lim_.reasoning_efforts.empty()) {
|
||||
caps["reasoning_efforts"] = nullptr;
|
||||
} else {
|
||||
std::vector<std::string> e = { "none", "minimal" };
|
||||
e.insert(e.end(), lim_.reasoning_efforts.begin(), lim_.reasoning_efforts.end());
|
||||
caps["reasoning_efforts"] = e;
|
||||
}
|
||||
json caps = capabilities();
|
||||
|
||||
/* WHAT A REQUEST THAT LEAVES A FIELD OUT GETS, under the request's own spelling of each
|
||||
* field, so a client can read off exactly what leaving one out means on this deployment. */
|
||||
|
||||
Reference in new issue
Block a user