feat: add llm.Foreman() constructor for foreman daemon integration #4

Closed
steve wants to merge 2 commits from feat/foreman-constructor into main
Showing only changes of commit 15fb8e19a8 - Show all commits
+24
View File
@@ -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))
}