* server: expose the reasoning effort levels of the chat template The capability probe renders a user turn for each candidate level (minimal, low, medium, high, xhigh, max) and for an unknown level. A level is honored when it renders without raising and differently from the unknown level, which shows the template fallback. Levels sharing a render are aliases and the highest one is kept. The caps serialize to JSON, and chat_template_caps in /props reports the list as reasoning_effort_levels, from lowest to highest. * jinja: keep the caps free of the json dependency The caps keep reporting their flags as a map, and the effort levels stay a plain member. common_chat_templates_get_caps() builds the JSON the server reports from both, so jinja depends on json only for the probe inputs.
45 lines
1.2 KiB
C++
45 lines
1.2 KiB
C++
#pragma once
|
|
|
|
#include "runtime.h"
|
|
|
|
#include <string>
|
|
#include <map>
|
|
#include <vector>
|
|
|
|
namespace jinja {
|
|
|
|
struct caps {
|
|
bool supports_tools = true;
|
|
bool supports_tool_calls = true;
|
|
bool supports_system_role = true;
|
|
bool supports_parallel_tool_calls = true;
|
|
|
|
// supports preserve reasoning trace in the full history, not just the last assistant message
|
|
bool supports_preserve_reasoning = false;
|
|
|
|
// supports reasoning effort levels
|
|
bool supports_reasoning_effort = false;
|
|
|
|
// reasoning effort levels the template renders distinctly, from lowest to highest
|
|
std::vector<std::string> reasoning_effort_levels;
|
|
|
|
// one of the 2 content capabilities must be true
|
|
bool supports_string_content = true;
|
|
bool supports_typed_content = false;
|
|
|
|
bool supports_object_arguments = false;
|
|
|
|
// for reporting on server
|
|
std::map<std::string, bool> to_map() const;
|
|
|
|
// for debugging
|
|
std::string to_string() const;
|
|
};
|
|
|
|
caps caps_get(jinja::program & prog);
|
|
|
|
void caps_apply_preserve_reasoning(jinja::context & ctx, bool enabled);
|
|
void caps_apply_reasoning_effort(jinja::context & ctx, const std::string & effort);
|
|
|
|
} // namespace jinja
|