feat: add llm.Foreman() constructor for foreman daemon integration
Foreman is a private queued Ollama endpoint with observability. Since it speaks native Ollama on the wire, the constructor delegates to the existing ollama provider — no new code paths. Streaming, tool use, and think all work transparently. baseURL is positional and required (no sensible default for a private daemon). apiKey can be empty for network-trusted deployments. See ADR-0011 in the foreman repo for the integration design.
This commit is contained in:
@@ -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))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user