Skip to content

Support default values for args #350

Open
@jsutton

Description

@jsutton

Feature Request: Default Values for Tool Arguments in GPTScript

Summary

Add the ability to define default values for tool arguments in GPTScript. This feature will enhance the flexibility and usability of tools by allowing users to specify default values for arguments, reducing the need for repetitive input and simplifying tool usage.

Motivation

Currently, GPTScript requires all tool arguments to be explicitly provided each time a tool is invoked. This can lead to repetitive code and increased potential for errors, especially when certain arguments frequently have the same value. By allowing default values for arguments, we can streamline tool usage and improve the overall developer experience.

Proposal

Introduce a syntax for defining default values for tool arguments in the GPTScript configuration. If an argument is not provided during tool invocation, the default value will be used.

Example

Consider a tool that starts a web server. We can define a default value for the port number as follows:

name: startserver
tools: sys.exec
description: start a web server on a specified port
args:
  port: 
    description: the port number to start the server on
    default: 8080

#!python -m http.server ${port}

In this example, if the port argument is not provided, it defaults to 8080.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestproposalAn enhancement or documentation proposal

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions