Spaces:
Running
Running
zach
commited on
Commit
·
fa43e81
1
Parent(s):
c0b34a2
Add minor improvement to Anthropic exception
Browse files
src/integrations/anthropic_api.py
CHANGED
|
@@ -21,7 +21,8 @@ Functions:
|
|
| 21 |
|
| 22 |
# Standard Library Imports
|
| 23 |
from dataclasses import dataclass
|
| 24 |
-
|
|
|
|
| 25 |
# Third-Party Library Imports
|
| 26 |
from anthropic import Anthropic
|
| 27 |
from anthropic.types import Message, ModelParam, TextBlock
|
|
@@ -82,7 +83,7 @@ Always keep your responses concise, unless explicitly instructed to elaborate.""
|
|
| 82 |
|
| 83 |
class AnthropicError(Exception):
|
| 84 |
"""Custom exception for errors related to the Anthropic API."""
|
| 85 |
-
def __init__(self, message: str, original_exception: Exception = None):
|
| 86 |
super().__init__(message)
|
| 87 |
self.original_exception = original_exception
|
| 88 |
|
|
|
|
| 21 |
|
| 22 |
# Standard Library Imports
|
| 23 |
from dataclasses import dataclass
|
| 24 |
+
import logging
|
| 25 |
+
from typing import List, Optional, Union
|
| 26 |
# Third-Party Library Imports
|
| 27 |
from anthropic import Anthropic
|
| 28 |
from anthropic.types import Message, ModelParam, TextBlock
|
|
|
|
| 83 |
|
| 84 |
class AnthropicError(Exception):
|
| 85 |
"""Custom exception for errors related to the Anthropic API."""
|
| 86 |
+
def __init__(self, message: str, original_exception: Optional[Exception] = None):
|
| 87 |
super().__init__(message)
|
| 88 |
self.original_exception = original_exception
|
| 89 |
|