Form#
Gives the assistant the ability to present a form with multiple fields for user input.
This tool enables structured data collection from users through an interactive form with support for different field types: text, select, boolean, and number.
Instructions
### When to use the form tool
Use the form tool when you need to collect multiple related fields from the
user in a single interaction. It is well suited for structured data collection
where field types are text, select (choose from a list), boolean (yes/no), or
number.
For **secrets** (API keys, passwords) use the ``elicit`` tool instead — form
does not have a secret type, so credentials would appear in the chat display.
For a single question or free-form input, a plain assistant message is simpler.
Prefer form when collecting two or more related fields at once.
### Form syntax
Each field is specified on a separate line with the format:
field_name: Prompt text [options]
Field types are inferred from the prompt:
- Text field (default): `name: What's your name?`
- Select field: `priority: Priority level [low, medium, high]`
- Boolean field: `confirm: Are you sure? [yes/no]`
- Number field: `count: How many? (number)`
The tool will present an interactive form and return the collected data as JSON.
Examples
Collect project information
| User |
I want to start a new project |
| Assistant |
Let me gather some information about your project: |
| System |
Form submitted: |
Simple confirmation form
| User |
Deploy to production |
| Assistant |
Please confirm the deployment details: |
| System |
Form submitted: |
- gptme.tools.form.execute_form(code: str | None, args: list[str] | None, kwargs: dict[str, str] | None) Generator[Message, None, None]
Present a form to the user and collect their responses.