13#include <nlohmann/json.hpp>
23namespace entropic::config {
101 if (!node.has_child(
"speculative")) {
return; }
102 auto spec = node[
"speculative"];
121 ryml::ConstNodeRef node,
125 std::string path_str;
126 if (
extract(node,
"path", path_str)) {
134 const bool hf =
extract(node,
"family", family);
135 const bool hs =
extract(node,
"size", size);
136 const bool hq =
extract(node,
"quant", quant);
137 if (!hf && !hs && !hq) {
return ""; }
141 if (!(hf && hs && hq)) {
142 err =
"model selector requires all of family/size/quant "
144 }
else if (
const std::string key = registry.
find_by(family, size, quant);
146 err =
"no bundled model matches family=" + family
147 +
" size=" + size +
" quant=" + quant;
166 ryml::ConstNodeRef node,
171 if (!err.empty()) {
return err; }
185 std::string mmproj_str;
186 if (
extract(node,
"mmproj", mmproj_str)) {
210 ryml::ConstNodeRef node,
228 std::string grammar_str;
229 if (
extract(node,
"grammar", grammar_str)) {
235 bool require_tc =
false;
236 if (
extract(node,
"require_tool_call", require_tc)) {
240 std::string auto_chain_str;
241 if (
extract(node,
"auto_chain", auto_chain_str)) {
245 bool routable_val =
false;
246 if (
extract(node,
"routable", routable_val)) {
272 ryml::ConstNodeRef node,
278 if (node.has_child(
"router")) {
283 return "models.router: " + err;
287 for (
auto child : node) {
288 std::string key =
to_string(child.key());
289 if (key ==
"default" || key ==
"router") {
292 if (!child.is_map()) {
297 if (config.
tiers.count(key) > 0) {
298 tier = config.
tiers[key];
302 return "models." + key +
": " + err;
304 config.
tiers[key] = std::move(tier);
319 ryml::ConstNodeRef node,
325 std::string class_prompt;
326 if (
extract(node,
"classification_prompt", class_prompt)) {
345 ryml::ConstNodeRef node,
355 extract(node,
"warning_threshold_percent",
369 ryml::ConstNodeRef node,
387 ryml::ConstNodeRef node,
397 if (
extract(node,
"max_read_bytes", max_read)) {
413 ryml::ConstNodeRef node,
420 if (node.is_map() && node.has_child(
"socket_path")
421 && !node[
"socket_path"].val_is_null()) {
422 std::filesystem::path tmp;
439 ryml::ConstNodeRef node,
453 std::vector<std::string> plugin_paths;
456 for (
const auto& p : plugin_paths) {
461 if (node.has_child(
"filesystem")) {
464 if (node.has_child(
"external")) {
480 ryml::ConstNodeRef node,
503 ryml::ConstNodeRef node,
521 ryml::ConstNodeRef node,
527 int max_bytes_int = 0;
528 if (
extract(node,
"max_bytes", max_bytes_int)) {
529 config.
max_bytes =
static_cast<size_t>(max_bytes_int);
543 ryml::ConstNodeRef node,
575 ryml::ConstNodeRef node,
586 if (node.has_child(
"draft")) {
588 node[
"draft"], registry, config.
draft);
590 s_log->warn(
"inference.speculative.draft parse: {}", err);
612 ryml::ConstNodeRef root,
616 if (!root.has_child(
"inference")) {
return; }
617 auto inf = root[
"inference"];
618 if (inf.has_child(
"prompt_cache"))
620 if (inf.has_child(
"speculative"))
634 ryml::ConstNodeRef root,
638 if (root.has_child(
"generation"))
640 if (root.has_child(
"permissions"))
642 if (root.has_child(
"mcp"))
644 if (root.has_child(
"compaction"))
646 if (root.has_child(
"lsp"))
649 if (root.has_child(
"constitutional_validation"))
651 root[
"constitutional_validation"],
695 ryml::ConstNodeRef root,
713 ryml::ConstNodeRef root,
718 if (root.has_child(
"models")) {
721 if (err.empty() && root.has_child(
"routing")) {
747 const std::filesystem::path& path,
752 if (content.empty()) {
753 return "cannot read config file: " + path.string();
756 ryml::Tree tree = ryml::parse_in_arena(
757 ryml::to_csubstr(path.string()),
758 ryml::to_csubstr(content));
759 ryml::ConstNodeRef root = tree.rootref();
760 if (!root.is_map()) {
761 return "config file root is not a YAML mapping: " + path.string();
777 const std::filesystem::path& global_path,
782 auto bundled = data_dir /
"default_config.yaml";
783 if (!std::filesystem::exists(bundled)) {
784 s_log->warn(
"No config found (checked global, project, bundled)");
787 s_log->info(
"No user config — loading bundled default: {}",
790 if (!err.empty()) {
return "bundled default: " + err; }
798 if (!global_path.empty() && !std::filesystem::exists(global_path)) {
799 auto parent = global_path.parent_path();
800 std::filesystem::create_directories(parent);
801 std::filesystem::copy_file(bundled, global_path);
802 s_log->info(
"Created {}", global_path.string());
819 const std::filesystem::path& global_path,
820 const std::filesystem::path& project_path,
824 bool have_config =
false;
827 if (std::filesystem::exists(global_path)) {
828 s_log->info(
"Loading global config: {}", global_path.string());
830 if (!err.empty()) {
return "global config: " + err; }
834 if (err.empty() && std::filesystem::exists(project_path)) {
835 s_log->info(
"Loading project config: {}", project_path.string());
837 if (!err.empty()) {
return "project config: " + err; }
841 return have_config ?
""
858 const std::filesystem::path& global_path,
859 const std::filesystem::path& project_path,
864 if (!err.empty()) {
return err; }
868 std::vector<std::string> warnings;
870 for (
const auto& w : warnings) { s_log->warn(
"{}", w); }
885 const std::filesystem::path& path,
896 std::vector<std::string> warnings;
898 for (
const auto& w : warnings) {
899 s_log->warn(
"{}", w);
913 const std::string& name,
914 const nlohmann::json& entry) {
916 std::string type = entry.value(
"type", std::string(
"stdio"));
918 result.
url = entry.value(
"url", std::string{});
920 result.
command = entry.value(
"command", std::string{});
921 if (entry.contains(
"args") && entry[
"args"].is_array()) {
922 for (
const auto& a : entry[
"args"]) {
923 result.
args.push_back(a.get<std::string>());
926 if (entry.contains(
"env") && entry[
"env"].is_object()) {
927 for (
auto it = entry[
"env"].begin();
928 it != entry[
"env"].end(); ++it) {
929 result.
env[it.key()] = it.value().get<std::string>();
933 s_log->info(
"Discovered external MCP server: {} (type={})",
961 const std::filesystem::path& path) {
962 std::ifstream f(path);
965 std::stringstream ss;
967 j = nlohmann::json::parse(ss.str(),
nullptr,
false);
969 bool valid = f.is_open() && !j.is_discarded() && j.is_object()
970 && j.contains(
"mcpServers")
971 && j[
"mcpServers"].is_object();
973 s_log->warn(
".mcp.json missing/malformed: {}", path.string());
976 return j[
"mcpServers"];
985 const std::filesystem::path& project_dir,
987 if (project_dir.empty()) {
return; }
988 auto path = project_dir /
".mcp.json";
989 if (!std::filesystem::exists(path)) {
return; }
991 if (!servers) {
return; }
994 for (
auto it = servers->begin(); it != servers->end(); ++it) {
995 const std::string& name = it.key();
997 s_log->info(
".mcp.json: {} already in config, skipping", name);
1004 s_log->info(
"Loaded {} external MCP server(s) from {}",
1005 added, path.string());
1017 const char* home = getenv(
"HOME");
1020 auto path = std::filesystem::path(home) /
".entropic" /
"config.yaml";
1021 if (std::filesystem::exists(path)) {
1022 s_log->info(
"Loading global config: {}", path.string());
1025 err =
"global config: " + err;
1051 const std::filesystem::path& consumer_defaults)
1054 if (consumer_defaults.empty()
1055 || consumer_defaults.is_absolute()
1056 || std::filesystem::exists(consumer_defaults)) {
1057 return consumer_defaults;
1062 std::filesystem::path result = consumer_defaults;
1065 && info.dli_fname !=
nullptr) {
1067 auto lib_path = std::filesystem::absolute(info.dli_fname, ec);
1069 auto candidate = lib_path.parent_path().parent_path()
1070 /
"share" /
"entropic" / consumer_defaults.filename();
1071 if (std::filesystem::exists(candidate)) {
1095 if (content.empty()) {
return false; }
1096 auto tree = ryml::parse_in_arena(
1097 ryml::to_csubstr(path.string()),
1098 ryml::to_csubstr(content));
1099 auto root = tree.rootref();
1100 return root.is_map() && root.has_child(ryml::to_csubstr(key));
1120 const std::filesystem::path& consumer_defaults_in,
1124 if (consumer_defaults.empty() || !std::filesystem::exists(consumer_defaults)) {
1127 s_log->info(
"Loading consumer defaults: {}", consumer_defaults.string());
1132 s_log->info(
"Consumer defines models: — replacing global tiers");
1143 s_log->warn(
"Consumer defaults failed: {}", err);
1166 const std::filesystem::path& project_dir,
1170 if (!project_dir.empty()) {
1171 auto path = project_dir /
"config.local.yaml";
1172 if (std::filesystem::exists(path)) {
1173 s_log->info(
"Loading project config: {}", path.string());
1175 s_log->info(
"Project defines models: — replacing prior tiers");
1185 err =
"project config: " + err;
1221 const std::filesystem::path& project_dir,
1222 const std::filesystem::path& consumer_defaults,
1229 if (!project_dir.empty() && config.
log_dir.empty()) {
1277 const std::string& content,
1281 if (content.empty()) {
1282 return "config string is empty";
1285 ryml::Tree tree = ryml::parse_in_arena(
1286 ryml::to_csubstr(
"<json>"),
1287 ryml::to_csubstr(content));
1288 auto root = tree.rootref();
1289 if (!root.is_map()) {
1290 return "config string root is not a mapping";
1294 if (root.has_child(
"models")) {
1297 if (err.empty() && root.has_child(
"routing")) {
1317 const std::string& content,
1328 std::vector<std::string> warnings;
1330 for (
const auto& w : warnings) {
1331 s_log->warn(
"{}", w);
Bundled model registry loaded from bundled_models.yaml.
std::filesystem::path resolve(const std::string &value) const
Resolve a model reference to a filesystem path.
std::string find_by(const std::string &family, const std::string &size_label, const std::string &quant) const
Look up a registry key by (family, size, quant) (gh#62).
static void extract_scalar_fields(ryml::ConstNodeRef root, ParsedConfig &config)
Extract the top-level scalar/path config fields.
static std::string parse_config_string(const std::string &content, const BundledModels ®istry, ParsedConfig &config)
Parse a config string (YAML or JSON) and overlay onto config.
static std::string load_project_layer(const std::filesystem::path &project_dir, const BundledModels ®istry, ParsedConfig &config)
Load the project-local layer if present.
static std::string parse_external_mcp_config(ryml::ConstNodeRef node, ExternalMCPConfig &config)
Parse the external MCP section from a YAML node.
static bool yaml_has_key(const std::filesystem::path &path, const char *key)
Load the consumer/app defaults layer if present (non-fatal).
static std::string load_global_layer(const BundledModels ®istry, ParsedConfig &config)
Load the global user config layer if present.
static std::string parse_generation_config(ryml::ConstNodeRef node, GenerationConfig &config)
Parse the generation section from a YAML node.
static std::string parse_permissions_config(ryml::ConstNodeRef node, PermissionsConfig &config)
Parse the permissions section from a YAML node.
static void parse_inference_subsections(ryml::ConstNodeRef root, const BundledModels ®istry, ParsedConfig &config)
Parse the nested optional config sub-sections.
static void load_consumer_layer(const std::filesystem::path &consumer_defaults_in, const BundledModels ®istry, ParsedConfig &config)
Load the consumer-defaults layer.
static std::filesystem::path resolve_consumer_defaults(const std::filesystem::path &consumer_defaults)
Resolve a relative consumer_defaults path against install prefix.
static std::optional< nlohmann::json > read_mcp_servers(const std::filesystem::path &path)
Discover and parse .mcp.json from the project directory.
static void parse_optional_sections(ryml::ConstNodeRef root, const BundledModels ®istry, ParsedConfig &config)
Parse optional config sections that don't return errors.
static void parse_speculative_config(ryml::ConstNodeRef node, const BundledModels ®istry, SpeculativeConfig &config)
Parse inference.speculative YAML node into SpeculativeConfig.
static void parse_constitutional_validation_config(ryml::ConstNodeRef node, ConstitutionalValidationConfig &config)
Parse constitutional_validation section.
static void parse_optional_subsections(ryml::ConstNodeRef root, const BundledModels ®istry, ParsedConfig &config)
Parse the nested optional config sub-sections.
static std::string parse_mcp_config(ryml::ConstNodeRef node, MCPConfig &config)
Parse the MCP section from a YAML node.
static std::string load_bundled_default(const std::filesystem::path &global_path, const BundledModels ®istry, ParsedConfig &config)
Load bundled default config when no user config exists.
static void parse_tier_speculative_override(ryml::ConstNodeRef node, TierConfig &config)
Parse the per-tier speculative.mtp override (gh#108, v2.9.4).
static std::string parse_filesystem_config(ryml::ConstNodeRef node, FilesystemConfig &config)
Parse the filesystem section from a YAML node.
static std::string parse_compaction_config(ryml::ConstNodeRef node, CompactionConfig &config)
Parse the compaction section from a YAML node.
static void discover_mcp_json(const std::filesystem::path &project_dir, ParsedConfig &config)
Discover + merge external MCP servers from <dir>/.mcp.json.
static std::string parse_top_sections(ryml::ConstNodeRef root, const BundledModels ®istry, ParsedConfig &config)
Parse the top-level models/routing/optional sections.
static std::string parse_routing_config(ryml::ConstNodeRef node, RoutingConfig &config)
Parse the routing section from a YAML node.
static void parse_sampler_overrides(ryml::ConstNodeRef node, TierConfig &config)
Read per-tier sampler overrides from a YAML model/tier node.
static void parse_model_runtime_knobs(ryml::ConstNodeRef node, ModelConfig &config)
Read the model-runtime knobs (KV cache, batching, threads).
static std::string parse_prompt_cache_config(ryml::ConstNodeRef node, PromptCacheConfig &config)
Parse prompt_cache config from inference YAML section.
static std::string resolve_model_path(ryml::ConstNodeRef node, const BundledModels ®istry, ModelConfig &config)
Resolve config.path from an explicit path: or a selector (gh#62).
static std::string parse_model_config(ryml::ConstNodeRef node, const BundledModels ®istry, ModelConfig &config)
Parse a ModelConfig from a YAML node.
static ExternalServerEntry parse_mcp_json_entry(const std::string &name, const nlohmann::json &entry)
Parse a single mcpServers entry from .mcp.json.
static std::string load_config_layers(const std::filesystem::path &global_path, const std::filesystem::path &project_path, const BundledModels ®istry, ParsedConfig &config)
Load global, project, and bundled config layers in order.
static std::string parse_tier_config(ryml::ConstNodeRef node, const BundledModels ®istry, TierConfig &config)
Parse a TierConfig from a YAML node.
static std::string parse_models_config(ryml::ConstNodeRef node, const BundledModels ®istry, ModelsConfig &config)
Parse the models section from a YAML node.
static std::string parse_lsp_config(ryml::ConstNodeRef node, LSPConfig &config)
Parse the LSP section from a YAML node.
Config loader — YAML to C++ structs with validation.
ENTROPIC_EXPORT std::string load_config(const std::filesystem::path &global_path, const std::filesystem::path &project_path, const BundledModels ®istry, ParsedConfig &config)
Load config using layered resolution.
ENTROPIC_EXPORT std::string load_config_from_string(const std::string &content, const BundledModels ®istry, ParsedConfig &config)
Load config from a YAML/JSON string (no layering).
ENTROPIC_EXPORT std::filesystem::path resolve_data_dir(const ParsedConfig &config)
Resolve the bundled data directory.
ENTROPIC_EXPORT std::string parse_config_file(const std::filesystem::path &path, const BundledModels ®istry, ParsedConfig &config)
Parse a config YAML file and overlay onto existing config.
ENTROPIC_EXPORT void apply_env_overrides(ParsedConfig &config)
Apply ENTROPIC_* environment variable overrides.
ENTROPIC_EXPORT std::string load_config_from_file(const std::filesystem::path &path, const BundledModels ®istry, ParsedConfig &config)
Load config from a single YAML file (no layering).
ENTROPIC_EXPORT std::string load_layered(const std::filesystem::path &project_dir, const std::filesystem::path &consumer_defaults, const BundledModels ®istry, ParsedConfig &config)
Load config with consumer defaults + global + project layers.
spdlog initialization and logger access.
ENTROPIC_EXPORT std::shared_ptr< spdlog::logger > get(const std::string &name)
Get or create a named logger.
Auto-compaction configuration.
bool save_full_history
Save full history before compaction.
bool notify_user
Notify user on compaction.
float warning_threshold_percent
Warning trigger (0.3–0.9)
int preserve_recent_turns
Turns to preserve (1–10)
int summary_max_tokens
Summary max tokens (500–4000)
int tool_result_ttl
Tool result TTL in turns (>= 1; v2.1.3 #6: gated on fill, no upper bound)
float threshold_percent
Compaction trigger (0.5–0.99)
bool enabled
Enable auto-compaction.
Constitutional validation pipeline configuration.
int max_revisions
Max re-generation attempts (0 = critique only)
int priority
Hook priority (higher = later)
bool enable_thinking
Enable think-blocks for critique (default OFF)
float temperature
Critique generation temperature.
bool enabled
Global enable/disable (default OFF)
int max_critique_tokens
Token budget for critique generation.
std::string grammar_key
Grammar registry key.
std::vector< std::string > skip_tiers
Tiers exempt from validation (default: lead — streams before hook fires)
External MCP server configuration (Entropic-as-server).
bool ask_streaming
Route entropic.ask through entropic_run (false) or entropic_run_streaming (true, default).
std::optional< std::filesystem::path > socket_path
Socket path (nullopt = derived)
int rate_limit
Requests per minute (1–100)
bool enabled
Enable external MCP.
Configuration for a single external MCP server entry.
std::string command
Stdio command (empty for SSE)
std::vector< std::string > args
Stdio command arguments.
std::string url
SSE endpoint URL (empty for stdio)
std::unordered_map< std::string, std::string > env
Stdio environment variables.
Filesystem MCP server configuration.
bool diagnostics_on_edit
Proactive diagnostics on edit/write.
bool allow_outside_root
Allow file ops outside workspace root.
float diagnostics_timeout
Diagnostics timeout (0.1–5.0)
std::optional< int > max_read_bytes
Max file read size (nullopt = derive from context)
float max_read_context_pct
Max context % for single file read.
bool fail_on_errors
Rollback edit if it introduces errors.
Generation parameters configuration (top-level defaults).
int max_tokens
Default max tokens (64–32768)
float default_top_p
Default top_p (0.0–1.0)
int budget_limit
gh#80 (v2.5.0) budget ceiling: generated tokens (budget_mode "tokens") or wall-clock seconds (budget_...
std::string budget_mode
gh#80 (v2.5.0) thinking-budget mode: "off" (default), "tokens", or "wall_clock".
float default_temperature
Default temperature (0.0–2.0)
bool stream_output
gh#110 (v2.9.6) agent-loop token delivery mode: true streams tokens via the per-token callback path,...
SpeculativeConfig speculative
Speculative decoding (gh#36)
LSP integration configuration.
bool python_enabled
Enable Python LSP.
bool enabled
Enable LSP integration.
bool c_enabled
Enable C/C++ LSP.
MCP server configuration.
bool enable_entropic
Enable entropic internal server (handoff, delegate, pipeline)
std::vector< std::filesystem::path > plugins
In-process MCP server plugin .so paths (gh#133, v2.10.1).
FilesystemConfig filesystem
Filesystem server config.
bool enable_filesystem
Enable filesystem server.
std::unordered_map< std::string, ExternalServerEntry > external_servers
Named external servers.
bool enable_git
Enable git server.
bool enable_diagnostics
Enable diagnostics server.
int server_timeout_seconds
Server timeout (5–300)
bool enable_bash
Enable bash server.
ExternalMCPConfig external
External MCP server config (Entropic-as-server)
std::string working_dir
Server working directory (empty = CWD) (v2.0.4)
bool enable_web
Enable web server.
Model configuration for a single tier.
std::filesystem::path mmproj_path
Vision projector GGUF path.
int gpu_layers
GPU offload layers (-1 = all)
int reasoning_budget
Think token budget (-1 = unlimited)
int n_ubatch
Physical micro-batch size for prompt processing (gh#23 MVP item 5).
int context_length
Context window size (512–131072)
std::filesystem::path path
Resolved model file path.
float rope_freq_scale
RoPE frequency scaling factor (gh#23 MVP item 10).
int main_gpu
Primary GPU index for model load (gh#23 MVP item 7).
int n_threads
CPU threads (0 = auto-detect)
bool offload_kqv
Offload KQV ops (incl.
int n_parallel
Max parallel sequences per context (gh#23 MVP item 11).
std::string tensor_split
Multi-GPU tensor split ratios (empty = single GPU)
std::string cache_type_k
KV cache key quantization type.
bool keep_warm
Pre-warm model at startup.
std::string cache_type_v
KV cache value quantization type.
std::string split_mode
Multi-GPU split mode for model load (gh#23 MVP item 6).
int n_batch
Batch size for prompt processing.
bool flash_attn
Enable flash attention.
bool use_mlock
Lock model in system RAM.
std::optional< std::vector< std::string > > allowed_tools
Tool whitelist (nullopt = all)
std::string adapter
Chat adapter name.
float rope_freq_base
RoPE base frequency override (gh#23 MVP item 9).
Configuration for all models (tiers + router).
std::optional< ModelConfig > router
Router model (separate from tiers)
std::unordered_map< std::string, TierConfig > tiers
Tier name → config.
std::string default_tier
Default tier name.
Full parsed configuration.
int vram_reserve_mb
Reserved VRAM headroom (MB, 0–65536)
PermissionsConfig permissions
Tool permissions.
PromptCacheConfig prompt_cache
Prompt KV cache settings.
std::optional< std::filesystem::path > app_context
App context: nullopt = disabled by default.
std::optional< std::string > app_context_content
Inline app_context text, supplied instead of a path (gh#141).
CompactionConfig compaction
Auto-compaction settings.
RoutingConfig routing
Routing rules.
InferenceConfig inference
Inference-side knobs (currently speculative decoding only).
ModelsConfig models
Tiers + router.
LSPConfig lsp
LSP integration.
ConstitutionalValidationConfig constitutional_validation
Constitutional validation pipeline settings.
std::filesystem::path log_dir
Session log directory (session.log + session_model.log).
bool ggml_logging
Enable ggml/llama.cpp logging to llama_ggml.log in log_dir.
GenerationConfig generation
Default generation params.
std::string log_level
Log level string.
MCPConfig mcp
MCP server settings.
bool console_logging
Emit engine spdlog output to the stderr console sink.
bool inject_model_context
Auto-inject model context into system prompt.
std::filesystem::path llama_log_path
Override path for ggml/llama log when ggml_logging == true (gh#23 MVP item 12, v2....
bool app_context_disabled
true if app_context explicitly disabled
std::optional< std::filesystem::path > constitution
Constitution: nullopt = bundled default, disabled = explicit false.
bool constitution_disabled
true if constitution explicitly disabled
std::filesystem::path config_dir
Config dir — base for bundled data discovery.
Tool permission configuration.
std::vector< std::string > deny
Denied tool patterns (glob)
std::vector< std::string > allow
Allowed tool patterns (glob)
bool auto_approve
Skip confirmation prompts.
Prompt caching configuration.
size_t max_bytes
Maximum cache RAM (512 MB default)
bool log_hits
Log cache hit/miss at INFO level.
bool enabled
Master switch (false = no caching)
Configuration for model routing.
std::string fallback_tier
Fallback when routing fails.
std::unordered_map< std::string, std::vector< std::string > > handoff_rules
Tier handoff rules.
bool enabled
Enable routing.
std::optional< std::string > classification_prompt
Custom prompt (nullopt = auto)
std::unordered_map< std::string, std::string > tier_map
Classification → tier mapping.
Speculative-decoding configuration (inference.speculative.
bool enabled
Master switch (off by default)
bool mtp
gh#106 (v2.9.0): drive MTP (the draft is a trunk-sharing head via ctx_other) instead of the gh#36 sep...
int n_draft
Window size (proposed tokens).
ModelConfig draft
Full ModelConfig for the draft model.
Tier-specific model configuration.
std::optional< float > frequency_penalty
gh#85
std::optional< bool > routable
None = defer to identity frontmatter.
std::optional< std::filesystem::path > identity
Identity prompt path (nullopt = bundled)
std::optional< float > temperature
Per-tier sampler temperature from identity frontmatter (gh#82).
std::optional< float > top_p
Per-tier sampler knobs from identity frontmatter (gh#85).
std::optional< float > repeat_penalty
Per-tier repeat_penalty + enable_thinking from identity frontmatter (gh#86).
std::optional< std::string > auto_chain
Target tier name (nullopt = defer to identity)
bool identity_disabled
true if identity explicitly disabled
std::optional< float > min_p
gh#85
std::optional< bool > require_tool_call
gh#134 (v2.10.4): require this tier to end every turn with a tool call.
std::optional< std::string > tool_call_mode
Per-tier tool-call generation mode (gh#103).
std::optional< float > presence_penalty
gh#85
std::optional< int > max_output_tokens
Per-tier max output tokens from identity frontmatter (gh#82).
std::optional< int > top_k
gh#85
std::optional< bool > enable_thinking
gh#86
std::vector< std::string > capabilities
Declared tier capabilities (gh#41).
std::optional< std::filesystem::path > grammar
Grammar file path.
std::optional< bool > speculative_mtp
Per-tier MTP speculative-decode override (gh#108).
Config validation functions.
ENTROPIC_EXPORT std::string validate_config(const ParsedConfig &config, std::vector< std::string > &warnings)
Validate the full ParsedConfig.
std::filesystem::path expand_home(const std::filesystem::path &p)
Expand ~ to home directory in a path.
bool extract_string_list_map(ryml::ConstNodeRef node, c4::csubstr key, std::unordered_map< std::string, std::vector< std::string > > &out)
Extract a map of string to list of strings from a YAML mapping.
bool extract_inline_content(ryml::ConstNodeRef node, c4::csubstr key, std::optional< std::string > &out)
Extract inline text from an object-form value (gh#141).
std::string read_file(const std::filesystem::path &path)
Read a file into a string.
bool extract_path(ryml::ConstNodeRef node, c4::csubstr key, std::filesystem::path &out)
Extract a filesystem path with ~ expansion.
bool extract_string_list(ryml::ConstNodeRef node, c4::csubstr key, std::vector< std::string > &out)
Extract a vector of strings from a YAML sequence node.
bool extract_string_map(ryml::ConstNodeRef node, c4::csubstr key, std::unordered_map< std::string, std::string > &out)
Extract a map of string to string from a YAML mapping node.
bool extract_string_list_opt(ryml::ConstNodeRef node, c4::csubstr key, std::optional< std::vector< std::string > > &out)
Extract an optional vector of strings.
bool extract_tri_state_path(ryml::ConstNodeRef node, c4::csubstr key, std::optional< std::filesystem::path > &out, bool &disabled)
Extract a tri-state path (null = default, false = disabled, string = path).
std::string to_string(c4::csubstr s)
Convert ryml csubstr to std::string.
bool extract(ryml::ConstNodeRef node, c4::csubstr key, std::string &out)
Extract a string value from a YAML node.
ryml extraction helpers for config parsing.