YamlConfigLoader
Helpers & Utilities · AiDotNet.Configuration
Loads and deserializes YAML configuration files into strongly-typed configuration objects.
For Beginners
This class reads a YAML file from disk (or a YAML string)
and converts it into a structured C# object that the builder or trainer can use. YAML uses
camelCase property names (e.g., timeSeriesModel, gpuAcceleration).
How It Works
Every document passes through YamlVariableResolver first, so ${NAME} anywhere in the file is
replaced by the environment variable of that name and ${NAME:-fallback} supplies a default. That is what
keeps an API key or a machine-specific path out of a file you want to commit; a reference with neither a value nor
a fallback fails immediately and names the variable.
Example usage:
Methods
| Method | Summary |
|---|---|
TConfig LoadFromFile(string filePath) |
Loads a YAML configuration file from disk and deserializes it into the specified type. |
TConfig LoadFromString(string yamlContent) |
Deserializes a YAML string into the specified type. |
YamlModelConfig LoadFromFile(string filePath) |
Loads a YAML configuration file from disk and deserializes it into the specified type. |
YamlModelConfig LoadFromString(string yamlContent) |
Deserializes a YAML string into the specified type. |
string SaveToString(TConfig config) |
Writes a configuration object as YAML that LoadFromString reads back unchanged. |