Update go-llm module version in go.mod and go.sum
This commit is contained in:
@@ -12,12 +12,14 @@ import (
|
||||
"github.com/docker/docker/api/types/mount"
|
||||
"github.com/docker/docker/client"
|
||||
|
||||
gollm "gitea.stevedudenhoeffer.com/steve/go-llm"
|
||||
|
||||
"gitea.stevedudenhoeffer.com/steve/answer/pkg/agents"
|
||||
"gitea.stevedudenhoeffer.com/steve/answer/pkg/agents/shared"
|
||||
gollm "gitea.stevedudenhoeffer.com/steve/go-llm"
|
||||
)
|
||||
|
||||
type Agent struct {
|
||||
agents.Agent
|
||||
// Model is the chat completion model to use
|
||||
Model gollm.ChatCompletion
|
||||
|
||||
@@ -43,6 +45,8 @@ type Response struct {
|
||||
func (a Agent) Answer(ctx context.Context, questions []string) (Response, error) {
|
||||
var res Response
|
||||
|
||||
a.Agent = agents.NewAgent(a.Model, gollm.NewToolBox()).WithMaxCalls(200)
|
||||
|
||||
if a.MaxCommands <= 0 {
|
||||
a.MaxCommands = 10000
|
||||
}
|
||||
@@ -111,7 +115,7 @@ func (a Agent) Answer(ctx context.Context, questions []string) (Response, error)
|
||||
fmt.Println(opwd)
|
||||
slog.Info("pwd", "pwd", opwd, "epwd", epwd)
|
||||
|
||||
tools := map[string]*gollm.Function{
|
||||
tools := map[string]gollm.Function{
|
||||
"exit": gollm.NewFunction(
|
||||
"exit",
|
||||
"exit the container",
|
||||
@@ -258,7 +262,7 @@ func (a Agent) Answer(ctx context.Context, questions []string) (Response, error)
|
||||
When you are done, please use "exit" to exit the container.
|
||||
Respond with any number of commands to answer the question, they will be executed in order.`
|
||||
|
||||
var toolbox []*gollm.Function
|
||||
var toolbox []gollm.Function
|
||||
|
||||
// add unrestricted tools
|
||||
toolbox = append(toolbox, tools["exit"], tools["write"], tools["read"])
|
||||
@@ -291,7 +295,7 @@ Respond with any number of commands to answer the question, they will be execute
|
||||
slog.Info("answered question and learned nothing")
|
||||
}
|
||||
|
||||
res.Knowledge, err = agents.KnowledgeIntegrate(ctx, a.Model, res.Knowledge, r)
|
||||
res.Knowledge, err = a.KnowledgeIntegrate(ctx, res.Knowledge, r)
|
||||
if err != nil {
|
||||
return res, fmt.Errorf("error integrating knowledge: %w", err)
|
||||
}
|
||||
|
@@ -18,6 +18,8 @@ import (
|
||||
)
|
||||
|
||||
type Agent struct {
|
||||
agents.Agent
|
||||
|
||||
// Model is the chat completion model to use
|
||||
Model gollm.ChatCompletion
|
||||
|
||||
@@ -42,6 +44,7 @@ type Response struct {
|
||||
// do what is necessary to answer the question.
|
||||
func (a Agent) Answer(ctx context.Context, questions []string) (Response, error) {
|
||||
var res Response
|
||||
a.Agent = agents.NewAgent(a.Model, gollm.NewToolBox()).WithMaxCalls(200)
|
||||
|
||||
if a.MaxCommands <= 0 {
|
||||
a.MaxCommands = 10000
|
||||
@@ -111,7 +114,7 @@ func (a Agent) Answer(ctx context.Context, questions []string) (Response, error)
|
||||
fmt.Println(opwd)
|
||||
slog.Info("pwd", "pwd", opwd, "epwd", epwd)
|
||||
|
||||
tools := map[string]*gollm.Function{
|
||||
tools := map[string]gollm.Function{
|
||||
"exit": gollm.NewFunction(
|
||||
"exit",
|
||||
"exit the container",
|
||||
@@ -258,7 +261,7 @@ func (a Agent) Answer(ctx context.Context, questions []string) (Response, error)
|
||||
When you are done, please use "exit" to exit the container.
|
||||
Respond with any number of commands to answer the question, they will be executed in order.`
|
||||
|
||||
var toolbox []*gollm.Function
|
||||
var toolbox []gollm.Function
|
||||
|
||||
// add unrestricted tools
|
||||
toolbox = append(toolbox, tools["exit"], tools["write"], tools["read"])
|
||||
@@ -291,7 +294,7 @@ Respond with any number of commands to answer the question, they will be execute
|
||||
slog.Info("answered question and learned nothing")
|
||||
}
|
||||
|
||||
res.Knowledge, err = agents.KnowledgeIntegrate(ctx, a.Model, res.Knowledge, r)
|
||||
res.Knowledge, err = a.KnowledgeIntegrate(ctx, res.Knowledge, r)
|
||||
if err != nil {
|
||||
return res, fmt.Errorf("error integrating knowledge: %w", err)
|
||||
}
|
||||
|
@@ -12,7 +12,7 @@ import (
|
||||
|
||||
type KnowledgeWorker struct {
|
||||
Model gollm.ChatCompletion
|
||||
ToolBox *gollm.ToolBox
|
||||
ToolBox gollm.ToolBox
|
||||
ContextualInformation []string
|
||||
OnNewFunction func(ctx context.Context, funcName string, args string) (any, error)
|
||||
OnFunctionFinished func(ctx context.Context, funcName string, args string, result any, err error, newFunctionResult any) error
|
||||
|
Reference in New Issue
Block a user