Get up and running with Kimi, GLM, MiniMax, DeepSeek, gpt-oss, Qwen, Gemma and other models.
docs: update Zod example to use native toJSONSchema (#14746)
Chris Chen25e0e81e120c
diff --git a/docs/capabilities/structured-outputs.mdx b/docs/capabilities/structured-outputs.mdxindex c33ba5e37..484ba4fb0 100644--- a/docs/capabilities/structured-outputs.mdx+++ b/docs/capabilities/structured-outputs.mdx@@ -100,12 +100,11 @@ Provide a JSON schema to the `format` field.```</Tab><Tab title="JavaScript">- Serialize a Zod schema with `zodToJsonSchema()` and parse the structured response:+ Serialize a Zod schema with `z.toJSONSchema()` and parse the structured response:```javascriptimport ollama from 'ollama'- import { z } from 'zod'- import { zodToJsonSchema } from 'zod-to-json-schema'+ import * as z from 'zod'const Country = z.object({name: z.string(),@@ -116,7 +115,7 @@ Provide a JSON schema to the `format` field.const response = await ollama.chat({model: 'gpt-oss',messages: [{ role: 'user', content: 'Tell me about Canada.' }],- format: zodToJsonSchema(Country),+ format: z.toJSONSchema(Country),})const country = Country.parse(JSON.parse(response.message.content))