Add more actions, small fixups in the UI, add stop action

This commit is contained in:
mudler
2024-04-15 17:50:51 +02:00
parent 7db2b10bd2
commit 55b7b4a41e
28 changed files with 469 additions and 190 deletions

View File

@@ -1,6 +1,8 @@
package action
import (
"context"
"github.com/sashabaranov/go-openai/jsonschema"
)
@@ -19,7 +21,7 @@ type IntentResponse struct {
Reasoning string `json:"reasoning"`
}
func (a *IntentAction) Run(ActionParams) (string, error) {
func (a *IntentAction) Run(context.Context, ActionParams) (string, error) {
return "no-op", nil
}

View File

@@ -1,6 +1,8 @@
package action
import (
"context"
"github.com/sashabaranov/go-openai/jsonschema"
)
@@ -16,7 +18,7 @@ type ConversationActionResponse struct {
Message string `json:"message"`
}
func (a *ConversationAction) Run(ActionParams) (string, error) {
func (a *ConversationAction) Run(context.Context, ActionParams) (string, error) {
return "no-op", nil
}

View File

@@ -1,5 +1,7 @@
package action
import "context"
// StopActionName is the name of the action
// used by the LLM to stop any further action
const StopActionName = "stop"
@@ -10,13 +12,13 @@ func NewStop() *StopAction {
type StopAction struct{}
func (a *StopAction) Run(ActionParams) (string, error) {
func (a *StopAction) Run(context.Context, ActionParams) (string, error) {
return "no-op", nil
}
func (a *StopAction) Definition() ActionDefinition {
return ActionDefinition{
Name: StopActionName,
Description: "Use this tool to stop any further action and stop the conversation.",
Description: "Use this tool to stop any further action and stop the conversation. You must use this when: the user wants to stop the conversation, it seems that the user does not need any additional answer, it looks like there is already a conclusion to the conversation or the topic diverged too much from the original conversation.",
}
}

View File

@@ -1,6 +1,8 @@
package action
import (
"context"
"github.com/sashabaranov/go-openai/jsonschema"
)
@@ -22,7 +24,7 @@ type PlanSubtask struct {
Reasoning string `json:"reasoning"`
}
func (a *PlanAction) Run(ActionParams) (string, error) {
func (a *PlanAction) Run(context.Context, ActionParams) (string, error) {
return "no-op", nil
}

View File

@@ -1,6 +1,8 @@
package action
import (
"context"
"github.com/sashabaranov/go-openai/jsonschema"
)
@@ -17,7 +19,7 @@ type ReasoningResponse struct {
Reasoning string `json:"reasoning"`
}
func (a *ReasoningAction) Run(ActionParams) (string, error) {
func (a *ReasoningAction) Run(context.Context, ActionParams) (string, error) {
return "no-op", nil
}

View File

@@ -1,6 +1,8 @@
package action
import (
"context"
"github.com/sashabaranov/go-openai/jsonschema"
)
@@ -19,7 +21,7 @@ type ReplyResponse struct {
Message string `json:"message"`
}
func (a *ReplyAction) Run(ActionParams) (string, error) {
func (a *ReplyAction) Run(context.Context, ActionParams) (string, error) {
return "no-op", nil
}

View File

@@ -1,6 +1,7 @@
package action
import (
"context"
"fmt"
"github.com/sashabaranov/go-openai/jsonschema"
@@ -32,7 +33,7 @@ type StateResult struct {
Goal string `json:"goal"`
}
func (a *StateAction) Run(ActionParams) (string, error) {
func (a *StateAction) Run(context.Context, ActionParams) (string, error) {
return "internal state has been updated", nil
}