Used to extract structured data. It takes Inputs and a JSON schema, and extracts data from the inputs based on the provided schema.

Key Functionalities

  • Dynamic Data Extraction: By providing a JSON schema, you can dynamically guide the agent to output structured JSON data.

  • Type-Safe & Validated: The structuredOutput method leverages the provided JSON schema to validate the extracted data and return a validated type-safe JSON object.

  • Session-Aware Extraction: When a session_id is included in the inputs, the method can potentially incorporate data retrieved from prior conversations within the same session, enabling a more contextual understanding during the extraction process.

  • Multimodal: You can pass text, audio, and images, and the extracted data will be generative based on the input.

Arguments

Takes one argument passed as an object with the following properties:

inputs
Inputs
required

It should be an object adhering to the Inputs structure. You can pass a text message, list of audio files, and a list of images.

Reference to Inputs

schema
ZodSchema
required

Defines the schema of the expected JSON data structure and used to validated the LLM output.

options
RunOptions

Used to specify the run options, like the session ID, run ID, voice output, and some other options.

When you specify a session ID, the data could be generative based on the history of the sessions.

Reference to RunOptions

Return Value

This method returns a Promise that resolves to a validated JSON object that adheres to the provided schema. This object represents the extracted structured data.

Return Type

Type-safe based on the provided zod schema.

Behavior

If the data validation fails It will throw an error that’s not auto recovered.