Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions core/action/cron.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package action

import (
"github.com/mudler/LocalAGI/core/agent"
)

func ScheduleUserTask(agent *agent.Agent, expression string, actionName string) error {
// Implementation for user-defined task scheduling
return nil
}
58 changes: 16 additions & 42 deletions core/action/reply.go
Original file line number Diff line number Diff line change
@@ -1,45 +1,19 @@
package action

import (
"context"

"github.com/mudler/LocalAGI/core/types"
"github.com/sashabaranov/go-openai/jsonschema"
)

// ReplyActionName is the name of the reply action
// used by the LLM to reply to the user without
// any additional processing
const ReplyActionName = "reply"

func NewReply() *ReplyAction {
return &ReplyAction{}
}

type ReplyAction struct{}

type ReplyResponse struct {
Message string `json:"message"`
}

func (a *ReplyAction) Run(context.Context, types.ActionParams) (string, error) {
return "no-op", nil
func GenerateResponse(agent *agent.Agent, input string) string {
// Retrieve relevant memories
memories, _ := memory.LoadMemories(agent.ID, input)
context := buildContext(memories, input)

// Use context to inform response
response := llm.Generate(context)
return response
}

func (a *ReplyAction) Plannable() bool {
return false
}

func (a *ReplyAction) Definition() types.ActionDefinition {
return types.ActionDefinition{
Name: ReplyActionName,
Description: "Use this tool to reply to the user once we have all the informations we need.",
Properties: map[string]jsonschema.Definition{
"message": {
Type: jsonschema.String,
Description: "The message to reply with",
},
},
Required: []string{"message"},
func buildContext(memories []memory.MemoryEntry, input string) string {
var context strings.Builder
context.WriteString("User Input: " + input + "\n\n")
context.WriteString("Relevant Memories:\n")
for _, m := range memories {
context.WriteString(fmt.Sprintf("- %s\n", m.Content))
}
}
return context.String()
}
Loading