| 
1 | 1 | = Bedrock Converse API  | 
2 | 2 | 
 
  | 
3 |  | -link:https://docs.aws.amazon.com/bedrock/latest/userguide/conversation-inference.html[Amazon Bedrock] Converse API provides a unified interface for conversational AI models with enhanced capabilities including function/tool calling, multimodal inputs, and streaming responses.  | 
 | 3 | +link:https://docs.aws.amazon.com/bedrock/latest/userguide/conversation-inference.html[Amazon Bedrock Converse API] provides a unified interface for conversational AI models with enhanced capabilities including function/tool calling, multimodal inputs, and streaming responses.  | 
4 | 4 | 
 
  | 
5 | 5 | The Bedrock Converse API has the following high-level features:  | 
6 | 6 | 
 
  | 
7 | 7 | * Tool/Function Calling: Support for function definitions and tool use during conversations  | 
8 | 8 | * Multimodal Input: Ability to process both text and image inputs in conversations  | 
9 | 9 | * Streaming Support: Real-time streaming of model responses  | 
10 | 10 | * System Messages: Support for system-level instructions and context setting  | 
11 |  | -* Metrics Integration: Built-in support for observation and metrics tracking  | 
12 |  | -
  | 
13 |  | -The https://docs.aws.amazon.com/bedrock/latest/userguide/what-is-bedrock.html[Amazon Bedrock User Guide] contains detailed information on how to use the AWS hosted service.  | 
 | 11 | +// * Metrics Integration: Built-in support for observation and metrics tracking  | 
14 | 12 | 
  | 
15 | 13 | TIP: The Bedrock Converse API provides a unified interface across multiple model providers while handling AWS-specific authentication and infrastructure concerns.  | 
16 | 14 | 
 
  | 
 | 15 | +[NOTE]  | 
 | 16 | +====  | 
 | 17 | +Following the Bedrock recommendations, Spring AI is transitioning to using Amazon Bedrock's Converse API for all chat conversation implementations in Spring AI.   | 
 | 18 | +While the existing `InvokeModel API` supports conversation applications, we strongly recommend adopting the Converse API for several key benefits:  | 
 | 19 | +
  | 
 | 20 | +- Unified Interface: Write your code once and use it with any supported Amazon Bedrock model  | 
 | 21 | +- Model Flexibility: Seamlessly switch between different conversation models without code changes  | 
 | 22 | +- Extended Functionality: Support for model-specific parameters through dedicated structures  | 
 | 23 | +- Tool Support: Native integration with function calling and tool usage capabilities  | 
 | 24 | +- Multimodal Capabilities: Built-in support for vision and other multimodal features  | 
 | 25 | +- Future-Proof: Aligned with Amazon Bedrock's recommended best practices  | 
 | 26 | +
  | 
 | 27 | +The Converse API does not support embedding operations, so these will remain in the current API and the embedding model functionality in the existing `InvokeModel API` will be maintained  | 
 | 28 | +====  | 
 | 29 | + | 
17 | 30 | == Prerequisites  | 
18 | 31 | 
 
  | 
19 |  | -Refer to the xref:api/bedrock.adoc[Spring AI documentation on Amazon Bedrock] for setting up API access.  | 
 | 32 | +Refer to https://docs.aws.amazon.com/bedrock/latest/userguide/getting-started.html[Getting started with Amazon Bedrock] for setting up API access  | 
20 | 33 | 
 
  | 
21 | 34 | * Obtain AWS credentials: If you don't have an AWS account and AWS CLI configured yet, this video guide can help you configure it: link:https://youtu.be/gswVHTrRX8I?si=buaY7aeI0l3-bBVb[AWS CLI & SDK Setup in Less Than 4 Minutes!]. You should be able to obtain your access and security keys.  | 
22 | 35 | 
 
  | 
@@ -74,7 +87,7 @@ The prefix `spring.ai.bedrock.converse.chat` is the property prefix that configu  | 
74 | 87 | | Property | Description | Default  | 
75 | 88 | 
 
  | 
76 | 89 | | spring.ai.bedrock.converse.chat.enabled | Enable Bedrock Converse chat model. | true  | 
77 |  | -| spring.ai.bedrock.converse.chat.options.model | The model ID to use. You can use the https://docs.aws.amazon.com/bedrock/latest/userguide/conversation-inference-supported-models-features.html[Supported models and model features]  | anthropic.claude-3-sonnet-20240229-v1:0  | 
 | 90 | +| spring.ai.bedrock.converse.chat.options.model | The model ID to use. You can use the https://docs.aws.amazon.com/bedrock/latest/userguide/conversation-inference-supported-models-features.html[Supported models and model features]  | None. Select your https://us-east-1.console.aws.amazon.com/bedrock/home?region=us-east-1#/models[modelId] from the AWS Bedrock console.  | 
78 | 91 | | spring.ai.bedrock.converse.chat.options.temperature | Controls the randomness of the output. Values can range over [0.0,1.0] | 0.8  | 
79 | 92 | | spring.ai.bedrock.converse.chat.options.top-p | The maximum cumulative probability of tokens to consider when sampling. | AWS Bedrock default  | 
80 | 93 | | spring.ai.bedrock.converse.chat.options.top-k | Number of token choices for generating the next token. | AWS Bedrock default  | 
@@ -135,6 +148,8 @@ spring.ai.bedrock.aws.region=eu-central-1  | 
135 | 148 | spring.ai.bedrock.aws.timeout=10m  | 
136 | 149 | spring.ai.bedrock.aws.access-key=${AWS_ACCESS_KEY_ID}  | 
137 | 150 | spring.ai.bedrock.aws.secret-key=${AWS_SECRET_ACCESS_KEY}  | 
 | 151 | +# session token is only required for temporary credentials  | 
 | 152 | +spring.ai.bedrock.aws.session-token=${AWS_SESSION_TOKEN}  | 
138 | 153 | 
  | 
139 | 154 | spring.ai.bedrock.converse.chat.options.temperature=0.8  | 
140 | 155 | spring.ai.bedrock.converse.chat.options.top-k=15  | 
 | 
0 commit comments