From d5c1ae1cb2c11b011e4a0b46da986ed51813eaf7 Mon Sep 17 00:00:00 2001 From: frob Date: Sun, 7 Apr 2024 13:05:39 +0200 Subject: [PATCH] Update ollama.py for image handling Some clients (eg librechat) send images in datauri format, not plain base64. Strip off the prerix when passing images to ollama. --- litellm/llms/ollama.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/litellm/llms/ollama.py b/litellm/llms/ollama.py index 779896abfdd..2eb1ce26a61 100644 --- a/litellm/llms/ollama.py +++ b/litellm/llms/ollama.py @@ -157,7 +157,7 @@ def get_ollama_response( if format is not None: data["format"] = format if images is not None: - data["images"] = images + data["images"] = [image.split(",")[-1] if image.startswith("data:") else image for image in images] ## LOGGING logging_obj.pre_call(