llm icon indicating copy to clipboard operation
llm copied to clipboard

Handle rate limiting for ada-002 embedding model

Open simonw opened this issue 2 years ago • 3 comments

Got this error:

openai.error.RateLimitError: Rate limit reached for default-text-embedding-ada-002 in organization org-2s2EXgTQ0xpZph33D2POEckd on tokens per min. Limit: 1000000 / min. Current: 598769 / min. Contact us through our help center at help.openai.com if you continue to have issues.

That was when I accidentally tried to embed a HUGE volume of content (I had meant to use sentence-transformers/all-MiniLM-L6-v2).

simonw avatar Sep 04 '23 19:09 simonw

FWIW, I got the same error loading ~6k emails.

dwillis avatar Sep 09 '23 20:09 dwillis

I got this same error and wanted to change ada for sentence-transformers/all-MiniLM-L6-v2, but I didn't find how to load it from Python. Neither collection = llm.Collection("entries", db, model_id="sentence-transformers/all-MiniLM-L6-v2") nor collection = llm.Collection("entries", db, model_id="all-MiniLM-L6-v2") seem to work, even though I have created a collection from the command line using sentence-transformers/all-MiniLM-L6-v2. What is the right way to do this?

EDIT: I found this by searching a bit more, leaving my comment for other people who might have the same issue:

model = llm.get_embedding_model("sentence-transformers/all-MiniLM-L6-v2")

# You can pass a model directly using model= instead of model_id=
collection = llm.Collection("entries", db, model=model)

However I get llm.UnknownModelError: 'Unknown model: sentence-transformers/all-MiniLM-L6-v2'

EDIT2: all I needed to do was

llm install llm-sentence-transformers

tomsib2001 avatar Oct 23 '23 13:10 tomsib2001

I get the same error as @tomsib2001 when using model = llm.get_embedding_model("sentence-transformers/all-MiniLM-L6-v2"), but I already did this:

llm install llm-sentence-transformers

and this doesn't change anything either:

pip install sentence-transformers

Then I found out, it works when I use the same environment pipx installed llm into. Which I used to create the embeddings.

frictionel avatar May 05 '24 00:05 frictionel