summaryrefslogtreecommitdiff
path: root/internal/llm/anthropic.go
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2026-03-02 13:33:08 +0200
committerPaul Buetow <paul@buetow.org>2026-03-02 13:33:08 +0200
commit3bd295d60ecbb30852e8bcf672b1befd93eb9bff (patch)
tree2a530a83cb766a990a31d98d16328aaf634c1eeb /internal/llm/anthropic.go
parent10406467650942b780e5de462d5103431c5a951e (diff)
llm: add provider registry and self-registration factories (task 410)
Diffstat (limited to 'internal/llm/anthropic.go')
-rw-r--r--internal/llm/anthropic.go17
1 files changed, 17 insertions, 0 deletions
diff --git a/internal/llm/anthropic.go b/internal/llm/anthropic.go
index 0d87424..82d8b8a 100644
--- a/internal/llm/anthropic.go
+++ b/internal/llm/anthropic.go
@@ -86,6 +86,23 @@ var (
_ Streamer = (*anthropicClient)(nil)
)
+func init() {
+ RegisterProvider("anthropic", anthropicProviderFactory)
+}
+
+func anthropicProviderFactory(cfg Config, keys ProviderKeys) (Client, error) {
+ if strings.TrimSpace(keys.AnthropicAPIKey) == "" {
+ return nil, errors.New("missing ANTHROPIC_API_KEY for provider anthropic")
+ }
+ return newAnthropicWithTimeout(
+ cfg.AnthropicBaseURL,
+ cfg.AnthropicModel,
+ keys.AnthropicAPIKey,
+ withDefaultTemperature(cfg.AnthropicTemperature, 0.2),
+ cfg.RequestTimeout,
+ ), nil
+}
+
// Constructor
// newAnthropic constructs an Anthropic client using explicit configuration values.
// The apiKey may be empty; calls will fail until a valid key is supplied.