We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 75bcf6e commit 7cb5067Copy full SHA for 7cb5067
nerve/generation/litellm.py
@@ -1,3 +1,4 @@
1
+import asyncio
2
import json
3
import traceback
4
import typing as t
@@ -77,6 +78,10 @@ async def _litellm_generate(
77
78
total_tokens=response.usage.total_tokens,
79
cost=response._hidden_params.get("response_cost", None),
80
), response.choices[0].message
81
+ except litellm.RateLimitError as e: # type: ignore
82
+ logger.warning(f"rate limit exceeded, sleeping for 3 seconds: {e}")
83
+ await asyncio.sleep(3)
84
+ return await self._litellm_generate(conversation, tools_schema)
85
except litellm.AuthenticationError as e: # type: ignore
86
logger.error(e)
87
exit(1)
0 commit comments