|
11 | 11 | from typing import TYPE_CHECKING, Any, Union |
12 | 12 | from warnings import warn |
13 | 13 |
|
| 14 | +import anthropic |
14 | 15 | import numpy as np |
15 | 16 | import openai |
16 | | -import anthropic |
17 | 17 | import tiktoken |
18 | 18 | import yaml |
19 | 19 | from langchain.schema import BaseMessage |
@@ -99,9 +99,9 @@ def generic_call_api_with_retries( |
99 | 99 | rate_limit_exceptions, |
100 | 100 | api_error_exceptions, |
101 | 101 | get_status_code_fn=None, |
102 | | - max_retries=5, |
103 | | - initial_retry_delay_seconds=1, |
104 | | - max_retry_delay_seconds=60, |
| 102 | + max_retries=10, |
| 103 | + initial_retry_delay_seconds=20, |
| 104 | + max_retry_delay_seconds=60 * 5, |
105 | 105 | ): |
106 | 106 | """ |
107 | 107 | Makes an API call with retries for transient failures, rate limiting, |
@@ -226,7 +226,7 @@ def _handle_api_error(e, attempt): |
226 | 226 | raise RuntimeError(f"API call failed after {max_retries} retries.") |
227 | 227 |
|
228 | 228 |
|
229 | | -def call_openai_api_with_retries(client_function, api_params, max_retries=5): |
| 229 | +def call_openai_api_with_retries(client_function, api_params, max_retries=10): |
230 | 230 | """ |
231 | 231 | Makes an OpenAI API call with retries for transient failures, |
232 | 232 | rate limiting, and invalid or error-containing responses. |
@@ -261,7 +261,7 @@ def get_openai_status_code(exception): |
261 | 261 | ) |
262 | 262 |
|
263 | 263 |
|
264 | | -def call_anthropic_api_with_retries(client_function, api_params, max_retries=5): |
| 264 | +def call_anthropic_api_with_retries(client_function, api_params, max_retries=10): |
265 | 265 | """ |
266 | 266 | Makes an Anthropic API call with retries for transient failures, |
267 | 267 | rate limiting, and invalid responses. |
|
0 commit comments