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>
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
// Command skillexample demonstrates skills: reusable instruction+tool
|
||||
// bundles attached to an agent on demand — here the ready-made clock and
|
||||
// calc skills, which require tool use for time and arithmetic.
|
||||
package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
"flag"
|
||||
"fmt"
|
||||
"log"
|
||||
|
||||
"gitea.stevedudenhoeffer.com/steve/majordomo"
|
||||
"gitea.stevedudenhoeffer.com/steve/majordomo/agent"
|
||||
"gitea.stevedudenhoeffer.com/steve/majordomo/skill/calc"
|
||||
"gitea.stevedudenhoeffer.com/steve/majordomo/skill/clock"
|
||||
)
|
||||
|
||||
func main() {
|
||||
model := flag.String("model", "ollama-cloud/minimax-m3:cloud", "model spec")
|
||||
flag.Parse()
|
||||
|
||||
m, err := majordomo.Parse(*model)
|
||||
if err != nil {
|
||||
log.Fatalf("parse: %v", err)
|
||||
}
|
||||
|
||||
a := agent.New(m, "You are a precise assistant.")
|
||||
a.AddSkill(clock.New()) // time_now / time_convert + instructions
|
||||
a.AddSkill(calc.New()) // calculate + instructions
|
||||
|
||||
res, err := a.Run(context.Background(),
|
||||
"How many minutes are left until midnight UTC? Use your tools, then show the calculation.")
|
||||
if err != nil {
|
||||
log.Fatalf("run: %v", err)
|
||||
}
|
||||
fmt.Println(res.Output)
|
||||
for _, step := range res.Steps {
|
||||
for _, r := range step.Results {
|
||||
fmt.Printf(" tool %s → %s\n", r.Name, r.Content)
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user