Skip to content

fix(example): bound multimodal xkcd requests - #717

Open
Ghraven wants to merge 1 commit into
ollama:mainfrom
Ghraven:raven-multimodal-example-timeouts
Open

fix(example): bound multimodal xkcd requests#717
Ghraven wants to merge 1 commit into
ollama:mainfrom
Ghraven:raven-multimodal-example-timeouts

Conversation

@Ghraven

@Ghraven Ghraven commented Aug 9, 2026

Copy link
Copy Markdown

Problem

examples/multimodal-generate.py fetches xkcd metadata and the comic image using httpx.get() without explicit timeouts. If xkcd or the image host accepts a connection but stalls, the example can hang before it ever reaches the Ollama generation call.

Before / after behavior

Before, the example made three external HTTP requests without a local timeout at the call sites.

After, the example uses one small HTTP_TIMEOUT constant for the latest-comic lookup, selected-comic lookup, and image download. The existing raise_for_status() behavior is unchanged.

Verification

  • python -m ruff format examples/multimodal-generate.py
  • python -m ruff check examples/multimodal-generate.py
  • python -m py_compile examples/multimodal-generate.py
  • git diff --check

I did not run the example end-to-end because it requires a local Ollama llava model and live network calls.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant