MaartenGr / MaartenGr/BERTopic
Retry strategies for OpenAI RateLimitError
- Dominant language
- Python
- Stars
- 7.8k
- Forks
- 920
- Avg merge
- 22h 24m
- Merged PRs (30d)
- 5
Description
For my representation model
```python
bertopic.representation.OpenAI(
model="gpt-35-turbo",
chat=True,
#delay_in_seconds=1,
generator_kwargs = {"engine": "gpt-35-turbo", "temperature": 0.1},
prompt=f"""
Output a concise, English, lowercase topic label for the following keywords. Output only the label, no punctuation. Prefer single terms. If you are unable to perform the task, output: None.
[KEYWORDS]
"""
)
```
I am sometimes hitting a RateLimitError without exactly knowing what causes it (seems to happen when training on larger datasets of > 100 000 documents).
Setting a waiting time of even one second between API calls increases the training time several times (not sure why).
- Would a different strategy be possible that catches a RateLimitError when it occurs and then adapts?
- If the RateLimitError is predictable (e.g. depending on dataset size) - is it avoidable?
Contributor guide
Research direction
Start at the bertopic.representation.OpenAI entry point described in the issue and trace how API calls behave when a RateLimitError occurs. Define and implement an adaptive retry strategy, with completion shown by handling rate limits during large-dataset training without requiring a fixed one-second delay.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- api, machine-learning
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100