summaryrefslogtreecommitdiff
path: root/internal/llm/anthropic.go
diff options
context:
space:
mode:
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.