Repository navigation
Conversation
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Passing raw image bytes or a Path inside a message dictionary to
create()fails before sending the request; a string path is sent literally rather than as image data.chat()already normalizes these image inputs. The server'sCreateRequest.Messagesuses the sameMessage.Imagesstructure.Normalize image values in create message mappings for both clients using the existing image conversion. Preserve all other mapping fields, including empty content and extension fields, and keep existing Message instances and omitted/empty message lists unchanged. Input messages are not mutated.
Validation on Linux, Python 3.12.14, locked Pydantic 2.10.6 / HTTPX 0.28.1:
NO_PROXY=localhost,127.0.0.1,::1 no_proxy=localhost,127.0.0.1,::1 .venv/bin/python -m pytest ollama tests -q: 154 passed, including doctests..venv/bin/ruff check .,.venv/bin/ruff format --check .(47 files),uv lock --check, exactuv exportcomparison with requirements.txt, andgit diff --checkpass.TypeError: Object of type bytes is not JSON serializable; after, the server receives the expected base64 image and the SDK parses its success response.The localhost probe is an HTTP fixture, not a real Ollama server or model inference. The full Hatch Python/OS matrix was not run; Python 3.8 syntax was checked, not its runtime. No dependency or lockfile changes.
Source-discovered on upstream 35d9667. Searched create/images and create/messages issues and PRs before publication; no matching implementation found. This does not implement bare-image handling in #734/#756, which changes how
_copy_imagesinterprets a scalar.AI assistance: OpenAI Codex investigated, implemented, ran these checks, and inspected the final diff in a separate review pass. No human pre-review is claimed. Keeping this PR in draft for maintainer review and CI qualification.