Skip to content

Commit

Permalink
Update openai_tools.py to use delay (#159)
Browse files Browse the repository at this point in the history
* Update openai_tools.py

Updated to use the 'delay'

* also use delay instead of 62 in async completions
  • Loading branch information
tractorjuice authored Nov 3, 2023
1 parent 319bb50 commit a65224c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions memgpt/openai_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def wrapper(*args, **kwargs):
delay *= exponential_base * (1 + jitter * random.random())

# Sleep for the delay
time.sleep(62)
time.sleep(delay)

# Raise exceptions for any errors not specified
except Exception as e:
Expand Down Expand Up @@ -108,7 +108,7 @@ async def wrapper(*args, **kwargs):
delay *= exponential_base * (1 + jitter * random.random())

# Sleep for the delay
await asyncio.sleep(62)
await asyncio.sleep(delay)

# Raise exceptions for any errors not specified
except Exception as e:
Expand Down

0 comments on commit a65224c

Please sign in to comment.