llama-index-llms-bedrock-converse 0.12.5__tar.gz → 0.12.6__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {llama_index_llms_bedrock_converse-0.12.5 → llama_index_llms_bedrock_converse-0.12.6}/PKG-INFO +1 -1
- {llama_index_llms_bedrock_converse-0.12.5 → llama_index_llms_bedrock_converse-0.12.6}/llama_index/llms/bedrock_converse/utils.py +31 -4
- {llama_index_llms_bedrock_converse-0.12.5 → llama_index_llms_bedrock_converse-0.12.6}/pyproject.toml +1 -1
- {llama_index_llms_bedrock_converse-0.12.5 → llama_index_llms_bedrock_converse-0.12.6}/.gitignore +0 -0
- {llama_index_llms_bedrock_converse-0.12.5 → llama_index_llms_bedrock_converse-0.12.6}/LICENSE +0 -0
- {llama_index_llms_bedrock_converse-0.12.5 → llama_index_llms_bedrock_converse-0.12.6}/README.md +0 -0
- {llama_index_llms_bedrock_converse-0.12.5 → llama_index_llms_bedrock_converse-0.12.6}/llama_index/llms/bedrock_converse/__init__.py +0 -0
- {llama_index_llms_bedrock_converse-0.12.5 → llama_index_llms_bedrock_converse-0.12.6}/llama_index/llms/bedrock_converse/base.py +0 -0
|
@@ -12,10 +12,12 @@ from typing import (
|
|
|
12
12
|
Literal,
|
|
13
13
|
Union,
|
|
14
14
|
)
|
|
15
|
+
from botocore.exceptions import ClientError
|
|
15
16
|
from typing_extensions import TypedDict
|
|
16
17
|
from tenacity import (
|
|
17
18
|
before_sleep_log,
|
|
18
19
|
retry,
|
|
20
|
+
retry_if_exception,
|
|
19
21
|
retry_if_exception_type,
|
|
20
22
|
stop_after_attempt,
|
|
21
23
|
wait_exponential,
|
|
@@ -566,11 +568,38 @@ def _create_retry_decorator(client: Any, max_retries: int) -> Callable[[Any], An
|
|
|
566
568
|
reraise=True,
|
|
567
569
|
stop=stop_after_attempt(max_retries),
|
|
568
570
|
wait=wait_exponential(multiplier=1, min=min_seconds, max=max_seconds),
|
|
569
|
-
retry=(
|
|
571
|
+
retry=(
|
|
572
|
+
retry_if_exception_type(
|
|
573
|
+
(
|
|
574
|
+
client.exceptions.ThrottlingException,
|
|
575
|
+
client.exceptions.InternalServerException,
|
|
576
|
+
client.exceptions.ServiceUnavailableException,
|
|
577
|
+
client.exceptions.ModelTimeoutException,
|
|
578
|
+
)
|
|
579
|
+
)
|
|
580
|
+
),
|
|
570
581
|
before_sleep=before_sleep_log(logger, logging.WARNING),
|
|
571
582
|
)
|
|
572
583
|
|
|
573
584
|
|
|
585
|
+
RETRYABLE_ERROR_CODES = frozenset(
|
|
586
|
+
{
|
|
587
|
+
"ThrottlingException",
|
|
588
|
+
"InternalServerException",
|
|
589
|
+
"ServiceUnavailableException",
|
|
590
|
+
"ModelTimeoutException",
|
|
591
|
+
}
|
|
592
|
+
)
|
|
593
|
+
|
|
594
|
+
|
|
595
|
+
def _is_retryable_client_error(exception: BaseException) -> bool:
|
|
596
|
+
"""Check if an exception is a retryable ClientError from botocore."""
|
|
597
|
+
if isinstance(exception, ClientError):
|
|
598
|
+
error_code = exception.response.get("Error", {}).get("Code", "")
|
|
599
|
+
return error_code in RETRYABLE_ERROR_CODES
|
|
600
|
+
return False
|
|
601
|
+
|
|
602
|
+
|
|
574
603
|
def _create_retry_decorator_async(max_retries: int) -> Callable[[Any], Any]:
|
|
575
604
|
min_seconds = 4
|
|
576
605
|
max_seconds = 10
|
|
@@ -588,9 +617,7 @@ def _create_retry_decorator_async(max_retries: int) -> Callable[[Any], Any]:
|
|
|
588
617
|
reraise=True,
|
|
589
618
|
stop=stop_after_attempt(max_retries),
|
|
590
619
|
wait=wait_exponential(multiplier=1, min=min_seconds, max=max_seconds),
|
|
591
|
-
retry=(
|
|
592
|
-
retry_if_exception_type()
|
|
593
|
-
), # TODO: Add throttling exception in async version
|
|
620
|
+
retry=retry_if_exception(_is_retryable_client_error),
|
|
594
621
|
before_sleep=before_sleep_log(logger, logging.WARNING),
|
|
595
622
|
)
|
|
596
623
|
|
{llama_index_llms_bedrock_converse-0.12.5 → llama_index_llms_bedrock_converse-0.12.6}/pyproject.toml
RENAMED
|
@@ -29,7 +29,7 @@ dev = [
|
|
|
29
29
|
|
|
30
30
|
[project]
|
|
31
31
|
name = "llama-index-llms-bedrock-converse"
|
|
32
|
-
version = "0.12.
|
|
32
|
+
version = "0.12.6"
|
|
33
33
|
description = "llama-index llms bedrock converse integration"
|
|
34
34
|
authors = [{name = "Your Name", email = "you@example.com"}]
|
|
35
35
|
requires-python = ">=3.9,<4.0"
|
{llama_index_llms_bedrock_converse-0.12.5 → llama_index_llms_bedrock_converse-0.12.6}/.gitignore
RENAMED
|
File without changes
|
{llama_index_llms_bedrock_converse-0.12.5 → llama_index_llms_bedrock_converse-0.12.6}/LICENSE
RENAMED
|
File without changes
|
{llama_index_llms_bedrock_converse-0.12.5 → llama_index_llms_bedrock_converse-0.12.6}/README.md
RENAMED
|
File without changes
|
|
File without changes
|