Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/llama_cloud/_polling.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"]


Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down
9 changes: 5 additions & 4 deletions src/llama_cloud/resources/beta/sheets.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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.
Expand Down
9 changes: 5 additions & 4 deletions src/llama_cloud/resources/beta/split.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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.
Expand Down
9 changes: 5 additions & 4 deletions src/llama_cloud/resources/classifier/classifier.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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.
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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.
Expand Down
6 changes: 3 additions & 3 deletions src/llama_cloud/resources/extraction/extraction.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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.
Expand Down
9 changes: 5 additions & 4 deletions src/llama_cloud/resources/extraction/jobs.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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.
Expand Down
10 changes: 5 additions & 5 deletions src/llama_cloud/resources/parsing.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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.
Expand Down