diff options
| author | T <t@tjp.lol> | 2026-05-25 13:24:02 -0700 |
|---|---|---|
| committer | T <t@tjp.lol> | 2026-05-25 15:27:11 -0700 |
| commit | df2edee86eec2a8deb0ad57b5d20552199c12b65 (patch) | |
| tree | c1e962e9b0bdf25572929e3efedc3b1915be853f /libpanto/src/config.zig | |
| parent | e8272efd9f71ad27a0e62b6b3fa3d13e99a6736f (diff) | |
phase 1 done
Diffstat (limited to 'libpanto/src/config.zig')
| -rw-r--r-- | libpanto/src/config.zig | 46 |
1 files changed, 37 insertions, 9 deletions
diff --git a/libpanto/src/config.zig b/libpanto/src/config.zig index 295f2c6..74bdcc7 100644 --- a/libpanto/src/config.zig +++ b/libpanto/src/config.zig @@ -1,5 +1,20 @@ pub const APIStyle = enum { - anthropic, + openai_chat, +}; + +/// Reasoning intensity hint sent to providers that support it. +/// +/// `.default` omits the field entirely so the provider's own default applies. +/// `.off` sends `"none"` (supported by OpenRouter/NanoGPT; ignored or rejected +/// elsewhere). The remaining values mirror the `reasoning_effort` parameter +/// accepted by OpenAI reasoning models and OpenAI-compatible proxies. +pub const ReasoningEffort = enum { + default, + off, + minimal, + low, + medium, + high, }; pub const Config = struct { @@ -7,19 +22,32 @@ pub const Config = struct { api_key: []const u8, base_url: []const u8, model: []const u8, + reasoning: ReasoningEffort = .default, }; const t = @import("std").testing; test "Config - construct with all fields" { const cfg = Config{ - .api_style = .anthropic, - .api_key = "sk-ant-test", - .base_url = "https://api.anthropic.com", - .model = "claude-sonnet-4-20250514", + .api_style = .openai_chat, + .api_key = "sk-test", + .base_url = "https://api.openai.com/v1", + .model = "gpt-4o", + .reasoning = .high, + }; + try t.expectEqual(APIStyle.openai_chat, cfg.api_style); + try t.expectEqualStrings("sk-test", cfg.api_key); + try t.expectEqualStrings("https://api.openai.com/v1", cfg.base_url); + try t.expectEqualStrings("gpt-4o", cfg.model); + try t.expectEqual(ReasoningEffort.high, cfg.reasoning); +} + +test "Config - reasoning defaults to .default" { + const cfg = Config{ + .api_style = .openai_chat, + .api_key = "k", + .base_url = "u", + .model = "m", }; - try t.expectEqual(APIStyle.anthropic, cfg.api_style); - try t.expectEqualStrings("sk-ant-test", cfg.api_key); - try t.expectEqualStrings("https://api.anthropic.com", cfg.base_url); - try t.expectEqualStrings("claude-sonnet-4-20250514", cfg.model); + try t.expectEqual(ReasoningEffort.default, cfg.reasoning); } |
