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