Sync ollama docs from 12e04379 on 2026-06-12

This commit is contained in:
The Librarian
2026-06-12 04:00:06 +00:00
parent 7c43dfec77
commit 70feb5e845
33 changed files with 525 additions and 245 deletions
+4 -5
View File
@@ -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:
```javascript
import 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))
@@ -177,7 +176,7 @@ class ImageDescription(BaseModel):
text_content: Optional[str] = None
response = chat(
model='gemma3',
model='gemma4',
messages=[{
'role': 'user',
'content': 'Describe this photo and list the objects you detect.',