Implementation:Ggml org Llama cpp Jinja Caps Header
| Knowledge Sources | |
|---|---|
| Domains | Template_Engine, Chat |
| Last Updated | 2026-02-15 00:00 GMT |
Overview
Declares the `caps` struct representing detected capabilities of a Jinja chat template.
Description
This header defines the `caps` struct with boolean flags for template capabilities: `supports_tools`, `supports_tool_calls`, `supports_system_role`, `supports_parallel_tool_calls`, `supports_preserve_reasoning`, `supports_string_content`, and `supports_typed_content`. It provides `to_map()` for serialization and `to_string()` for debug output. The `caps_get()` function declaration takes a compiled Jinja program and returns the detected capabilities.
Usage
Include this header when you need to query or represent the capabilities of a chat template. Use it in server code to adapt API behavior based on what the loaded model's template actually supports.
Code Reference
Source Location
- Repository: Ggml_org_Llama_cpp
- File: common/jinja/caps.h
- Lines: 1-30
Signature
namespace jinja {
struct caps {
bool supports_tools = true;
bool supports_tool_calls = true;
bool supports_system_role = true;
bool supports_parallel_tool_calls = true;
bool supports_preserve_reasoning = false;
bool supports_string_content = true;
bool supports_typed_content = false;
std::map<std::string, bool> to_map() const;
std::string to_string() const;
};
caps caps_get(jinja::program & prog);
} // namespace jinja
Import
#include "jinja/caps.h"
I/O Contract
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
| prog | jinja::program & | Yes | Compiled Jinja program to analyze for capabilities |
Outputs
| Name | Type | Description |
|---|---|---|
| caps_get return | caps | Struct containing boolean flags for each detected template capability |
| to_map return | std::map<std::string, bool> | Serializable map of capability name to boolean value |
| to_string return | std::string | Debug-friendly string representation of all capabilities |
Usage Examples
#include "jinja/caps.h"
// After compiling a Jinja template
jinja::caps caps = jinja::caps_get(compiled_program);
// Query individual capabilities
if (caps.supports_tools && caps.supports_tool_calls) {
// Template supports function calling
}
// Get a map for JSON serialization
auto cap_map = caps.to_map();
// {"supports_tools": true, "supports_tool_calls": true, ...}