llama-index-llms-bedrock-converse 0.10.4__tar.gz → 0.10.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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: llama-index-llms-bedrock-converse
3
- Version: 0.10.4
3
+ Version: 0.10.6
4
4
  Summary: llama-index llms bedrock converse integration
5
5
  Author-email: Your Name <you@example.com>
6
6
  License-Expression: MIT
@@ -167,6 +167,10 @@ class BedrockConverse(FunctionCallingLLM):
167
167
  description="Specifies the thinking configuration of a reasoning model. Only applicable to Anthropic and DeepSeek models",
168
168
  default=None,
169
169
  )
170
+ supports_forced_tool_calls: bool = Field(
171
+ default=True,
172
+ description="Whether the model supports forced tool calls. If True, the model can be forced to call at least 1 or more tools.",
173
+ )
170
174
  additional_kwargs: Dict[str, Any] = Field(
171
175
  default_factory=dict,
172
176
  description="Additional kwargs for the bedrock invokeModel request.",
@@ -210,6 +214,7 @@ class BedrockConverse(FunctionCallingLLM):
210
214
  application_inference_profile_arn: Optional[str] = None,
211
215
  trace: Optional[str] = None,
212
216
  thinking: Optional[ThinkingDict] = None,
217
+ supports_forced_tool_calls: bool = True,
213
218
  ) -> None:
214
219
  additional_kwargs = additional_kwargs or {}
215
220
  callback_manager = callback_manager or CallbackManager([])
@@ -261,6 +266,7 @@ class BedrockConverse(FunctionCallingLLM):
261
266
  application_inference_profile_arn=application_inference_profile_arn,
262
267
  trace=trace,
263
268
  thinking=thinking,
269
+ supports_forced_tool_calls=supports_forced_tool_calls,
264
270
  )
265
271
 
266
272
  self._config = None
@@ -913,6 +919,7 @@ class BedrockConverse(FunctionCallingLLM):
913
919
  tool_choice=tool_choice,
914
920
  tool_required=tool_required,
915
921
  tool_caching=tool_caching,
922
+ supports_forced_tool_calls=self.supports_forced_tool_calls,
916
923
  )
917
924
 
918
925
  return {
@@ -63,6 +63,7 @@ BEDROCK_MODELS = {
63
63
  "anthropic.claude-opus-4-1-20250805-v1:0": 200000,
64
64
  "anthropic.claude-sonnet-4-20250514-v1:0": 200000,
65
65
  "anthropic.claude-sonnet-4-5-20250929-v1:0": 200000,
66
+ "anthropic.claude-haiku-4-5-20251001-v1:0": 200000,
66
67
  "ai21.j2-mid-v1": 8192,
67
68
  "ai21.j2-ultra-v1": 8192,
68
69
  "cohere.command-text-v14": 4096,
@@ -110,6 +111,7 @@ BEDROCK_FUNCTION_CALLING_MODELS = (
110
111
  "anthropic.claude-opus-4-1-20250805-v1:0",
111
112
  "anthropic.claude-sonnet-4-20250514-v1:0",
112
113
  "anthropic.claude-sonnet-4-5-20250929-v1:0",
114
+ "anthropic.claude-haiku-4-5-20251001-v1:0",
113
115
  "cohere.command-r-v1:0",
114
116
  "cohere.command-r-plus-v1:0",
115
117
  "mistral.mistral-large-2402-v1:0",
@@ -141,6 +143,7 @@ BEDROCK_INFERENCE_PROFILE_SUPPORTED_MODELS = (
141
143
  "anthropic.claude-opus-4-1-20250805-v1:0",
142
144
  "anthropic.claude-sonnet-4-20250514-v1:0",
143
145
  "anthropic.claude-sonnet-4-5-20250929-v1:0",
146
+ "anthropic.claude-haiku-4-5-20251001-v1:0",
144
147
  "meta.llama3-1-8b-instruct-v1:0",
145
148
  "meta.llama3-1-70b-instruct-v1:0",
146
149
  "meta.llama3-2-1b-instruct-v1:0",
@@ -160,6 +163,7 @@ BEDROCK_PROMPT_CACHING_SUPPORTED_MODELS = (
160
163
  "anthropic.claude-opus-4-1-20250805-v1:0",
161
164
  "anthropic.claude-sonnet-4-20250514-v1:0",
162
165
  "anthropic.claude-sonnet-4-5-20250929-v1:0",
166
+ "anthropic.claude-haiku-4-5-20251001-v1:0",
163
167
  "amazon.nova-premier-v1:0",
164
168
  "amazon.nova-pro-v1:0",
165
169
  "amazon.nova-lite-v1:0",
@@ -172,6 +176,7 @@ BEDROCK_REASONING_MODELS = (
172
176
  "anthropic.claude-opus-4-1-20250805-v1:0",
173
177
  "anthropic.claude-sonnet-4-20250514-v1:0",
174
178
  "anthropic.claude-sonnet-4-5-20250929-v1:0",
179
+ "anthropic.claude-haiku-4-5-20251001-v1:0",
175
180
  "deepseek.r1-v1:0",
176
181
  )
177
182
 
@@ -449,6 +454,7 @@ def tools_to_converse_tools(
449
454
  tool_choice: Optional[dict] = None,
450
455
  tool_required: bool = False,
451
456
  tool_caching: bool = False,
457
+ supports_forced_tool_calls: bool = True,
452
458
  ) -> Dict[str, Any]:
453
459
  """
454
460
  Converts a list of tools to AWS Bedrock Converse tools.
@@ -477,11 +483,18 @@ def tools_to_converse_tools(
477
483
  if tool_caching:
478
484
  converse_tools.append({"cachePoint": {"type": "default"}})
479
485
 
486
+ if tool_choice:
487
+ tool_choice = tool_choice
488
+ elif supports_forced_tool_calls and tool_required:
489
+ tool_choice = {"any": {}}
490
+ else:
491
+ tool_choice = {"auto": {}}
492
+
480
493
  return {
481
494
  "tools": converse_tools,
482
495
  # https://docs.aws.amazon.com/bedrock/latest/APIReference/API_runtime_ToolChoice.html
483
496
  # e.g. { "auto": {} }
484
- "toolChoice": tool_choice or ({"any": {}} if tool_required else {"auto": {}}),
497
+ "toolChoice": tool_choice,
485
498
  }
486
499
 
487
500
 
@@ -29,7 +29,7 @@ dev = [
29
29
 
30
30
  [project]
31
31
  name = "llama-index-llms-bedrock-converse"
32
- version = "0.10.4"
32
+ version = "0.10.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"