Sync ollama docs from 12e04379 on 2026-06-12
This commit is contained in:
@@ -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.',
|
||||
|
||||
@@ -7,7 +7,7 @@ Vision models accept images alongside text so the model can describe, classify,
|
||||
## Quick start
|
||||
|
||||
```shell
|
||||
ollama run gemma3 ./image.png whats in this image?
|
||||
ollama run gemma4 ./image.png whats in this image?
|
||||
```
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@ Provide an `images` array. SDKs accept file paths, URLs or raw bytes while the R
|
||||
curl -X POST http://localhost:11434/api/chat \
|
||||
-H "Content-Type: application/json" \
|
||||
-d '{
|
||||
"model": "gemma3",
|
||||
"model": "gemma4",
|
||||
"messages": [{
|
||||
"role": "user",
|
||||
"content": "What is in this image?",
|
||||
@@ -52,7 +52,7 @@ Provide an `images` array. SDKs accept file paths, URLs or raw bytes while the R
|
||||
# img = Path(path).read_bytes()
|
||||
|
||||
response = chat(
|
||||
model='gemma3',
|
||||
model='gemma4',
|
||||
messages=[
|
||||
{
|
||||
'role': 'user',
|
||||
@@ -71,7 +71,7 @@ Provide an `images` array. SDKs accept file paths, URLs or raw bytes while the R
|
||||
|
||||
const imagePath = '/absolute/path/to/image.jpg'
|
||||
const response = await ollama.chat({
|
||||
model: 'gemma3',
|
||||
model: 'gemma4',
|
||||
messages: [
|
||||
{ role: 'user', content: 'What is in this image?', images: [imagePath] }
|
||||
],
|
||||
|
||||
Reference in New Issue
Block a user