diff --git a/src/llama_cloud/_polling.py b/src/llama_cloud/_polling.py index 95f0b2a..8ac6076 100644 --- a/src/llama_cloud/_polling.py +++ b/src/llama_cloud/_polling.py @@ -12,6 +12,7 @@ T = TypeVar("T") logger = getLogger(__name__) +DEFAULT_TIMEOUT = 60.0 * 60.0 * 2.0 # 2 hours BackoffStrategy = Literal["constant", "linear", "exponential"] @@ -51,7 +52,7 @@ def poll_until_complete( *, polling_interval: float = 1.0, max_interval: float = 5.0, - timeout: float = 2000.0, + timeout: float = DEFAULT_TIMEOUT, backoff: BackoffStrategy = "linear", verbose: bool = False, ) -> T: @@ -119,7 +120,7 @@ async def poll_until_complete_async( *, polling_interval: float = 1.0, max_interval: float = 5.0, - timeout: float = 2000.0, + timeout: float = DEFAULT_TIMEOUT, backoff: BackoffStrategy = "linear", verbose: bool = False, ) -> T: diff --git a/src/llama_cloud/resources/beta/sheets.py b/src/llama_cloud/resources/beta/sheets.py index 48a216f..6a45097 100644 --- a/src/llama_cloud/resources/beta/sheets.py +++ b/src/llama_cloud/resources/beta/sheets.py @@ -11,6 +11,7 @@ from ..._utils import maybe_transform, async_maybe_transform from ..._compat import cached_property from ..._polling import ( + DEFAULT_TIMEOUT, BackoffStrategy, poll_until_complete, poll_until_complete_async, @@ -68,7 +69,7 @@ def parse( # Polling parameters polling_interval: float = 1.0, max_interval: float = 5.0, - timeout: float = 300.0, + timeout: float = DEFAULT_TIMEOUT, backoff: BackoffStrategy = "linear", verbose: bool = False, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -170,7 +171,7 @@ def wait_for_completion( project_id: Optional[str] | Omit = omit, polling_interval: float = 1.0, max_interval: float = 5.0, - timeout: float = 300.0, + timeout: float = DEFAULT_TIMEOUT, backoff: BackoffStrategy = "linear", verbose: bool = False, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -572,7 +573,7 @@ async def parse( # Polling parameters polling_interval: float = 1.0, max_interval: float = 5.0, - timeout: float = 300.0, + timeout: float = DEFAULT_TIMEOUT, backoff: BackoffStrategy = "linear", verbose: bool = False, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -674,7 +675,7 @@ async def wait_for_completion( project_id: Optional[str] | Omit = omit, polling_interval: float = 1.0, max_interval: float = 5.0, - timeout: float = 300.0, + timeout: float = DEFAULT_TIMEOUT, backoff: BackoffStrategy = "linear", verbose: bool = False, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. diff --git a/src/llama_cloud/resources/beta/split.py b/src/llama_cloud/resources/beta/split.py index ef1b8b1..02ecf16 100644 --- a/src/llama_cloud/resources/beta/split.py +++ b/src/llama_cloud/resources/beta/split.py @@ -10,6 +10,7 @@ from ..._utils import maybe_transform, async_maybe_transform from ..._compat import cached_property from ..._polling import ( + DEFAULT_TIMEOUT, BackoffStrategy, poll_until_complete, poll_until_complete_async, @@ -222,7 +223,7 @@ def split( # Polling parameters polling_interval: float = 1.0, max_interval: float = 5.0, - timeout: float = 2000.0, + timeout: float = DEFAULT_TIMEOUT, backoff: BackoffStrategy = "linear", verbose: bool = False, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -334,7 +335,7 @@ def wait_for_completion( project_id: Optional[str] | Omit = omit, polling_interval: float = 1.0, max_interval: float = 5.0, - timeout: float = 2000.0, + timeout: float = DEFAULT_TIMEOUT, backoff: BackoffStrategy = "linear", verbose: bool = False, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -634,7 +635,7 @@ async def split( # Polling parameters polling_interval: float = 1.0, max_interval: float = 5.0, - timeout: float = 2000.0, + timeout: float = DEFAULT_TIMEOUT, backoff: BackoffStrategy = "linear", verbose: bool = False, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -746,7 +747,7 @@ async def wait_for_completion( project_id: Optional[str] | Omit = omit, polling_interval: float = 1.0, max_interval: float = 5.0, - timeout: float = 2000.0, + timeout: float = DEFAULT_TIMEOUT, backoff: BackoffStrategy = "linear", verbose: bool = False, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. diff --git a/src/llama_cloud/resources/classifier/classifier.py b/src/llama_cloud/resources/classifier/classifier.py index 8a8df4b..0127108 100644 --- a/src/llama_cloud/resources/classifier/classifier.py +++ b/src/llama_cloud/resources/classifier/classifier.py @@ -15,6 +15,7 @@ from ..._types import Body, Omit, Query, Headers, SequenceNotStr, omit from ..._compat import cached_property from ..._polling import ( + DEFAULT_TIMEOUT, BackoffStrategy, poll_until_complete, poll_until_complete_async, @@ -41,7 +42,7 @@ def classify( # Polling parameters polling_interval: float = 1.0, max_interval: float = 5.0, - timeout: float = 300.0, + timeout: float = DEFAULT_TIMEOUT, backoff: BackoffStrategy = "linear", verbose: bool = False, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -163,7 +164,7 @@ def wait_for_completion( project_id: Optional[str] | Omit = omit, polling_interval: float = 1.0, max_interval: float = 5.0, - timeout: float = 300.0, + timeout: float = DEFAULT_TIMEOUT, backoff: BackoffStrategy = "linear", verbose: bool = False, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -326,7 +327,7 @@ async def classify( # Polling parameters polling_interval: float = 1.0, max_interval: float = 5.0, - timeout: float = 300.0, + timeout: float = DEFAULT_TIMEOUT, backoff: BackoffStrategy = "linear", verbose: bool = False, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -448,7 +449,7 @@ async def wait_for_completion( project_id: Optional[str] | Omit = omit, polling_interval: float = 1.0, max_interval: float = 5.0, - timeout: float = 300.0, + timeout: float = DEFAULT_TIMEOUT, backoff: BackoffStrategy = "linear", verbose: bool = False, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. diff --git a/src/llama_cloud/resources/extraction/extraction.py b/src/llama_cloud/resources/extraction/extraction.py index 9336d92..32ca766 100644 --- a/src/llama_cloud/resources/extraction/extraction.py +++ b/src/llama_cloud/resources/extraction/extraction.py @@ -26,7 +26,7 @@ from ..._types import Body, Omit, Query, Headers, NotGiven, omit, not_given from ..._utils import maybe_transform, async_maybe_transform from ..._compat import cached_property -from ..._polling import BackoffStrategy +from ..._polling import DEFAULT_TIMEOUT, BackoffStrategy from ..._resource import SyncAPIResource, AsyncAPIResource from ..._response import ( to_raw_response_wrapper, @@ -170,7 +170,7 @@ def extract( # Polling parameters polling_interval: float = 1.0, max_interval: float = 5.0, - timeout: float = 2000.0, + timeout: float = DEFAULT_TIMEOUT, backoff: BackoffStrategy = "linear", verbose: bool = False, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -407,7 +407,7 @@ async def extract( # Polling parameters polling_interval: float = 1.0, max_interval: float = 5.0, - timeout: float = 2000.0, + timeout: float = DEFAULT_TIMEOUT, backoff: BackoffStrategy = "linear", verbose: bool = False, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. diff --git a/src/llama_cloud/resources/extraction/jobs.py b/src/llama_cloud/resources/extraction/jobs.py index 0d05ee7..2a2f520 100644 --- a/src/llama_cloud/resources/extraction/jobs.py +++ b/src/llama_cloud/resources/extraction/jobs.py @@ -11,6 +11,7 @@ from ..._utils import extract_files, maybe_transform, deepcopy_minimal, async_maybe_transform from ..._compat import cached_property from ..._polling import ( + DEFAULT_TIMEOUT, BackoffStrategy, poll_until_complete, poll_until_complete_async, @@ -318,7 +319,7 @@ def extract( # Polling parameters polling_interval: float = 1.0, max_interval: float = 5.0, - timeout: float = 2000.0, + timeout: float = DEFAULT_TIMEOUT, backoff: BackoffStrategy = "linear", verbose: bool = False, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -430,7 +431,7 @@ def wait_for_completion( *, polling_interval: float = 1.0, max_interval: float = 5.0, - timeout: float = 2000.0, + timeout: float = DEFAULT_TIMEOUT, backoff: BackoffStrategy = "linear", verbose: bool = False, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -810,7 +811,7 @@ async def extract( # Polling parameters polling_interval: float = 1.0, max_interval: float = 5.0, - timeout: float = 2000.0, + timeout: float = DEFAULT_TIMEOUT, backoff: BackoffStrategy = "linear", verbose: bool = False, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -924,7 +925,7 @@ async def wait_for_completion( *, polling_interval: float = 1.0, max_interval: float = 5.0, - timeout: float = 2000.0, + timeout: float = DEFAULT_TIMEOUT, backoff: BackoffStrategy = "linear", verbose: bool = False, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. diff --git a/src/llama_cloud/resources/parsing.py b/src/llama_cloud/resources/parsing.py index b3ca15f..4f9e41f 100644 --- a/src/llama_cloud/resources/parsing.py +++ b/src/llama_cloud/resources/parsing.py @@ -13,7 +13,7 @@ from .._types import Body, Omit, Query, Headers, NotGiven, FileTypes, SequenceNotStr, omit, not_given from .._utils import maybe_transform, async_maybe_transform from .._compat import cached_property -from .._polling import BackoffStrategy, poll_until_complete, poll_until_complete_async +from .._polling import DEFAULT_TIMEOUT, BackoffStrategy, poll_until_complete, poll_until_complete_async from .._resource import SyncAPIResource, AsyncAPIResource from .._response import ( to_raw_response_wrapper, @@ -365,7 +365,7 @@ def parse( # Polling parameters polling_interval: float = 1.0, max_interval: float = 5.0, - timeout: float = 300.0, + timeout: float = DEFAULT_TIMEOUT, backoff: BackoffStrategy = "linear", verbose: bool = False, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -536,7 +536,7 @@ def wait_for_completion( project_id: Optional[str] | Omit = omit, polling_interval: float = 1.0, max_interval: float = 5.0, - timeout: float = 300.0, + timeout: float = DEFAULT_TIMEOUT, backoff: BackoffStrategy = "linear", verbose: bool = False, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -984,7 +984,7 @@ async def parse( # Polling parameters polling_interval: float = 1.0, max_interval: float = 5.0, - timeout: float = 300.0, + timeout: float = DEFAULT_TIMEOUT, backoff: BackoffStrategy = "linear", verbose: bool = False, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -1155,7 +1155,7 @@ async def wait_for_completion( project_id: Optional[str] | Omit = omit, polling_interval: float = 1.0, max_interval: float = 5.0, - timeout: float = 300.0, + timeout: float = DEFAULT_TIMEOUT, backoff: BackoffStrategy = "linear", verbose: bool = False, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.