You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
ollama: attaching a file does not work/results in error 500/400 Bad request #11
Interestingly, attaching an image file and asking the ollama model to describe it works as expected.
I see it uses "type": "image_url" instead of "type": "file"
Details
provider: ollama OllamaProviderResized image from 1754x1403 to 1280x1024Converted image to WebP: 798373 bytes -> 235210 bytes (29%)POST http://localhost:11434/v1/chat/completions
{
"model": "qwen3-vl:8b",
"messages": [
{
"role": "user",
"content": [
{
"type": "image_url",
"image_url": {
"url": "data:image/webp;base64,(313617)"
}
},
{
"type": "text",
"text": "Describe the key features of the input image\n\n[\ud83d\uddbc\ufe0f Snowden_Slights_with_big_gun_YORYM-S364.jpg]"
}
]
}
],
"enable_thinking": true,
"metadata": {
"threadId": "1765745070478"
},
"stream": false
}
{
"id": "chatcmpl-198",
"object": "chat.completion",
"created": 1765745083,
"model": "qwen3-vl:8b",
"system_fingerprint": "fp_ollama",
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": "This black - and - white photograph presents a historical scene with several prominent features: [...].",
"reasoning": "So, let's describe the key features of this black-and-white photograph. [...]."
},
"finish_reason": "stop"
}
],
"usage": {
"prompt_tokens": 1328,
"completion_tokens": 687,
"total_tokens": 2015
},
"metadata": {
"duration": 12785,
"pricing": "0/0"
}
}
I can't find any official way that Ollama supports to send file attachments like PDFs, the standard OpenAI compatible way works if I call the same model on OpenRouter (e.g. Gemma 3n 4B) so I don't think it's supported.
I'll wait for official support from Ollama, which I expect will just be to implement OpenAI's file type support, like they do with image_url when they added support for it.
Activity
nodiscc commentedon Dec 14, 2025
Interestingly, attaching an image file and asking the ollama model to describe it works as expected.
I see it uses
"type": "image_url"instead of"type": "file"Details
nodiscc commentedon Dec 14, 2025
I don't think this is supposed to be supported at all by the API (https://docs.ollama.com/api/openai-compatibility), am I correct? This issue seems to support my conclusion ollama/ollama#5762
I think the only correct way to achieve this, would be to have llms.py extract the content of the file and pass it to the LLM through the prompt.
mythz commentedon Dec 15, 2025
I can't find any official way that Ollama supports to send file attachments like PDFs, the standard OpenAI compatible way works if I call the same model on OpenRouter (e.g. Gemma 3n 4B) so I don't think it's supported.
I'll wait for official support from Ollama, which I expect will just be to implement OpenAI's file type support, like they do with image_url when they added support for it.