From df2edee86eec2a8deb0ad57b5d20552199c12b65 Mon Sep 17 00:00:00 2001 From: T Date: Mon, 25 May 2026 13:24:02 -0700 Subject: phase 1 done --- libpanto/src/config.zig | 46 +++++++++++++++++++++++++++++++++++++--------- 1 file changed, 37 insertions(+), 9 deletions(-) (limited to 'libpanto/src/config.zig') 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); } -- cgit v1.3