add reasoning action

This commit is contained in:
Ettore Di Giacinto
2024-04-01 11:33:12 +02:00
parent f2e09dfe81
commit 56ceedb4fb

33
action/reasoning.go Normal file
View File

@@ -0,0 +1,33 @@
package action
import (
"github.com/sashabaranov/go-openai/jsonschema"
)
func NewReasoning() *ReasoningAction {
return &ReasoningAction{}
}
type ReasoningAction struct{}
type ReasoningResponse struct {
Reasoning string `json:"reasoning"`
}
func (a *ReasoningAction) Run(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"},
}
}