refactor: Update AnthropicModelComponent to handle ImportError gracefully
This commit is contained in:
parent
ac627e831f
commit
6b3a8b69bc
1 changed files with 2 additions and 2 deletions
|
|
@ -98,9 +98,9 @@ class AnthropicModelComponent(LCModelComponent):
|
|||
try:
|
||||
from anthropic import BadRequestError
|
||||
except ImportError:
|
||||
return
|
||||
return None
|
||||
if isinstance(exception, BadRequestError):
|
||||
message = exception.body.get("error", {}).get("message") # type: ignore
|
||||
if message:
|
||||
return message
|
||||
return
|
||||
return None
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue