-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.go
More file actions
59 lines (46 loc) · 1.28 KB
/
Copy pathmain.go
File metadata and controls
59 lines (46 loc) · 1.28 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
package main
import (
"fmt"
"path/filepath"
"runtime"
"skill-eval/agent"
"skill-eval/eval"
"skill-eval/providers"
"github.com/sirupsen/logrus"
)
func main() {
client := providers.NewClient()
agentConfig := agent.NewAgentConfig(
agent.WithName("天气小助手"),
agent.WithDescription("天气小助手"),
agent.WithSystemPrompt("天气小助手,当你完成任务时,需要调用finish工具"),
agent.WithUserPrompt("查询下南京的天气,最后把结果保存为pdf文件"),
agent.WithModel("glm-5"),
agent.WithMaxToolCount(10),
agent.WithMaxIterations(10),
)
// 注册默认工具
agentConfig.RegistryDefaultTools()
agentConfig.RegistrySkills()
// 新建调度器
o := agent.NewOrchestrator(&client, agentConfig)
o.Tracer = agent.NewDefaultTracer("./logs/traces")
o.SetTargetSkill("pdf")
//运行智能体
o.Run()
trace := o.GetTrace()
r := eval.Exec(trace, eval.BuildDefaultScorer())
r.Print()
}
func init() {
logrus.SetFormatter(&logrus.TextFormatter{
ForceColors: true,
FullTimestamp: true,
TimestampFormat: "2006-01-02 15:04:05",
CallerPrettyfier: func(f *runtime.Frame) (string, string) {
return "", fmt.Sprintf(" %s:%d", filepath.Base(f.File), f.Line)
},
})
logrus.SetLevel(logrus.DebugLevel)
logrus.SetReportCaller(true)
}