https://www.boundaryml.com logo
🟡 Trouble using Ollama with images - invalid requ...
# questions
j
Has anyone had any success using Ollama with images? I haven't been able to make it work and keep getting an invalid request error:
Copy code
baml
client<llm> Ollama_llama3_2_vision {
  provider "openai-generic"
  retry_policy Exponential
  options {
    base_url "http://localhost:11435/v1" //11435 is intended
    model llama3.2-vision
  }
}

function DescribeImage(image:image) -> string {
  client "Ollama_llama3_2_vision"
  prompt #"
    Describe the content of the image in a concise manner.

    {{ ctx.output_format }}

    {{ _.role("user") }}
    {{ image }}
  "#
}
When I run a test as follows:
Copy code
baml
test TestImage {
  functions [DescribeImage]
  args {
    image { url "https://media.springernature.com/lw685/springer-static/image/art%3A10.1038%2Fnri1334/MediaObjects/41577_2004_Article_BFnri1334_Fig3_HTML.jpg" }
  }
}
I get this response: Unspecified error code: 400 Request failed with status code: 400 Bad Request, {"error":{"message":"invalid image input","type":"invalid_request_error","param":null,"code":null}} Request options: {"model":"llama3.2-vision"}
It works with base64 data! Just couldn't get it to work with the URLs.
a
It s probably a cors issue, we will take a look