13#include <nlohmann/json.hpp>
23namespace entropic::config {
100 if (!node.has_child(
"speculative")) {
return; }
101 auto spec = node[
"speculative"];
119 ryml::ConstNodeRef node,
123 std::string path_str;
124 if (
extract(node,
"path", path_str)) {
132 const bool hf =
extract(node,
"family", family);
133 const bool hs =
extract(node,
"size", size);
134 const bool hq =
extract(node,
"quant", quant);
135 if (!hf && !hs && !hq) {
return ""; }
139 if (!(hf && hs && hq)) {
140 err =
"model selector requires all of family/size/quant "
142 }
else if (
const std::string key = registry.
find_by(family, size, quant);
144 err =
"no bundled model matches family=" + family
145 +
" size=" + size +
" quant=" + quant;
162 ryml::ConstNodeRef node,
167 if (!err.empty()) {
return err; }
181 std::string mmproj_str;
182 if (
extract(node,
"mmproj", mmproj_str)) {
205 ryml::ConstNodeRef node,
223 std::string grammar_str;
224 if (
extract(node,
"grammar", grammar_str)) {
232 && config.
grammar.has_value()) {
233 return "speculative.mtp=true is incompatible with a static grammar "
234 "on this tier (MTP does not enforce GBNF constraints); "
235 "remove speculative.mtp or the grammar for this tier";
238 std::string auto_chain_str;
239 if (
extract(node,
"auto_chain", auto_chain_str)) {
243 bool routable_val =
false;
244 if (
extract(node,
"routable", routable_val)) {
269 ryml::ConstNodeRef node,
275 if (node.has_child(
"router")) {
280 return "models.router: " + err;
284 for (
auto child : node) {
285 std::string key =
to_string(child.key());
286 if (key ==
"default" || key ==
"router") {
289 if (!child.is_map()) {
294 if (config.
tiers.count(key) > 0) {
295 tier = config.
tiers[key];
299 return "models." + key +
": " + err;
301 config.
tiers[key] = std::move(tier);
316 ryml::ConstNodeRef node,
322 std::string class_prompt;
323 if (
extract(node,
"classification_prompt", class_prompt)) {
342 ryml::ConstNodeRef node,
352 extract(node,
"warning_threshold_percent",
366 ryml::ConstNodeRef node,
384 ryml::ConstNodeRef node,
394 if (
extract(node,
"max_read_bytes", max_read)) {
410 ryml::ConstNodeRef node,
416 if (node.is_map() && node.has_child(
"socket_path")
417 && !node[
"socket_path"].val_is_null()) {
418 std::filesystem::path tmp;
435 ryml::ConstNodeRef node,
447 if (node.has_child(
"filesystem")) {
450 if (node.has_child(
"external")) {
466 ryml::ConstNodeRef node,
487 ryml::ConstNodeRef node,
505 ryml::ConstNodeRef node,
511 int max_bytes_int = 0;
512 if (
extract(node,
"max_bytes", max_bytes_int)) {
513 config.
max_bytes =
static_cast<size_t>(max_bytes_int);
527 ryml::ConstNodeRef node,
558 ryml::ConstNodeRef node,
569 if (node.has_child(
"draft")) {
571 node[
"draft"], registry, config.
draft);
573 s_log->warn(
"inference.speculative.draft parse: {}", err);
595 ryml::ConstNodeRef root,
599 if (!root.has_child(
"inference")) {
return; }
600 auto inf = root[
"inference"];
601 if (inf.has_child(
"prompt_cache"))
603 if (inf.has_child(
"speculative"))
617 ryml::ConstNodeRef root,
621 if (root.has_child(
"generation"))
623 if (root.has_child(
"permissions"))
625 if (root.has_child(
"mcp"))
627 if (root.has_child(
"compaction"))
629 if (root.has_child(
"lsp"))
632 if (root.has_child(
"constitutional_validation"))
634 root[
"constitutional_validation"],
671 ryml::ConstNodeRef root,
689 ryml::ConstNodeRef root,
694 if (root.has_child(
"models")) {
697 if (err.empty() && root.has_child(
"routing")) {
721 const std::filesystem::path& path,
726 if (content.empty()) {
727 return "cannot read config file: " + path.string();
730 ryml::Tree tree = ryml::parse_in_arena(
731 ryml::to_csubstr(path.string()),
732 ryml::to_csubstr(content));
733 ryml::ConstNodeRef root = tree.rootref();
734 if (!root.is_map()) {
735 return "config file root is not a YAML mapping: " + path.string();
751 const std::filesystem::path& global_path,
756 auto bundled = data_dir /
"default_config.yaml";
757 if (!std::filesystem::exists(bundled)) {
758 s_log->warn(
"No config found (checked global, project, bundled)");
761 s_log->info(
"No user config — loading bundled default: {}",
764 if (!err.empty()) {
return "bundled default: " + err; }
767 if (!std::filesystem::exists(global_path)) {
768 auto parent = global_path.parent_path();
769 std::filesystem::create_directories(parent);
770 std::filesystem::copy_file(bundled, global_path);
771 s_log->info(
"Created {}", global_path.string());
787 const std::filesystem::path& global_path,
788 const std::filesystem::path& project_path,
792 bool have_config =
false;
795 if (std::filesystem::exists(global_path)) {
796 s_log->info(
"Loading global config: {}", global_path.string());
798 if (!err.empty()) {
return "global config: " + err; }
802 if (err.empty() && std::filesystem::exists(project_path)) {
803 s_log->info(
"Loading project config: {}", project_path.string());
805 if (!err.empty()) {
return "project config: " + err; }
809 return have_config ?
""
824 const std::filesystem::path& global_path,
825 const std::filesystem::path& project_path,
830 if (!err.empty()) {
return err; }
834 std::vector<std::string> warnings;
836 for (
const auto& w : warnings) { s_log->warn(
"{}", w); }
850 const std::filesystem::path& path,
861 std::vector<std::string> warnings;
863 for (
const auto& w : warnings) {
864 s_log->warn(
"{}", w);
878 const std::string& name,
879 const nlohmann::json& entry) {
881 std::string type = entry.value(
"type", std::string(
"stdio"));
883 result.
url = entry.value(
"url", std::string{});
885 result.
command = entry.value(
"command", std::string{});
886 if (entry.contains(
"args") && entry[
"args"].is_array()) {
887 for (
const auto& a : entry[
"args"]) {
888 result.
args.push_back(a.get<std::string>());
891 if (entry.contains(
"env") && entry[
"env"].is_object()) {
892 for (
auto it = entry[
"env"].begin();
893 it != entry[
"env"].end(); ++it) {
894 result.
env[it.key()] = it.value().get<std::string>();
898 s_log->info(
"Discovered external MCP server: {} (type={})",
926 const std::filesystem::path& path) {
927 std::ifstream f(path);
930 std::stringstream ss;
932 j = nlohmann::json::parse(ss.str(),
nullptr,
false);
934 bool valid = f.is_open() && !j.is_discarded() && j.is_object()
935 && j.contains(
"mcpServers")
936 && j[
"mcpServers"].is_object();
938 s_log->warn(
".mcp.json missing/malformed: {}", path.string());
941 return j[
"mcpServers"];
950 const std::filesystem::path& project_dir,
952 if (project_dir.empty()) {
return; }
953 auto path = project_dir /
".mcp.json";
954 if (!std::filesystem::exists(path)) {
return; }
956 if (!servers) {
return; }
959 for (
auto it = servers->begin(); it != servers->end(); ++it) {
960 const std::string& name = it.key();
962 s_log->info(
".mcp.json: {} already in config, skipping", name);
969 s_log->info(
"Loaded {} external MCP server(s) from {}",
970 added, path.string());
982 const char* home = getenv(
"HOME");
985 auto path = std::filesystem::path(home) /
".entropic" /
"config.yaml";
986 if (std::filesystem::exists(path)) {
987 s_log->info(
"Loading global config: {}", path.string());
990 err =
"global config: " + err;
1016 const std::filesystem::path& consumer_defaults)
1019 if (consumer_defaults.empty()
1020 || consumer_defaults.is_absolute()
1021 || std::filesystem::exists(consumer_defaults)) {
1022 return consumer_defaults;
1027 std::filesystem::path result = consumer_defaults;
1030 && info.dli_fname !=
nullptr) {
1032 auto lib_path = std::filesystem::absolute(info.dli_fname, ec);
1034 auto candidate = lib_path.parent_path().parent_path()
1035 /
"share" /
"entropic" / consumer_defaults.filename();
1036 if (std::filesystem::exists(candidate)) {
1060 if (content.empty()) {
return false; }
1061 auto tree = ryml::parse_in_arena(
1062 ryml::to_csubstr(path.string()),
1063 ryml::to_csubstr(content));
1064 auto root = tree.rootref();
1065 return root.is_map() && root.has_child(ryml::to_csubstr(key));
1083 const std::filesystem::path& consumer_defaults_in,
1087 if (consumer_defaults.empty() || !std::filesystem::exists(consumer_defaults)) {
1090 s_log->info(
"Loading consumer defaults: {}", consumer_defaults.string());
1095 s_log->info(
"Consumer defines models: — replacing global tiers");
1106 s_log->warn(
"Consumer defaults failed: {}", err);
1128 const std::filesystem::path& project_dir,
1132 if (!project_dir.empty()) {
1133 auto path = project_dir /
"config.local.yaml";
1134 if (std::filesystem::exists(path)) {
1135 s_log->info(
"Loading project config: {}", path.string());
1137 s_log->info(
"Project defines models: — replacing prior tiers");
1147 err =
"project config: " + err;
1181 const std::filesystem::path& project_dir,
1182 const std::filesystem::path& consumer_defaults,
1189 if (!project_dir.empty() && config.
log_dir.empty()) {
1218 const std::string& content,
1222 if (content.empty()) {
1223 return "config string is empty";
1226 ryml::Tree tree = ryml::parse_in_arena(
1227 ryml::to_csubstr(
"<json>"),
1228 ryml::to_csubstr(content));
1229 auto root = tree.rootref();
1230 if (!root.is_map()) {
1231 return "config string root is not a mapping";
1235 if (root.has_child(
"models")) {
1238 if (err.empty() && root.has_child(
"routing")) {
1257 const std::string& content,
1268 std::vector<std::string> warnings;
1270 for (
const auto& w : warnings) {
1271 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).
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)
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)
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.
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< 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.
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.