llama-index-llms-bedrock-converse 0.12.5__tar.gz → 0.12.7__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.7}/PKG-INFO +1 -1
- {llama_index_llms_bedrock_converse-0.12.5 → llama_index_llms_bedrock_converse-0.12.7}/llama_index/llms/bedrock_converse/utils.py +50 -19
- {llama_index_llms_bedrock_converse-0.12.5 → llama_index_llms_bedrock_converse-0.12.7}/pyproject.toml +1 -1
- {llama_index_llms_bedrock_converse-0.12.5 → llama_index_llms_bedrock_converse-0.12.7}/.gitignore +0 -0
- {llama_index_llms_bedrock_converse-0.12.5 → llama_index_llms_bedrock_converse-0.12.7}/LICENSE +0 -0
- {llama_index_llms_bedrock_converse-0.12.5 → llama_index_llms_bedrock_converse-0.12.7}/README.md +0 -0
- {llama_index_llms_bedrock_converse-0.12.5 → llama_index_llms_bedrock_converse-0.12.7}/llama_index/llms/bedrock_converse/__init__.py +0 -0
- {llama_index_llms_bedrock_converse-0.12.5 → llama_index_llms_bedrock_converse-0.12.7}/llama_index/llms/bedrock_converse/base.py +0 -0
|
@@ -6,35 +6,36 @@ from typing import (
|
|
|
6
6
|
Callable,
|
|
7
7
|
Dict,
|
|
8
8
|
List,
|
|
9
|
+
Literal,
|
|
9
10
|
Optional,
|
|
10
11
|
Sequence,
|
|
11
12
|
Tuple,
|
|
12
|
-
Literal,
|
|
13
13
|
Union,
|
|
14
14
|
)
|
|
15
|
-
from typing_extensions import TypedDict
|
|
16
|
-
from tenacity import (
|
|
17
|
-
before_sleep_log,
|
|
18
|
-
retry,
|
|
19
|
-
retry_if_exception_type,
|
|
20
|
-
stop_after_attempt,
|
|
21
|
-
wait_exponential,
|
|
22
|
-
)
|
|
23
15
|
|
|
16
|
+
from botocore.exceptions import ClientError
|
|
24
17
|
from llama_index.core.base.llms.types import (
|
|
18
|
+
AudioBlock,
|
|
19
|
+
CachePoint,
|
|
25
20
|
ChatMessage,
|
|
26
21
|
ChatResponse,
|
|
27
|
-
MessageRole,
|
|
28
|
-
ImageBlock,
|
|
29
|
-
TextBlock,
|
|
30
22
|
ContentBlock,
|
|
31
|
-
AudioBlock,
|
|
32
23
|
DocumentBlock,
|
|
33
|
-
|
|
24
|
+
ImageBlock,
|
|
25
|
+
MessageRole,
|
|
26
|
+
TextBlock,
|
|
34
27
|
ThinkingBlock,
|
|
35
28
|
ToolCallBlock,
|
|
36
29
|
)
|
|
37
|
-
|
|
30
|
+
from tenacity import (
|
|
31
|
+
before_sleep_log,
|
|
32
|
+
retry,
|
|
33
|
+
retry_if_exception,
|
|
34
|
+
retry_if_exception_type,
|
|
35
|
+
stop_after_attempt,
|
|
36
|
+
wait_exponential,
|
|
37
|
+
)
|
|
38
|
+
from typing_extensions import TypedDict
|
|
38
39
|
|
|
39
40
|
logger = logging.getLogger(__name__)
|
|
40
41
|
|
|
@@ -63,6 +64,7 @@ BEDROCK_MODELS = {
|
|
|
63
64
|
"anthropic.claude-opus-4-20250514-v1:0": 200000,
|
|
64
65
|
"anthropic.claude-opus-4-1-20250805-v1:0": 200000,
|
|
65
66
|
"anthropic.claude-opus-4-5-20251101-v1:0": 200000,
|
|
67
|
+
"anthropic.claude-opus-4-6-v1": 200000,
|
|
66
68
|
"anthropic.claude-sonnet-4-20250514-v1:0": 200000,
|
|
67
69
|
"anthropic.claude-sonnet-4-5-20250929-v1:0": 200000,
|
|
68
70
|
"anthropic.claude-haiku-4-5-20251001-v1:0": 200000,
|
|
@@ -112,6 +114,7 @@ BEDROCK_FUNCTION_CALLING_MODELS = (
|
|
|
112
114
|
"anthropic.claude-opus-4-20250514-v1:0",
|
|
113
115
|
"anthropic.claude-opus-4-1-20250805-v1:0",
|
|
114
116
|
"anthropic.claude-opus-4-5-20251101-v1:0",
|
|
117
|
+
"anthropic.claude-opus-4-6-v1",
|
|
115
118
|
"anthropic.claude-sonnet-4-20250514-v1:0",
|
|
116
119
|
"anthropic.claude-sonnet-4-5-20250929-v1:0",
|
|
117
120
|
"anthropic.claude-haiku-4-5-20251001-v1:0",
|
|
@@ -145,6 +148,7 @@ BEDROCK_INFERENCE_PROFILE_SUPPORTED_MODELS = (
|
|
|
145
148
|
"anthropic.claude-opus-4-20250514-v1:0",
|
|
146
149
|
"anthropic.claude-opus-4-1-20250805-v1:0",
|
|
147
150
|
"anthropic.claude-opus-4-5-20251101-v1:0",
|
|
151
|
+
"anthropic.claude-opus-4-6-v1",
|
|
148
152
|
"anthropic.claude-sonnet-4-20250514-v1:0",
|
|
149
153
|
"anthropic.claude-sonnet-4-5-20250929-v1:0",
|
|
150
154
|
"anthropic.claude-haiku-4-5-20251001-v1:0",
|
|
@@ -166,6 +170,7 @@ BEDROCK_PROMPT_CACHING_SUPPORTED_MODELS = (
|
|
|
166
170
|
"anthropic.claude-opus-4-20250514-v1:0",
|
|
167
171
|
"anthropic.claude-opus-4-1-20250805-v1:0",
|
|
168
172
|
"anthropic.claude-opus-4-5-20251101-v1:0",
|
|
173
|
+
"anthropic.claude-opus-4-6-v1",
|
|
169
174
|
"anthropic.claude-sonnet-4-20250514-v1:0",
|
|
170
175
|
"anthropic.claude-sonnet-4-5-20250929-v1:0",
|
|
171
176
|
"anthropic.claude-haiku-4-5-20251001-v1:0",
|
|
@@ -180,6 +185,7 @@ BEDROCK_REASONING_MODELS = (
|
|
|
180
185
|
"anthropic.claude-opus-4-20250514-v1:0",
|
|
181
186
|
"anthropic.claude-opus-4-1-20250805-v1:0",
|
|
182
187
|
"anthropic.claude-opus-4-5-20251101-v1:0",
|
|
188
|
+
"anthropic.claude-opus-4-6-v1",
|
|
183
189
|
"anthropic.claude-sonnet-4-20250514-v1:0",
|
|
184
190
|
"anthropic.claude-sonnet-4-5-20250929-v1:0",
|
|
185
191
|
"anthropic.claude-haiku-4-5-20251001-v1:0",
|
|
@@ -566,11 +572,38 @@ def _create_retry_decorator(client: Any, max_retries: int) -> Callable[[Any], An
|
|
|
566
572
|
reraise=True,
|
|
567
573
|
stop=stop_after_attempt(max_retries),
|
|
568
574
|
wait=wait_exponential(multiplier=1, min=min_seconds, max=max_seconds),
|
|
569
|
-
retry=(
|
|
575
|
+
retry=(
|
|
576
|
+
retry_if_exception_type(
|
|
577
|
+
(
|
|
578
|
+
client.exceptions.ThrottlingException,
|
|
579
|
+
client.exceptions.InternalServerException,
|
|
580
|
+
client.exceptions.ServiceUnavailableException,
|
|
581
|
+
client.exceptions.ModelTimeoutException,
|
|
582
|
+
)
|
|
583
|
+
)
|
|
584
|
+
),
|
|
570
585
|
before_sleep=before_sleep_log(logger, logging.WARNING),
|
|
571
586
|
)
|
|
572
587
|
|
|
573
588
|
|
|
589
|
+
RETRYABLE_ERROR_CODES = frozenset(
|
|
590
|
+
{
|
|
591
|
+
"ThrottlingException",
|
|
592
|
+
"InternalServerException",
|
|
593
|
+
"ServiceUnavailableException",
|
|
594
|
+
"ModelTimeoutException",
|
|
595
|
+
}
|
|
596
|
+
)
|
|
597
|
+
|
|
598
|
+
|
|
599
|
+
def _is_retryable_client_error(exception: BaseException) -> bool:
|
|
600
|
+
"""Check if an exception is a retryable ClientError from botocore."""
|
|
601
|
+
if isinstance(exception, ClientError):
|
|
602
|
+
error_code = exception.response.get("Error", {}).get("Code", "")
|
|
603
|
+
return error_code in RETRYABLE_ERROR_CODES
|
|
604
|
+
return False
|
|
605
|
+
|
|
606
|
+
|
|
574
607
|
def _create_retry_decorator_async(max_retries: int) -> Callable[[Any], Any]:
|
|
575
608
|
min_seconds = 4
|
|
576
609
|
max_seconds = 10
|
|
@@ -588,9 +621,7 @@ def _create_retry_decorator_async(max_retries: int) -> Callable[[Any], Any]:
|
|
|
588
621
|
reraise=True,
|
|
589
622
|
stop=stop_after_attempt(max_retries),
|
|
590
623
|
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
|
|
624
|
+
retry=retry_if_exception(_is_retryable_client_error),
|
|
594
625
|
before_sleep=before_sleep_log(logger, logging.WARNING),
|
|
595
626
|
)
|
|
596
627
|
|
{llama_index_llms_bedrock_converse-0.12.5 → llama_index_llms_bedrock_converse-0.12.7}/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.7"
|
|
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.7}/.gitignore
RENAMED
|
File without changes
|
{llama_index_llms_bedrock_converse-0.12.5 → llama_index_llms_bedrock_converse-0.12.7}/LICENSE
RENAMED
|
File without changes
|
{llama_index_llms_bedrock_converse-0.12.5 → llama_index_llms_bedrock_converse-0.12.7}/README.md
RENAMED
|
File without changes
|
|
File without changes
|