litellm icon indicating copy to clipboard operation
litellm copied to clipboard

Update ollama.py for image handling

Open rick-github opened this issue 2 months ago • 3 comments

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 https://github.com/BerriAI/litellm/issues/1427, https://github.com/BerriAI/litellm/issues/2661

rick-github avatar Apr 07 '24 11:04 rick-github

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 3, 2024 6:56pm

vercel[bot] avatar Apr 07 '24 11:04 vercel[bot]

Hi Jakob,

base64 encoded data shouldn't contain commas, it's restricted to the character set [A-Za-z0-9/+=]: https://en.wikipedia.org/wiki/Base64

On Thu, 11 Apr 2024 at 05:10, Jakob @.***> wrote:

I think this implementation is flawed since you're doing image.split(",") for the comma you're expecting at the beginning, but the base64 encoded data itself can also contain commas.

— Reply to this email directly, view it on GitHub https://github.com/BerriAI/litellm/pull/2888#issuecomment-2048855410, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADSBEJVKJCF77L263ZUULTTY4X5LTAVCNFSM6AAAAABF3HOAX6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDANBYHA2TKNBRGA . You are receiving this because you authored the thread.Message ID: @.***>

rick-github avatar Apr 11 '24 07:04 rick-github

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

jakobdylanc avatar Apr 11 '24 08:04 jakobdylanc