char-fork/llama.cpp
git clone https://git.t4t.associates/char-fork/llama.cpp
acecd5603
char/aliceai-t5-moe
1#pragma once 2 3#include "chat.h" 4#include "chat-auto-parser.h" 5#include "chat-auto-parser-helpers.h" 6#include "chat-peg-parser.h" 7#include "common.h" 8#include "ggml.h" 9#include "json-schema-to-grammar.h" 10#include "json.h" 11 12#include <functional> 13#include <optional> 14#include <set> 15#include <string> 16#include <vector> 17 18using json = common_json ; 19 20// iterate over the function tools of an OpenAI-style tools array 21void foreach_function (const json & tools ,const std ::function < void (const json & )> & fn ); 22 23// iterate over the parameters of a function tool, with the document that owns them 24void foreach_parameter (const json & function ,const std ::function < void (const common_chat_schema_property & ,const common_chat_schema_document_ptr & )> & fn ); 25 26// render a template; the override arguments let a parser feed in messages, tools or context it has rewritten 27std ::string common_chat_template_direct_apply_impl ( 28const common_chat_template & tmpl , 29const autoparser ::generation_params & inputs , 30const std ::optional < json > & messages_override = std ::nullopt , 31const std ::optional < json > & tools_override = std ::nullopt , 32const std ::optional < json > & additional_context = std ::nullopt ); 33 34// the suffix a template appends when add_generation_prompt is set 35std ::string common_chat_template_generation_prompt_impl ( 36const common_chat_template & tmpl , 37const autoparser ::generation_params & inputs , 38const std ::optional < json > & messages_override = std ::nullopt , 39const std ::optional < json > & tools_override = std ::nullopt , 40const std ::optional < json > & additional_context = std ::nullopt ); 41 42bool is_lfm2_template (const std ::string & src ); 43 44namespace workaround { 45 46void convert_tool_responses_gemma4 (json & messages ); 47 48} 49 50common_chat_params common_chat_params_init_cohere2moe (const common_chat_template & tmpl ,const autoparser ::generation_params & inputs ); 51 52common_chat_params common_chat_params_init_deepseek_v3_2 (const common_chat_template & tmpl ,const autoparser ::generation_params & inputs ); 53 54common_chat_params common_chat_params_init_functionary_v3_2 (const common_chat_template & tmpl ,const autoparser ::generation_params & inputs ); 55 56common_chat_params common_chat_params_init_gemma4 (const common_chat_template & tmpl ,const autoparser ::generation_params & inputs ); 57 58common_chat_params common_chat_params_init_gigachat_v3 (const common_chat_template & tmpl ,const autoparser ::generation_params & inputs ); 59 60common_chat_params common_chat_params_init_gpt_oss (const common_chat_template & tmpl ,const autoparser ::generation_params & inputs ); 61 62common_chat_params common_chat_params_init_kimi_k2 (const common_chat_template & tmpl ,const autoparser ::generation_params & inputs ); 63 64common_chat_params common_chat_params_init_kimi_k3 (const common_chat_template & tmpl ,const autoparser ::generation_params & inputs ); 65 66// tool_list_tokens preserves the LFM2 system tool-list markers; LFM2.5 renders without them 67common_chat_params common_chat_params_init_lfm2 (const common_chat_template & tmpl ,const autoparser ::generation_params & inputs ,bool tool_list_tokens ); 68 69common_chat_params common_chat_params_init_minicpm5 (const common_chat_template & tmpl ,const autoparser ::generation_params & inputs ); 70 71common_chat_params common_chat_params_init_minimax_m3 (const common_chat_template & tmpl ,const autoparser ::generation_params & inputs ); 72 73common_chat_params common_chat_params_init_ministral_3 (const common_chat_template & tmpl ,const autoparser ::generation_params & inputs ); 74 75common_chat_params common_chat_params_init_muse_glimmer (const common_chat_template & tmpl ,const autoparser ::generation_params & inputs ); 76 77common_chat_params common_chat_params_init_qwen3_coder (const common_chat_template & tmpl ,const autoparser ::generation_params & inputs );