-
Notifications
You must be signed in to change notification settings - Fork 5.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: improve error handling of Agent component, solves Empty Excepti…
…onWithMessageError (#6097) * Gracefully handle Errors * updates to Error handling * update in Error handling * update lint error similar to main * [autofix.ci] apply automated fixes * [autofix.ci] apply automated fixes (attempt 2/3) * feat: add max retry and request timeout to open ai component, fixes remote protocol error caused by OpenAI LLM in Agents (#6118) * update to __str__ and fix lint errors * [autofix.ci] apply automated fixes --------- Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
- Loading branch information
1 parent
9264083
commit f9e41f9
Showing
22 changed files
with
1,127 additions
and
75 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
from anthropic import BadRequestError as AnthropicBadRequestError | ||
from cohere import BadRequestError as CohereBadRequestError | ||
from httpx import HTTPStatusError | ||
|
||
from langflow.schema.message import Message | ||
|
||
|
||
class CustomBadRequestError(AnthropicBadRequestError, CohereBadRequestError, HTTPStatusError): | ||
def __init__(self, agent_message: Message | None, message: str): | ||
super().__init__(message) | ||
self.message = message | ||
self.agent_message = agent_message | ||
|
||
def __str__(self): | ||
return f"{self.message}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.