diff --git a/v2/constructors.go b/v2/constructors.go index c819505..434ad70 100644 --- a/v2/constructors.go +++ b/v2/constructors.go @@ -137,3 +137,27 @@ func OllamaCloud(apiKey string, opts ...ClientOption) *Client { } return NewClient(ollamaProvider.New(apiKey, baseURL)) } + +// Foreman creates a client targeting a foreman daemon (a private, authenticated +// Ollama endpoint with queuing and observability). baseURL is required +// (e.g. "http://foreman:8080"). apiKey is the optional static bearer token; pass +// "" for an unauthenticated (network-trusted) deployment. +// +// foreman speaks native Ollama on the wire, so this delegates to the ollama +// provider unchanged — streaming, tool use, and think all work transparently. +// +// See: https://gitea.stevedudenhoeffer.com/steve/foreman +// +// Example: +// +// model := llm.Foreman("http://foreman.orgrimmar:8080", token).Model("qwen3:30b") +func Foreman(baseURL, apiKey string, opts ...ClientOption) *Client { + cfg := &clientConfig{} + for _, opt := range opts { + opt(cfg) + } + if cfg.baseURL != "" { + baseURL = cfg.baseURL + } + return NewClient(ollamaProvider.New(apiKey, baseURL)) +}