summaryrefslogtreecommitdiff
path: root/internal/llm/provider.go
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2026-05-20 18:27:35 +0300
committerPaul Buetow <paul@buetow.org>2026-05-20 18:27:35 +0300
commit83caeb9bcdc4a5eafda937807cd42ea8455948a6 (patch)
treef2258d2d77bfb3f9186bbc457cecdfe17877b891 /internal/llm/provider.go
parent005c262d09314cd43285af33dc6f1afef0621714 (diff)
Add YouSearch (You.com Research API) provider integration
Amp-Thread-ID: https://ampcode.com/threads/T-019e45ff-4976-750c-b2e6-121d0e5991ef Co-authored-by: Amp <amp@ampcode.com>
Diffstat (limited to 'internal/llm/provider.go')
-rw-r--r--internal/llm/provider.go13
1 files changed, 10 insertions, 3 deletions
diff --git a/internal/llm/provider.go b/internal/llm/provider.go
index d1ff404..f866c83 100644
--- a/internal/llm/provider.go
+++ b/internal/llm/provider.go
@@ -91,6 +91,8 @@ type Config struct {
AnthropicBaseURL string
AnthropicModel string
AnthropicTemperature *float64
+ // YouSearch options
+ YouSearchResearchEffort string // lite|standard|deep|exhaustive
}
// ProviderKeys contains API credentials used by provider factories.
@@ -101,6 +103,7 @@ type ProviderKeys struct {
OpenRouterAPIKey string
AnthropicAPIKey string
OllamaAPIKey string
+ YouSearchAPIKey string
}
// ProviderFactory builds an LLM client for a named provider.
@@ -134,14 +137,15 @@ func RegisterProvider(name string, factory ProviderFactory) {
}
// RegisterAllProviders registers all built-in LLM providers (anthropic, openai,
-// openrouter, ollama). It is safe to call from multiple entry points because the
-// actual registration runs only once via sync.Once.
+// openrouter, ollama, yousearch). It is safe to call from multiple entry points
+// because the actual registration runs only once via sync.Once.
func RegisterAllProviders() {
registerProvidersOnce.Do(func() {
RegisterProvider("anthropic", anthropicProviderFactory)
RegisterProvider("openai", openAIProviderFactory)
RegisterProvider("openrouter", openRouterProviderFactory)
RegisterProvider("ollama", ollamaProviderFactory)
+ RegisterProvider("yousearch", youSearchProviderFactory)
})
}
@@ -149,7 +153,7 @@ func RegisterAllProviders() {
// API keys are supplied separately and may be read from the environment by the
// caller. ollamaAPIKey is optional and only used when targeting Ollama Cloud;
// a local Ollama server works with an empty value.
-func NewFromConfig(cfg Config, openAIAPIKey, openRouterAPIKey, anthropicAPIKey, ollamaAPIKey string) (Client, error) {
+func NewFromConfig(cfg Config, openAIAPIKey, openRouterAPIKey, anthropicAPIKey, ollamaAPIKey, youSearchAPIKey string) (Client, error) {
provider := normalizeProvider(cfg.Provider)
if provider == "" {
provider = "ollama"
@@ -165,6 +169,7 @@ func NewFromConfig(cfg Config, openAIAPIKey, openRouterAPIKey, anthropicAPIKey,
OpenRouterAPIKey: openRouterAPIKey,
AnthropicAPIKey: anthropicAPIKey,
OllamaAPIKey: ollamaAPIKey,
+ YouSearchAPIKey: youSearchAPIKey,
})
}
@@ -207,6 +212,8 @@ func providerDisplayName(provider string) string {
return "OpenRouter"
case "anthropic":
return "Anthropic"
+ case "yousearch":
+ return "YouSearch"
default:
return provider
}