// the find
teilomillet/gollm
Unified Go interface for Language Model (LLM) providers. Simplifies LLM integration with flexible prompt management and common task functions.
gollm is a Go package that wraps OpenAI, Anthropic, Groq, Ollama, Mistral, and OpenRouter behind one interface, with helpers for prompt construction, JSON-schema-validated structured output, chain-of-thought, prompt optimization, and multi-model comparison. It's aimed at Go developers building LLM-backed tools who want to swap providers or models without rewriting call sites.
The OpenRouter integration is more than a pass-through — fallback models, auto-routing, and provider weighting are exposed as first-class options. The prompt optimizer (custom metrics, numerical/qualitative rating, threshold-based stopping) is a real feature, not just a wrapper around a single 'improve this prompt' call. Structured output validation and the CompareModels/AnalyzeComparisonResults tooling for running the same prompt across providers are genuinely useful for anyone picking a model empirically instead of by vibes.
Provider-specific capabilities (reasoning tokens, prompt caching, vision, fallback) are threaded through a stringly-typed SetOption(key, value) bag rather than typed config, so mismatches between provider and option surface at runtime, not compile time. Memory/conversation state (SetMemory(4096)) truncates by token count with no documented eviction strategy, and there's no mention of whether an *LLM instance is safe to share across goroutines — a real risk given it holds mutable conversation memory. The README's own quickstart pins claude-3-5-sonnet-20240620/20241022, suggesting model support lags and needs manual upkeep as providers ship new models. With six providers, structured messages, templates, an optimizer, and mixture-of-agents all in one package, feature parity across providers is unlikely to be uniform — worth checking whether your specific provider actually supports the option you're calling before relying on it.