llm icon indicating copy to clipboard operation
llm copied to clipboard

FR: keep-going arg on failed embeddings.

Open thiswillbeyourgithub opened this issue 8 months ago • 4 comments

Hi!

Can you consider adding a keep-going argument that skips errors on an embeddibg call?

I've never actually been able to use llm's embeddings because when I really need an embedding search over lots of documents there are always some that, for one reason or another, will crash my ollama.

For example there was a single upgrade the other day that broke only the model that I'm using (see issue). I've talk with the llm-ollama author and apparently there is no way on the plugin side to gracefully handle errors as llm only expects an embedding.

So every time I wanted to use it I had to fallback to using wdoc, my rag library but it's considerably more complex and heavy.

What do you think?

thiswillbeyourgithub avatar May 15 '25 06:05 thiswillbeyourgithub

I think the keep-going argument is something that Ollama needs to support, not llm. That said, on the llm side there needs to be a way to signal/represent "failed" embeddings.

taketwo avatar May 15 '25 06:05 taketwo

On don't see how ollama could do something like that. Care to develop? What should ollama return in that case?

thiswillbeyourgithub avatar May 15 '25 07:05 thiswillbeyourgithub

Well, that's their decision. Empty vector, NaN, something else.

taketwo avatar May 15 '25 07:05 taketwo

  1. I don't trust ollama to handle catastrophic failures. And they are exceptionnary slow moving for this kind of issue (though I understand they have a lot to do, I'm not criticizing).
  2. Why go as close as possible to the error instead of trying to catch them all from the caller's side? That's more robust.
  3. Say ollama returned an empty vector: the caller cannot know why it failed ; llm would still crash after trying to handle it.

If @simonw is okay with the idea I could do a quick PR.

thiswillbeyourgithub avatar May 15 '25 07:05 thiswillbeyourgithub