Skip to content

Commit 3dcb884

Browse files
committed
fix: correctly handling litellm.NotFoundError exception
1 parent f9843fa commit 3dcb884

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

nerve/generation/litellm.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,9 +82,6 @@ async def _litellm_generate(
8282
logger.warning(f"rate limit exceeded, sleeping for 5 seconds: {e}")
8383
await asyncio.sleep(5)
8484
return await self._litellm_generate(conversation, tools_schema)
85-
except litellm.AuthenticationError as e: # type: ignore
86-
logger.error(e)
87-
exit(1)
8885

8986
async def _generate(
9087
self, conversation: list[dict[str, t.Any]], tools_schema: list[dict[str, t.Any]] | None
@@ -143,6 +140,12 @@ async def _generate_next_message(
143140
completion_tokens=0,
144141
total_tokens=0,
145142
), None
143+
except litellm.AuthenticationError as e: # type: ignore
144+
logger.error(e)
145+
exit(1)
146+
except litellm.NotFoundError as e: # type: ignore
147+
logger.error(e)
148+
exit(1)
146149
except litellm.BadRequestError as e: # type: ignore
147150
logger.error(e)
148151
# logger.error(f"{traceback.format_exc()}")

0 commit comments

Comments
 (0)