Basic Input Types
The most common need is collecting text and numbers from users. You can create these inputs while controlling what values are valid:Text and Numbers
Controlling User Choices with Dropdowns
Often you’ll want users to select from specific options rather than typing freely. This prevents errors and makes your function more robust. There are two ways to create dropdowns:Using Enums (Recommended)
Enums are the cleaner approach when you have a fixed set of options that won’t change often:Using JSON Schema (Experimental)
Sometimes you need more flexibility or want to generate options dynamically. JSON schema gives you this control, but the full schema is only partially supported and may not give desired results in UI:Protecting Sensitive Data
When your function needs sensitive information like API keys or passwords, use secret fields. These protect users by:- Masking the input with asterisks
- Encrypting the values in storage
- Only decrypting them when your function runs
Validating User Input
Help users provide correct data by adding validation rules:Python
The SDK uses Pydantic validation:gt
,lt
: Ensure numbers are greater/less than a valuege
,le
: Allow numbers equal to the limitmin_length
,max_length
: Control text lengthpattern
: Match text against a regex pattern
C#
Use standard .NET validation attributes:[Range]
: Set minimum and maximum numbers[MinLength]
,[MaxLength]
: Control text length[RegularExpression]
: Match text patterns[Required]
: Mark fields as mandatory
Field Types Comparison Table
Field Type | Python (Pydantic) Type | C# Type | JSON Representation |
---|---|---|---|
String | str (BaseModel) | string | { "type": "string" } |
Integer | int (BaseModel) | int | { "type": "integer" } |
Float | float (BaseModel) | double | { "type": "number" } |
Boolean | bool (BaseModel) | bool | { "type": "boolean" } |
Enum | enum (Enum) | enum | { "type": "enum" } |