[PR #272] [CLOSED] Make _encode_image error message more helpful and shorten docstring #447

Closed
opened 2026-02-15 16:30:26 -05:00 by yindo · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ollama/ollama-python/pull/272
Author: @mags0ft
Created: 9/6/2024
Status: Closed

Base: mainHead: patch-1


📝 Commits (1)

  • e41a087 made error message more helpful and shortened docstring

📊 Changes

1 file changed (+3 additions, -3 deletions)

View changed files

📝 ollama/_client.py (+3 -3)

📄 Description

Hello to you all,

the original docstring in ollama/_client.py contained two entire base64 versions of the LICENSE file, which made it extremely long and let the two lines spike out. This proposal shortens these by a good bit, so they don't occupy as much space and are better readable while still keeping the docstring perfectly understandable.

As well, the error message in case of an incompatible type now returns more helpful info - the faulty type of the argument that was given - to make the possible origin of any errors in the future more clear.

Old error message:
RequestError: image must be bytes, path-like object, or file-like object

New error message:
RequestError: image must be bytes, path-like object, or file-like object, not ArbitraryClassName

I hope I could help!


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/ollama/ollama-python/pull/272 **Author:** [@mags0ft](https://github.com/mags0ft) **Created:** 9/6/2024 **Status:** ❌ Closed **Base:** `main` ← **Head:** `patch-1` --- ### 📝 Commits (1) - [`e41a087`](https://github.com/ollama/ollama-python/commit/e41a08764beee01f397c4abe7a9f2e69c0f66bc7) made error message more helpful and shortened docstring ### 📊 Changes **1 file changed** (+3 additions, -3 deletions) <details> <summary>View changed files</summary> 📝 `ollama/_client.py` (+3 -3) </details> ### 📄 Description Hello to you all, the original docstring in `ollama/_client.py` contained *two* entire base64 versions of the LICENSE file, which made it extremely long and let the two lines spike out. This proposal shortens these by a good bit, so they don't occupy as much space and are better readable while still keeping the docstring perfectly understandable. As well, the error message in case of an incompatible type now returns more helpful info - the faulty type of the argument that was given - to make the possible origin of any errors in the future more clear. Old error message: `RequestError: image must be bytes, path-like object, or file-like object` New error message: `RequestError: image must be bytes, path-like object, or file-like object, not ArbitraryClassName` I hope I could help! --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
yindo added the pull-request label 2026-02-15 16:30:26 -05:00
yindo closed this issue 2026-02-15 16:30:26 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: ollama/ollama-python#447