Spaces:
Running
Running
zach
commited on
Commit
·
a5cafbd
1
Parent(s):
30c882f
Add additional logging for retries in Anthropic and Hume integrations
Browse files
src/integrations/anthropic_api.py
CHANGED
@@ -91,7 +91,12 @@ class AnthropicError(Exception):
|
|
91 |
anthropic_config = AnthropicConfig()
|
92 |
|
93 |
|
94 |
-
@retry(
|
|
|
|
|
|
|
|
|
|
|
95 |
def generate_text_with_claude(prompt: str) -> str:
|
96 |
"""
|
97 |
Generates text using Claude via the Anthropic SDK.
|
|
|
91 |
anthropic_config = AnthropicConfig()
|
92 |
|
93 |
|
94 |
+
@retry(
|
95 |
+
stop=stop_after_attempt(3),
|
96 |
+
wait=wait_fixed(2),
|
97 |
+
before=before_log(logger, logging.DEBUG),
|
98 |
+
after=after_log(logger, logging.DEBUG),
|
99 |
+
)
|
100 |
def generate_text_with_claude(prompt: str) -> str:
|
101 |
"""
|
102 |
Generates text using Claude via the Anthropic SDK.
|
src/integrations/hume_api.py
CHANGED
@@ -58,7 +58,12 @@ class HumeException(Exception):
|
|
58 |
hume_config = HumeConfig()
|
59 |
|
60 |
|
61 |
-
@retry(
|
|
|
|
|
|
|
|
|
|
|
62 |
def text_to_speech_with_hume(prompt: str, text: str) -> bytes:
|
63 |
"""
|
64 |
Converts text to speech using the Hume TTS API and processes raw binary audio data.
|
|
|
58 |
hume_config = HumeConfig()
|
59 |
|
60 |
|
61 |
+
@retry(
|
62 |
+
stop=stop_after_attempt(3),
|
63 |
+
wait=wait_fixed(2),
|
64 |
+
before=before_log(logger, logging.DEBUG),
|
65 |
+
after=after_log(logger, logging.DEBUG),
|
66 |
+
)
|
67 |
def text_to_speech_with_hume(prompt: str, text: str) -> bytes:
|
68 |
"""
|
69 |
Converts text to speech using the Hume TTS API and processes raw binary audio data.
|