Spaces:
Sleeping
Sleeping
import logging | |
import httpx | |
from tenacity import retry, stop_after_attempt, wait_exponential, retry_if_exception_type | |
logger = logging.getLogger(__name__) | |
RETRYABLE_EXCEPTIONS = ( | |
httpx.TimeoutException, | |
httpx.NetworkError, | |
) | |
def call_llm_with_retry(llm, program): | |
""" | |
Executes a guidance program with a given LLM, with retry logic. | |
The program is called with the llm, i.e., program(llm). | |
""" | |
return program(llm) | |