diff options
Diffstat (limited to 'libpanto/src/config.zig')
| -rw-r--r-- | libpanto/src/config.zig | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/libpanto/src/config.zig b/libpanto/src/config.zig index 8efa810..203a091 100644 --- a/libpanto/src/config.zig +++ b/libpanto/src/config.zig @@ -67,6 +67,37 @@ pub const ProviderConfig = union(APIStyle) { pub fn style(self: ProviderConfig) APIStyle { return @as(APIStyle, self); } + + /// The wire-format provider identity for this config: the ground-truth + /// `{api_style, base_url, model, reasoning}` that a turn is sent with. + /// Anthropic has no reasoning-effort knob, so it reports `.default`. + /// Borrowed slices; valid as long as the config is. + pub fn wireIdentity(self: ProviderConfig) WireIdentity { + return switch (self) { + .openai_chat => |c| .{ + .api_style = .openai_chat, + .base_url = c.base_url, + .model = c.model, + .reasoning = c.reasoning, + }, + .anthropic_messages => |c| .{ + .api_style = .anthropic_messages, + .base_url = c.base_url, + .model = c.model, + .reasoning = .default, + }, + }; + } +}; + +/// Wire-format provider identity (see `ProviderConfig.wireIdentity`). This +/// is the same shape as `session_store.WireIdentity`; defined here to avoid +/// a module cycle (config must not import session_store). +pub const WireIdentity = struct { + api_style: APIStyle, + base_url: []const u8, + model: []const u8, + reasoning: ReasoningEffort = .default, }; /// Compaction settings the agent consults when summarizing old history. |
