Skip to content

Ollama Vision Example Doesn't Send Image To Model #1809

@brentonmallen1

Description

@brentonmallen1

Describe the issue as clearly as possible:

When following the ollama vision example, the image doesn't seem to be passed along with the request to the model.

Steps/code to reproduce the bug:

# Just run the example in the documentation as is
import io
import requests
import PIL
import ollama
import outlines
from outlines.inputs import Image

# Create the model
model = outlines.from_ollama(
    ollama.Client(),
    "qwen2.5vl:3b"
)

# Function to get an image
def get_image(url):
    r = requests.get(url)
    return PIL.Image.open(io.BytesIO(r.content))

# Create the prompt
prompt = [
    "Describe the image",
    Image(get_image("https://picsum.photos/id/237/400/300"))
]

# Generate text
response = model(prompt)
print(response) # The image shows a black puppy with a curious and attentive expression.

Expected result:

A description of the image

Error message:

The model states that an image wasn't provided in various ways depending on the model chosen, but it doesn't work for any vision model. Example output:


I don't have the ability to view or process images. My capabilities are limited to **text-based interactions** only.

If you'd like me to describe an image, **please provide a detailed text description of what you see** (e.g., "a red apple on a white plate," "a city skyline at sunset with tall skyscrapers," etc.). I’ll then analyze the description and give you a thoughtful response.

If you accidentally tried to attach an image, note that I **cannot see or interpret visual content**—I can only work with the text you type. 😅 Let me know how I can help!

Outlines/Python version information:

pyproject.toml:

[project]
name = "blah"
version = "0.1.0"
description = "Add your description here"
readme = "README.md"
requires-python = ">=3.10"
dependencies = [
    "outlines[ollama]>=1.2.9",
    "requests>=2.32.5",
]

uv sync

Context for the issue:

I'm trying to learn and start using Outlines, but haven't been able to get this to work.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions