JavaScript & TypeScript
Stream Object
Stream structured objects based on a schema for your workflows.
Usage
Parameters
When using a JSON schema, you must add
as const
to the schema object for it to be properly typed. More infoParameter | 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. |
Return Value
The streamObject
method returns the following object: