Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update ollama.py for image handling #2888

Merged
merged 26 commits into from
May 28, 2024

Conversation

rick-github
Copy link
Contributor

@rick-github rick-github commented Apr 7, 2024

ollama wants plain base64 jpeg/png images, and some clients send dataURI and/or webp. Remove prefixes and convert all non-jpeg/png images to jpeg.

Fixes #1427, #2661

Some clients (eg librechat) send images in datauri format, not plain base64.  Strip off the prerix when passing images to ollama.
Copy link

vercel bot commented Apr 7, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
litellm ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 28, 2024 3:00pm

ollama wants plain base64 jpeg images, and some clients send dataURI and/or webp.  Remove prefixes and convert all non-jpeg images to jpeg.
@rick-github
Copy link
Contributor Author

rick-github commented Apr 11, 2024 via email

@jakobdylanc
Copy link
Contributor

Yeah realized that afterwards and deleted my comment :) sorry about that. I was confusing "," with "/"

@krrishdholakia
Copy link
Contributor

@rick-github thanks for this - can you add a test with a mock call for this to test_completions.py we've had a couple regressions with merged ollama pr's recently.

place to add test -

Example of a mock call -

def test_hf_test_completion_tgi():

@rick-github
Copy link
Contributor Author

Done.

@krrishdholakia
Copy link
Contributor

Thanks @rick-github just share a screenshot of it passing testing for your test + tests in test_ollama.py and we should be good to merge!

Thank you again for your awesome work here

@rick-github
Copy link
Contributor Author

Screenshot from 2024-05-28 18-01-24

@rick-github
Copy link
Contributor Author

Screenshot from 2024-05-28 18-06-23

@krrishdholakia krrishdholakia merged commit 77e9008 into BerriAI:main May 28, 2024
3 checks passed
@krrishdholakia
Copy link
Contributor

LGTM!

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.

[Bug]: Base64 Ollama Vision
3 participants