|
ember.cpp 0.1.0
C++ inference engine for Llama-family and paperkiln models (CPU, CUDA, WebAssembly)
|
Namespaces | |
| namespace | detail |
Classes | |
| struct | Error |
| struct | Message |
| struct | ParsedReply |
| struct | Piece |
| struct | Resolution |
| struct | Template |
| struct | ToolCall |
Typedefs | |
| using | json = nlohmann::ordered_json |
Functions | |
| Template | v1 () |
| Template | v2 () |
| Template | legacy_word () |
| Template | chatml (const std::string &name, bool qwen25) |
| Template | gemma3 () |
| std::vector< Template > | registry () |
| Template | get (const std::string &id) |
| template<class J > | |
| std::vector< Message > | messages_from_json (const J &a) |
| std::vector< Message > | from_pairs (const std::vector< std::pair< std::string, std::string > > &turns, const std::string *user=nullptr, const std::string *system=nullptr) |
| size_t | check_structure (const std::vector< Message > &m, bool prompt, bool tools_ok=false) |
| bool | py_space (uint32_t c) |
| std::string | strip_py_ws (const std::string &s) |
| std::string | tool_json (const json &d) |
| std::vector< Piece > | render_pieces (const std::vector< Message > &m, const Template &t, bool generation_prompt, int thinking=-1, const std::vector< json > &tools={}) |
| std::string | render (const std::vector< Message > &m, const Template &t, bool generation_prompt, int thinking=-1, const std::vector< json > &tools={}) |
| std::vector< std::pair< size_t, size_t > > | exchanges (const std::vector< Message > &m) |
| template<class Decode > | |
| ParsedReply | parse_reply (const std::vector< int > &ids, int call_id, Decode decode) |
| void | check_control_tokens (const Template &t, const std::vector< std::string > &tokens, const std::vector< int32_t > &types) |
| std::string | jinja (const Template &t) |
| std::string | modelfile (const std::string &gguf_name, const Template &t) |
| Resolution | resolve (const std::string &declared, const std::vector< std::string > &tokens, const std::string &model, const std::string &chat_template, const std::string &arch) |
Variables | |
| constexpr const char * | kSystemModeV1 = "fold" |
| constexpr const char * | kDefaultSftTurns = "all" |
| constexpr const char * | kGGUFKey = "paperkiln.chat_template" |
| constexpr const char * | kV1 = "paperkiln/1" |
| constexpr const char * | kLegacyWord = "paperkiln/legacy-word" |
| constexpr const char * | kV2 = "paperkiln/2" |
| const std::array< const char *, 4 > | kV1Specials = {"<unk>", "<|endoftext|>", "<|user|>", "<|assistant|>"} |
| const std::array< const char *, 8 > | kV2Control |
| using microtorch::chat::json = typedef nlohmann::ordered_json |
Definition at line 71 of file chat_template.h.
Definition at line 286 of file chat_template.h.
References j, microtorch::chat::Template::name, and name.
Referenced by registry().
|
inline |
Definition at line 720 of file chat_template.h.
References check_control_tokens(), and j.
Referenced by check_control_tokens(), and ember::make_chat_setup().
|
inline |
Definition at line 443 of file chat_template.h.
|
inline |
Definition at line 673 of file chat_template.h.
References exchanges(), j, and out.
Referenced by ember::build_general_prompt(), exchanges(), and main().
|
inline |
Definition at line 429 of file chat_template.h.
References j.
Referenced by main(), and ember::ChatFormat::prompt().
|
inline |
Definition at line 316 of file chat_template.h.
References j, and microtorch::chat::Template::name.
Referenced by registry().
Definition at line 341 of file chat_template.h.
References microtorch::chat::Template::id(), id, j, and registry().
Definition at line 817 of file chat_template.h.
Referenced by jinja().
|
inline |
Definition at line 270 of file chat_template.h.
References j, kSystemModeV1, and microtorch::chat::Template::name.
Referenced by registry(), and resolve().
Definition at line 371 of file chat_template.h.
References a, c, j, k, out, and microtorch::chat::Message::role.
Referenced by ember::detail::tool_turn_message().
|
inline |
Definition at line 847 of file chat_template.h.
References j, and modelfile().
Referenced by modelfile().
| ParsedReply microtorch::chat::parse_reply | ( | const std::vector< int > & | ids, |
| int | call_id, | ||
| Decode | decode | ||
| ) |
Definition at line 695 of file chat_template.h.
References c, microtorch::chat::ParsedReply::content, microtorch::chat::ToolCall::has_id, j, k, parse_reply(), and text.
Referenced by parse_reply(), and ember::reply_of().
|
inline |
Definition at line 337 of file chat_template.h.
References chatml(), gemma3(), legacy_word(), v1(), and v2().
|
inline |
Definition at line 663 of file chat_template.h.
References render().
Referenced by ember::build_general_prompt(), main(), ember::ChatFormat::prompt(), and render().
|
inline |
Definition at line 578 of file chat_template.h.
Referenced by ember::build_general_prompt().
|
inline |
Definition at line 928 of file chat_template.h.
References a, microtorch::chat::Resolution::chat, j, kV1Specials, legacy_word(), registry(), resolve(), tok, and v1().
Referenced by ember::make_chat_setup(), and resolve().
|
inline |
Definition at line 510 of file chat_template.h.
References c, j, k, n, and py_space().
Definition at line 570 of file chat_template.h.
References microtorch::chat::detail::dump_py().
|
inline |
Definition at line 232 of file chat_template.h.
References j, kSystemModeV1, and microtorch::chat::Template::name.
Referenced by registry(), resolve(), ember::ChatFormat::v1_markers(), and v2().
|
inline |
Definition at line 249 of file chat_template.h.
References c, j, kV2Control, and v1().
Referenced by registry().
Definition at line 74 of file chat_template.h.
Definition at line 75 of file chat_template.h.
Definition at line 77 of file chat_template.h.
Definition at line 73 of file chat_template.h.
Referenced by legacy_word(), and v1().
Definition at line 76 of file chat_template.h.
|
inline |
Definition at line 79 of file chat_template.h.
Referenced by ember::has_chat_specials(), and resolve().
Definition at line 78 of file chat_template.h.
Definition at line 82 of file chat_template.h.
Referenced by v2().