Skip to content

Commit d6feb0f

Browse files
Sync Core Integrations API reference (amazon_bedrock) on Docusaurus (#11068)
Co-authored-by: davidsbatista <7937824+davidsbatista@users.noreply.github.com>
1 parent e1ae2f4 commit d6feb0f

File tree

11 files changed

+572
-88
lines changed

11 files changed

+572
-88
lines changed

docs-website/reference/integrations-api/amazon_bedrock.md

Lines changed: 52 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1011,8 +1011,8 @@ Prepares the body for the Llama2 model
10111011

10121012
Completes chats using LLMs hosted on Amazon Bedrock available via the Bedrock Converse API.
10131013

1014-
For example, to use the Anthropic Claude 3 Sonnet model, initialize this component with the
1015-
'anthropic.claude-3-5-sonnet-20240620-v1:0' model name.
1014+
For example, to use the Anthropic Claude 4.6 Sonnet model, initialize this component with the
1015+
'global.anthropic.claude-sonnet-4-6' model name.
10161016

10171017
**Usage example**
10181018

@@ -1025,7 +1025,7 @@ messages = [ChatMessage.from_system("\nYou are a helpful, respectful and honest
10251025
ChatMessage.from_user("What's Natural Language Processing?")]
10261026

10271027

1028-
client = AmazonBedrockChatGenerator(model="anthropic.claude-3-5-sonnet-20240620-v1:0",
1028+
client = AmazonBedrockChatGenerator(model="global.anthropic.claude-sonnet-4-6",
10291029
streaming_callback=print_streaming_chunk)
10301030
client.run(messages, generation_kwargs={"max_tokens": 512})
10311031
```
@@ -1036,7 +1036,7 @@ client.run(messages, generation_kwargs={"max_tokens": 512})
10361036
from haystack.dataclasses import ChatMessage, ImageContent
10371037
from haystack_integrations.components.generators.amazon_bedrock import AmazonBedrockChatGenerator
10381038

1039-
generator = AmazonBedrockChatGenerator(model="anthropic.claude-3-5-sonnet-20240620-v1:0")
1039+
generator = AmazonBedrockChatGenerator(model="global.anthropic.claude-sonnet-4-6")
10401040

10411041
image_content = ImageContent.from_file_path(file_path="apple.jpg")
10421042

@@ -1079,7 +1079,7 @@ weather_tool = Tool(
10791079

10801080
# Initialize generator with tool
10811081
client = AmazonBedrockChatGenerator(
1082-
model="anthropic.claude-3-5-sonnet-20240620-v1:0",
1082+
model="global.anthropic.claude-sonnet-4-6",
10831083
tools=[weather_tool]
10841084
)
10851085

@@ -1176,24 +1176,65 @@ and `aws_region_name`.
11761176

11771177
- **model** (<code>str</code>) – The model to use for text generation. The model must be available in Amazon Bedrock and must
11781178
be specified in the format outlined in the [Amazon Bedrock documentation](https://docs.aws.amazon.com/bedrock/latest/userguide/model-ids-arns.html).
1179+
11791180
- **aws_access_key_id** (<code>Secret | None</code>) – AWS access key ID.
1181+
11801182
- **aws_secret_access_key** (<code>Secret | None</code>) – AWS secret access key.
1183+
11811184
- **aws_session_token** (<code>Secret | None</code>) – AWS session token.
1185+
11821186
- **aws_region_name** (<code>Secret | None</code>) – AWS region name. Make sure the region you set supports Amazon Bedrock.
1187+
11831188
- **aws_profile_name** (<code>Secret | None</code>) – AWS profile name.
1184-
- **generation_kwargs** (<code>dict\[str, Any\] | None</code>) – Keyword arguments sent to the model. These parameters are specific to a model.
1185-
You can find the model specific arguments in the AWS Bedrock API
1186-
[documentation](https://docs.aws.amazon.com/bedrock/latest/userguide/model-parameters.html).
1189+
1190+
- **generation_kwargs** (<code>dict\[str, Any\] | None</code>) – Optional dictionary of generation parameters. Some common parameters are:
1191+
1192+
- `maxTokens`: Maximum number of tokens to generate.
1193+
1194+
- `stopSequences`: List of stop sequences to stop generation.
1195+
1196+
- `temperature`: Sampling temperature.
1197+
1198+
- `topP`: Nucleus sampling parameter.
1199+
1200+
- `response_format`: Request structured JSON output validated against a schema. Provide a dict with:
1201+
1202+
- `schema` (required): a JSON Schema dict describing the expected output structure.
1203+
- `name` (optional): a name for the schema, defaults to `"response_schema"`.
1204+
- `description` (optional): a description of the schema.
1205+
1206+
Example::
1207+
1208+
```
1209+
generation_kwargs={
1210+
"response_format": {
1211+
"name": "person",
1212+
"schema": {
1213+
"type": "object",
1214+
"properties": {"name": {"type": "string"}, "age": {"type": "integer"}},
1215+
"required": ["name", "age"],
1216+
"additionalProperties": False,
1217+
},
1218+
}
1219+
}
1220+
```
1221+
1222+
When set, the parsed JSON object is stored in `reply.meta["structured_output"]`.
1223+
You can find the model specific arguments in the AWS Bedrock API[documentation](https://docs.aws.amazon.com/bedrock/latest/userguide/model-parameters.html).
1224+
11871225
- **streaming_callback** (<code>StreamingCallbackT | None</code>) – A callback function called when a new token is received from the stream.
11881226
By default, the model is not set up for streaming. To enable streaming, set this parameter to a callback
11891227
function that handles the streaming chunks. The callback function receives a
11901228
[StreamingChunk](https://docs.haystack.deepset.ai/docs/data-classes#streamingchunk) object and switches
11911229
the streaming mode on.
1230+
11921231
- **boto3_config** (<code>dict\[str, Any\] | None</code>) – Dictionary of configuration options for the underlying Boto3 client.
11931232
Can be used to tune [retry behavior](https://docs.aws.amazon.com/boto3/latest/guide/retries.html)
11941233
and other low-level settings like timeouts and connection management.
1234+
11951235
- **tools** (<code>ToolsType | None</code>) – A list of Tool and/or Toolset objects, or a single Toolset for which the model can prepare calls.
11961236
Each tool should have a unique name.
1237+
11971238
- **guardrail_config** (<code>dict\[str, str\] | None</code>) – Optional configuration for a guardrail that has been created in Amazon Bedrock.
11981239
This must be provided as a dictionary matching either
11991240
[GuardrailConfiguration](https://docs.aws.amazon.com/bedrock/latest/APIReference/API_GuardrailConfiguration.html).
@@ -1206,6 +1247,7 @@ and `aws_region_name`.
12061247
See the
12071248
[Guardrails Streaming documentation](https://docs.aws.amazon.com/bedrock/latest/userguide/guardrails-streaming.html)
12081249
for more information.
1250+
12091251
- **tools_cachepoint_config** (<code>dict\[str, str\] | None</code>) – Optional configuration to use prompt caching for tools.
12101252
The dictionary must match the
12111253
[CachePointBlock schema](https://docs.aws.amazon.com/bedrock/latest/APIReference/API_runtime_CachePointBlock.html).
@@ -1269,6 +1311,7 @@ Supports both standard and streaming responses depending on whether a streaming
12691311
- `stopSequences`: List of stop sequences to stop generation.
12701312
- `temperature`: Sampling temperature.
12711313
- `topP`: Nucleus sampling parameter.
1314+
- `response_format`: Request structured JSON output validated against a schema.
12721315
- **tools** (<code>ToolsType | None</code>) – A list of Tool and/or Toolset objects, or a single Toolset for which the model can prepare calls.
12731316
Each tool should have a unique name.
12741317

@@ -1304,6 +1347,7 @@ Designed for use cases where non-blocking or concurrent execution is desired.
13041347
- `stopSequences`: List of stop sequences to stop generation.
13051348
- `temperature`: Sampling temperature.
13061349
- `topP`: Nucleus sampling parameter.
1350+
- `response_format`: Request structured JSON output validated against a schema.
13071351
- **tools** (<code>ToolsType | None</code>) – A list of Tool and/or Toolset objects, or a single Toolset for which the model can prepare calls.
13081352
Each tool should have a unique name.
13091353

docs-website/reference_versioned_docs/version-2.18/integrations-api/amazon_bedrock.md

Lines changed: 52 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1011,8 +1011,8 @@ Prepares the body for the Llama2 model
10111011

10121012
Completes chats using LLMs hosted on Amazon Bedrock available via the Bedrock Converse API.
10131013

1014-
For example, to use the Anthropic Claude 3 Sonnet model, initialize this component with the
1015-
'anthropic.claude-3-5-sonnet-20240620-v1:0' model name.
1014+
For example, to use the Anthropic Claude 4.6 Sonnet model, initialize this component with the
1015+
'global.anthropic.claude-sonnet-4-6' model name.
10161016

10171017
**Usage example**
10181018

@@ -1025,7 +1025,7 @@ messages = [ChatMessage.from_system("\nYou are a helpful, respectful and honest
10251025
ChatMessage.from_user("What's Natural Language Processing?")]
10261026

10271027

1028-
client = AmazonBedrockChatGenerator(model="anthropic.claude-3-5-sonnet-20240620-v1:0",
1028+
client = AmazonBedrockChatGenerator(model="global.anthropic.claude-sonnet-4-6",
10291029
streaming_callback=print_streaming_chunk)
10301030
client.run(messages, generation_kwargs={"max_tokens": 512})
10311031
```
@@ -1036,7 +1036,7 @@ client.run(messages, generation_kwargs={"max_tokens": 512})
10361036
from haystack.dataclasses import ChatMessage, ImageContent
10371037
from haystack_integrations.components.generators.amazon_bedrock import AmazonBedrockChatGenerator
10381038

1039-
generator = AmazonBedrockChatGenerator(model="anthropic.claude-3-5-sonnet-20240620-v1:0")
1039+
generator = AmazonBedrockChatGenerator(model="global.anthropic.claude-sonnet-4-6")
10401040

10411041
image_content = ImageContent.from_file_path(file_path="apple.jpg")
10421042

@@ -1079,7 +1079,7 @@ weather_tool = Tool(
10791079

10801080
# Initialize generator with tool
10811081
client = AmazonBedrockChatGenerator(
1082-
model="anthropic.claude-3-5-sonnet-20240620-v1:0",
1082+
model="global.anthropic.claude-sonnet-4-6",
10831083
tools=[weather_tool]
10841084
)
10851085

@@ -1176,24 +1176,65 @@ and `aws_region_name`.
11761176

11771177
- **model** (<code>str</code>) – The model to use for text generation. The model must be available in Amazon Bedrock and must
11781178
be specified in the format outlined in the [Amazon Bedrock documentation](https://docs.aws.amazon.com/bedrock/latest/userguide/model-ids-arns.html).
1179+
11791180
- **aws_access_key_id** (<code>Secret | None</code>) – AWS access key ID.
1181+
11801182
- **aws_secret_access_key** (<code>Secret | None</code>) – AWS secret access key.
1183+
11811184
- **aws_session_token** (<code>Secret | None</code>) – AWS session token.
1185+
11821186
- **aws_region_name** (<code>Secret | None</code>) – AWS region name. Make sure the region you set supports Amazon Bedrock.
1187+
11831188
- **aws_profile_name** (<code>Secret | None</code>) – AWS profile name.
1184-
- **generation_kwargs** (<code>dict\[str, Any\] | None</code>) – Keyword arguments sent to the model. These parameters are specific to a model.
1185-
You can find the model specific arguments in the AWS Bedrock API
1186-
[documentation](https://docs.aws.amazon.com/bedrock/latest/userguide/model-parameters.html).
1189+
1190+
- **generation_kwargs** (<code>dict\[str, Any\] | None</code>) – Optional dictionary of generation parameters. Some common parameters are:
1191+
1192+
- `maxTokens`: Maximum number of tokens to generate.
1193+
1194+
- `stopSequences`: List of stop sequences to stop generation.
1195+
1196+
- `temperature`: Sampling temperature.
1197+
1198+
- `topP`: Nucleus sampling parameter.
1199+
1200+
- `response_format`: Request structured JSON output validated against a schema. Provide a dict with:
1201+
1202+
- `schema` (required): a JSON Schema dict describing the expected output structure.
1203+
- `name` (optional): a name for the schema, defaults to `"response_schema"`.
1204+
- `description` (optional): a description of the schema.
1205+
1206+
Example::
1207+
1208+
```
1209+
generation_kwargs={
1210+
"response_format": {
1211+
"name": "person",
1212+
"schema": {
1213+
"type": "object",
1214+
"properties": {"name": {"type": "string"}, "age": {"type": "integer"}},
1215+
"required": ["name", "age"],
1216+
"additionalProperties": False,
1217+
},
1218+
}
1219+
}
1220+
```
1221+
1222+
When set, the parsed JSON object is stored in `reply.meta["structured_output"]`.
1223+
You can find the model specific arguments in the AWS Bedrock API[documentation](https://docs.aws.amazon.com/bedrock/latest/userguide/model-parameters.html).
1224+
11871225
- **streaming_callback** (<code>StreamingCallbackT | None</code>) – A callback function called when a new token is received from the stream.
11881226
By default, the model is not set up for streaming. To enable streaming, set this parameter to a callback
11891227
function that handles the streaming chunks. The callback function receives a
11901228
[StreamingChunk](https://docs.haystack.deepset.ai/docs/data-classes#streamingchunk) object and switches
11911229
the streaming mode on.
1230+
11921231
- **boto3_config** (<code>dict\[str, Any\] | None</code>) – Dictionary of configuration options for the underlying Boto3 client.
11931232
Can be used to tune [retry behavior](https://docs.aws.amazon.com/boto3/latest/guide/retries.html)
11941233
and other low-level settings like timeouts and connection management.
1234+
11951235
- **tools** (<code>ToolsType | None</code>) – A list of Tool and/or Toolset objects, or a single Toolset for which the model can prepare calls.
11961236
Each tool should have a unique name.
1237+
11971238
- **guardrail_config** (<code>dict\[str, str\] | None</code>) – Optional configuration for a guardrail that has been created in Amazon Bedrock.
11981239
This must be provided as a dictionary matching either
11991240
[GuardrailConfiguration](https://docs.aws.amazon.com/bedrock/latest/APIReference/API_GuardrailConfiguration.html).
@@ -1206,6 +1247,7 @@ and `aws_region_name`.
12061247
See the
12071248
[Guardrails Streaming documentation](https://docs.aws.amazon.com/bedrock/latest/userguide/guardrails-streaming.html)
12081249
for more information.
1250+
12091251
- **tools_cachepoint_config** (<code>dict\[str, str\] | None</code>) – Optional configuration to use prompt caching for tools.
12101252
The dictionary must match the
12111253
[CachePointBlock schema](https://docs.aws.amazon.com/bedrock/latest/APIReference/API_runtime_CachePointBlock.html).
@@ -1269,6 +1311,7 @@ Supports both standard and streaming responses depending on whether a streaming
12691311
- `stopSequences`: List of stop sequences to stop generation.
12701312
- `temperature`: Sampling temperature.
12711313
- `topP`: Nucleus sampling parameter.
1314+
- `response_format`: Request structured JSON output validated against a schema.
12721315
- **tools** (<code>ToolsType | None</code>) – A list of Tool and/or Toolset objects, or a single Toolset for which the model can prepare calls.
12731316
Each tool should have a unique name.
12741317

@@ -1304,6 +1347,7 @@ Designed for use cases where non-blocking or concurrent execution is desired.
13041347
- `stopSequences`: List of stop sequences to stop generation.
13051348
- `temperature`: Sampling temperature.
13061349
- `topP`: Nucleus sampling parameter.
1350+
- `response_format`: Request structured JSON output validated against a schema.
13071351
- **tools** (<code>ToolsType | None</code>) – A list of Tool and/or Toolset objects, or a single Toolset for which the model can prepare calls.
13081352
Each tool should have a unique name.
13091353

0 commit comments

Comments
 (0)