Documentation Index
Fetch the complete documentation index at: https://docs.tensormesh.ai/llms.txt
Use this file to discover all available pages before exploring further.
Structured output is requested through the AI SDK chat model call. With tensormesh(modelId), the request is sent to /v1/chat/completions and the AI SDK parses the response against your schema.
import { Output, streamText } from "ai";
import { tensormesh } from "@tensormesh/ai-sdk-provider";
import { z } from "zod";
const launchPlanSchema = z.object({
title: z.string(),
audience: z.string(),
summary: z.string(),
integrationSteps: z.array(
z.object({
step: z.string(),
detail: z.string(),
}),
),
successSignals: z.array(z.string()),
});
const result = streamText({
model: tensormesh("mistralai/Devstral-2-123B-Instruct-2512"),
prompt:
"Create a launch plan for a TypeScript team adopting Tensormesh serverless inference.",
output: Output.object({
schema: launchPlanSchema,
}),
});
for await (const partialObject of result.partialOutputStream) {
console.log(partialObject);
}
Structured output is useful when your application needs predictable JSON for forms, workflow plans, routing decisions, or typed UI state.