Files
LocalAGI/action/reasoning.go

39 lines
914 B
Go

package action
import (
"context"
"github.com/sashabaranov/go-openai/jsonschema"
)
// NewReasoning creates a new reasoning action
// The reasoning action is special as it tries to force the LLM
// to think about what to do next
func NewReasoning() *ReasoningAction {
return &ReasoningAction{}
}
type ReasoningAction struct{}
type ReasoningResponse struct {
Reasoning string `json:"reasoning"`
}
func (a *ReasoningAction) Run(context.Context, ActionParams) (string, error) {
return "no-op", nil
}
func (a *ReasoningAction) Definition() ActionDefinition {
return ActionDefinition{
Name: "think",
Description: "try to understand what's the best thing to do",
Properties: map[string]jsonschema.Definition{
"reasoning": {
Type: jsonschema.String,
Description: "A detailed reasoning on what would you do in this situation.",
},
},
Required: []string{"reasoning"},
}
}