Get structured output from the model based on a schema.
This method supports two modes:
jsonMode: Uses responseSchema to get JSON responses directly (preferred for structured outputs)functionCalling: Uses function calling with tools (default, for compatibility)withStructuredOutput<
RunOutput extends Record<string, any> = Record<string, any>
>(
outputSchema: Record<string, any> | InteropZodType<RunOutput> | SerializableSchema<RunOutput>,
config: StructuredOutputMethodOptions<false>
): Runnable<BaseLanguageModelInput, RunOutput>| Name | Type | Description |
|---|---|---|
outputSchema* | Record<string, any> | InteropZodType<RunOutput> | SerializableSchema<RunOutput> | |
config | StructuredOutputMethodOptions<false> |