-
Notifications
You must be signed in to change notification settings - Fork 0
/
agents.go
63 lines (58 loc) · 1.16 KB
/
agents.go
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
60
61
62
63
package groq
import (
"context"
"log/slog"
"github.com/conneroisu/groq-go/pkg/tools"
)
type (
// Agenter is an interface for an agent.
Agenter interface {
ToolManager
}
// ToolManager is an interface for a tool manager.
ToolManager interface {
ToolGetter
ToolRunner
}
// ToolGetter is an interface for a tool getter.
ToolGetter interface {
Get(
ctx context.Context,
params ToolGetParams,
) ([]tools.Tool, error)
}
// ToolRunner is an interface for a tool runner.
ToolRunner interface {
Run(
ctx context.Context,
response ChatCompletionResponse,
) ([]ChatCompletionMessage, error)
}
// ToolGetParams are the parameters for getting tools.
ToolGetParams struct {
}
// Router is an agent router.
//
// It is used to route messages to the appropriate model.
Router struct {
// Agents is the agents of the router.
Agents []Agent
// Logger is the logger of the router.
Logger *slog.Logger
}
)
// Agent is an agent.
type Agent struct {
client *Client
logger *slog.Logger
}
// NewAgent creates a new agent.
func NewAgent(
client *Client,
logger *slog.Logger,
) *Agent {
return &Agent{
client: client,
logger: logger,
}
}