Files
majordomo/examples/tiers/main.go
T
steve 97513141dc docs: examples for every hard requirement + mort migration blueprint
Phase 7: nine runnable examples/ programs (parse, failover chains with
trailing alias, tiers, LLM_* env providers, multimodal, tool loop,
Generate[T], agent, skills); docs/mort-migration.md mapping mort's
go-llm/go-agentkit usage onto majordomo APIs with the planned additive
library extensions and conversion order; README finalized with the
complete matrix.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-06-10 13:17:20 +02:00

37 lines
1.1 KiB
Go

// Command tiers demonstrates custom tiers: register an alias once, then
// address models by task shape ("thinking", "workhorse") instead of
// hard-coding model strings at every call site.
package main
import (
"context"
"flag"
"fmt"
"log"
"gitea.stevedudenhoeffer.com/steve/majordomo"
)
func main() {
flag.Parse()
reg := majordomo.New()
reg.RegisterAlias("thinking", "ollama-cloud/minimax-m3:cloud,ollama-cloud/kimi-k2.6:cloud")
reg.RegisterAlias("workhorse", "ollama-cloud/minimax-m2.7:cloud,ollama-cloud/qwen3-coder:480b-cloud")
// Tiers can reference other tiers; expansion is recursive (with cycle
// detection), so "best-effort" is thinking with a workhorse tail.
reg.RegisterAlias("best-effort", "thinking,workhorse")
m, err := reg.Parse("best-effort")
if err != nil {
log.Fatalf("parse: %v", err)
}
resp, err := m.Generate(context.Background(), majordomo.Request{
Messages: []majordomo.Message{majordomo.UserText("One sentence: what is a model tier?")},
})
if err != nil {
log.Fatalf("generate: %v", err)
}
fmt.Printf("[%s] %s\n", resp.Model, resp.Text())
}