Term Cleanup: Handle embedding generation errors like rate limits

Aperta
#906 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
45/100
Tipo di issue
Funzionalità
Chiarezza
Abbastanza chiara
Stato di attività
Ferma
Stack tecnologico
php, wordpress
Ambito
ai, backend

Direzione di ricerca

La issue non nomina file né test; individua innanzitutto il flusso di cleanup che genera embeddings e verifica come vengono attualmente gestite le risposte dell’API e gli errori di rate limit. Il lavoro è completato quando gli errori generici dell’API si interrompono con un messaggio visibile, mentre le risposte di rate limit ritentano con un backoff limitato o alla fine si interrompono con un errore, con test a supporto di entrambi i percorsi.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Is your enhancement related to a problem? Please describe.

Originally documented by @dkotter:

I didn't run into any errors when testing but in looking at the code, it doesn't seem we ever look at the response from generating an embedding.

So in a scenario where this API request fails, we just continue on to the next term. Think of a situation where the API goes down or we hit rate limits on the API. In that case, the process will continue to try forever even though we aren't getting any results from the API.

I'd suggest, if easy enough, two different approaches:

  1. If we get just a general error response from the API (i.e. the API is down), I think we should show that error message and stop the process from continuing
  2. If we get a rate limit error, ideally we would pause for a minute or two before proceeding and then try again. If it fails again with a rate limit error, maybe increase our pause by a couple minutes. Once we've tried this a few times, we can then output an error and stop the process. So basically an automatic retry mechanism with a built-in backoff mechanic to try and handle rate limit issues.

Note this last piece may be overkill for this so we can discuss whether it's worth the effort or not.

Designs

Originally documented by @dkotter:

Note that OpenAI exposes some headers around rate limits that would be interesting to use: https://platform.openai.com/docs/guides/rate-limits/rate-limits-in-headers

They also provide some examples (in python) on how to build an exponential backoff system: https://platform.openai.com/docs/guides/rate-limits/retrying-with-exponential-backoff

Describe alternatives you've considered

Originally reported via https://github.com/10up/classifai-cleanup/issues/3

Code of Conduct
  • I agree to follow this project's Code of Conduct
Lingua principale
PHP
Stelle
714
Fork
68
Merge medio
4h 32m
PR unite (30g)
23

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di 10up/classifai

Tutte le issue di 10up/classifai

Issue simili

Altre issue su PHP

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.