From 83caeb9bcdc4a5eafda937807cd42ea8455948a6 Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Wed, 20 May 2026 18:27:35 +0300 Subject: 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 --- internal/llm/provider.go | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'internal/llm/provider.go') 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 } -- cgit v1.2.3