Refactor function registration in knowledgeworker to use WithFunctions method
This commit is contained in:
parent
1be5cc047c
commit
1447b73dfb
@ -3,9 +3,10 @@ package shared
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"gitea.stevedudenhoeffer.com/steve/answer/pkg/agents"
|
||||
"strings"
|
||||
|
||||
"gitea.stevedudenhoeffer.com/steve/answer/pkg/agents"
|
||||
|
||||
gollm "gitea.stevedudenhoeffer.com/steve/go-llm"
|
||||
)
|
||||
|
||||
@ -72,8 +73,8 @@ func (w KnowledgeWorker) Answer(context context.Context, knowledge *agents.Knowl
|
||||
Text: lastMsg,
|
||||
})
|
||||
|
||||
req.Toolbox = w.ToolBox.
|
||||
WithFunction(*gollm.NewFunction(
|
||||
req.Toolbox = w.ToolBox.WithFunctions(
|
||||
gollm.NewFunction(
|
||||
"notes_to_self",
|
||||
"leave future executions of the LLM a note or two, can be called many times",
|
||||
func(ctx *gollm.Context, args struct {
|
||||
@ -82,8 +83,8 @@ func (w KnowledgeWorker) Answer(context context.Context, knowledge *agents.Knowl
|
||||
return agents.Knowledge{
|
||||
NotesToSelf: args.NotesToSelf,
|
||||
}, nil
|
||||
})).
|
||||
WithFunction(*gollm.NewFunction(
|
||||
}),
|
||||
gollm.NewFunction(
|
||||
"new_objectives",
|
||||
"Set new objectives for the LLM to work on, can be called many times. If no new objectives are set, the LLM will continue to work on the current objectives.",
|
||||
func(ctx *gollm.Context, args struct {
|
||||
@ -92,8 +93,8 @@ func (w KnowledgeWorker) Answer(context context.Context, knowledge *agents.Knowl
|
||||
return agents.Knowledge{
|
||||
CurrentObjectives: args.Objectives,
|
||||
}, nil
|
||||
})).
|
||||
WithFunction(*gollm.NewFunction(
|
||||
}),
|
||||
gollm.NewFunction(
|
||||
"learn",
|
||||
`Use learn to pass some relevant information to the model. The model will use this information to answer the question. Use it to learn relevant information from the text. Keep these concise and relevant to the question. Can be called many times.`,
|
||||
func(ctx *gollm.Context, args struct {
|
||||
|
Loading…
x
Reference in New Issue
Block a user