diff options
Diffstat (limited to 'src/Agent.App/Configuration')
| -rw-r--r-- | src/Agent.App/Configuration/AgentConfiguration.cs | 2 | ||||
| -rw-r--r-- | src/Agent.App/Configuration/ConfigurationLoader.cs | 5 |
2 files changed, 6 insertions, 1 deletions
diff --git a/src/Agent.App/Configuration/AgentConfiguration.cs b/src/Agent.App/Configuration/AgentConfiguration.cs index 362b889..c5f720b 100644 --- a/src/Agent.App/Configuration/AgentConfiguration.cs +++ b/src/Agent.App/Configuration/AgentConfiguration.cs @@ -35,7 +35,7 @@ public sealed class OllamaConfiguration { public string Endpoint { get; set; } = "http://127.0.0.1:11434"; public string Model { get; set; } = string.Empty; - public bool Think { get; set; } = true; + public object Think { get; set; } = true; public string KeepAlive { get; set; } = "5m"; public OllamaGenerationOptions Options { get; set; } = new(); public Dictionary<string, object?> ExtraOptions { get; set; } = new(StringComparer.Ordinal); diff --git a/src/Agent.App/Configuration/ConfigurationLoader.cs b/src/Agent.App/Configuration/ConfigurationLoader.cs index efb3db1..26c56e1 100644 --- a/src/Agent.App/Configuration/ConfigurationLoader.cs +++ b/src/Agent.App/Configuration/ConfigurationLoader.cs @@ -53,6 +53,11 @@ public static partial class ConfigurationLoader if (value.Agent.MaxIterations <= 0 || value.Agent.SameFailureLimit <= 0) Throw("agent iteration limits must be positive."); if (!Uri.TryCreate(value.Ollama.Endpoint, UriKind.Absolute, out Uri? endpoint) || endpoint.Scheme is not ("http" or "https")) Throw("ollama.endpoint must be an absolute HTTP(S) URI."); if (string.IsNullOrWhiteSpace(value.Ollama.Model)) Throw("ollama.model is required."); + if (value.Ollama.Think is string booleanText && bool.TryParse(booleanText, out bool booleanThink)) + value.Ollama.Think = booleanThink; + if (value.Ollama.Think is not bool && + (value.Ollama.Think is not string thinkLevel || thinkLevel is not ("low" or "medium" or "high" or "max"))) + Throw("ollama.think must be true, false, low, medium, high, or max."); if (value.Ollama.Options.NumCtx is <= 0) Throw("ollama.options.num_ctx must be positive."); if (value.Ollama.Options.Temperature is < 0 or > 2) Throw("ollama.options.temperature must be in 0..2."); if (value.Planner.MaxTasks is < 1 or > 32) Throw("planner.max_tasks must be in 1..32."); |
