Hey, I am not too deep into the bedrock ai model design in spring ai but I have seen that bedrock models need special care codewise: https://github.com/spring-projects/spring-ai/tree/main/models/spring-ai-bedrock/src/main/java/org/springframework/ai/bedrock

Is it possible to add the support for the newest model Nova?

Expected Behavior

Being able to select one of the nova models (Nova Micro, Nova Lite, Nova Pro, Nova Premier) for usage in spring ai projects.

Current Behavior

As seen in the current repo state, and as stated in the documentation, nova is currently not listed as a supported ai model to work with.

Context

In the official Kotlin SDK provided by AWS it is just necessary to change the model id to use. Why is it with spring ai that complicated? Looking forward to discuss this.

Comment From: KotlinFactory

Im also very interested in support of Nova. I cannot understand why spring.ai has to be so bulky.

Comment From: DEG-7

+1

Comment From: tzolov

@Exceptionflug The essential Bedrock Nova support is already available with Spring AI 1.0.0-M4 via the Spring AI Bedrock Converse API integration.

Following the Bedrock recommendations, Spring AI is transitioning to using Amazon Bedrock's Converse API for ALL Chat conversation implementations in Spring AI.

You can consider the old, InvokerModel API-based Spring/Bedrock integrations for Chat Completion as deprecated. However, since the Converse API does not support embedding operations, these will remain in the current API, and the embedding model functionality in the existing InvokeModel API will be maintained.

Here is the list of all Converse API supported models that includes the latest Nova models as well.

So you can use the Spring AI Bedrock Converse API to connect to Nova Pro, Nova Lite, and Nova Micro like this:

<dependency>
   <groupId>org.springframework.ai</groupId>
   <artifactId>spring-ai-bedrock-converse-spring-boot-starter</artifactId>
</dependency>

application.properties :

spring.ai.bedrock.aws.region=<YOUR REGION>
spring.ai.bedrock.aws.access-key=${AWS_ACCESS_KEY_ID}
spring.ai.bedrock.aws.secret-key=${AWS_SECRET_ACCESS_KEY}
spring.ai.bedrock.aws.session-token=${AWS_SESSION_TOKEN} # only if you use temp sessions.

spring.ai.bedrock.converse.chat.options.model=amazon.nova-pro-v1:0

spring.ai.bedrock.converse.chat.options.temperature=0.8
spring.ai.bedrock.converse.chat.options.max-tokens=1000
  • Text completion:
String response = chatClient.prompt("Who are you?").call().content()
  • Text + image:
String response = chatClient.prompt()
   .user(u -> u.text("Explain what do you see on this picture?")
    .media(MimeType.valueOf("image/png"), new ClassPathResource("/test.png")))
   .call()
   .content();
  • Tool calling
record WeatherRequest(String city, String unit) { }
record WeatherResponse(int temperature, String unit) {}

String toolResponse = chatClient.prompt()
   .user("what to wear in Amsterdam today?")
   .functions(FunctionCallback.builder()
    .description("Gets current weather by city name")
    .function("getCurrentWeather", (WeatherRequest request) -> new WeatherResponse(15, request.unit()))
    .inputType(WeatherRequest.class)
    .build())
   .call()
   .content();

Finally, the https://github.com/spring-projects/spring-ai/pull/1888 will improve the multimodality support, allowing you to use the Video and Document input modalities as well.

Hope this helps!

Comment From: Exceptionflug

Thank you for your detailed response! This clarifies a lot. I will close this now since the feature is already usable via the Converse API.

Comment From: tzolov

Glad it helped. The https://github.com/spring-projects/spring-ai/pull/1888 will bring full multimodality support for Nova (e.g. video, pdf, html, md , docs, xslx ...) and improved docs.