Generate structured objects based on a schema for your workflows.
When using a JSON schema, you must add as const
to the schema object for it
to be properly typed. More
info
Parameter | Type | Required | Description |
---|---|---|---|
input | string | Yes | The input text to generate a response for. |
schema | object | Yes | The Zod v3, v4 or JSON schema that defines the structure of the expected response. |
workflowSlug | string | No | The slug of the workflow to use for generation (not required if you’re using a threadId). |
threadId | string | No | Identifier for associating runs with a conversation thread. |
attachments | Attachment[] | No | Array of attachments to include in the generation. |
contextSlugs | string[] | No | The slugs of the contexts that the AI model can access. |
type | string | No | Used to indicate the response type (only “event” is supported for now). |
callback | Callback | No | The callback object to receive the webhook. |
The generateObject
method returns the following object:
If you use the type
and callback
parameters, this will return the following object: