Skip to content
Merged
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
3 changes: 2 additions & 1 deletion pkg/openapi/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ func Run(operationID, defaultHost, args string, t *openapi3.T, envs []string) (s
}

if !validationResult.Valid() {
return "", false, fmt.Errorf("invalid arguments for operation %s: %s", operationID, validationResult.Errors())
// We don't return an error here because we want the LLM to be able to maintain control and try again.
return fmt.Sprintf("invalid arguments for operation %s: %s", operationID, validationResult.Errors()), true, nil
}

// Construct and execute the HTTP request.
Expand Down
6 changes: 6 additions & 0 deletions pkg/types/toolstring.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package types
import (
"encoding/json"
"fmt"
"os"
"path/filepath"
"strings"
)
Expand Down Expand Up @@ -76,6 +77,11 @@ func ToSysDisplayString(id string, args map[string]string) (string, error) {
return fmt.Sprintf("Writing `%s`", args["filename"]), nil
case "sys.context", "sys.stat", "sys.getenv", "sys.abort", "sys.chat.current", "sys.chat.finish", "sys.chat.history", "sys.echo", "sys.prompt", "sys.time.now", "sys.model.provider.credential":
return "", nil
case "sys.openapi":
if os.Getenv("GPTSCRIPT_OPENAPI_REVAMP") == "true" && args["operation"] != "" {
return fmt.Sprintf("Running API operation `%s` with arguments %s", args["operation"], args["args"]), nil
}
fallthrough
default:
return "", fmt.Errorf("unknown tool for display string: %s", id)
}
Expand Down