Comment From: tzolov
@hemeda3, great to see your contribution!
We'll try to review as a part of 1.0.0-M1. In the mean time you can: - add the autoconfiguration class to the org.springframework.boot.autoconfigure.AutoConfiguration.imports
- add the required dependencies to the BOM: https://github.com/spring-projects/spring-ai/blob/main/spring-ai-bom/pom.xml
- and add documentation reference to the https://github.com/spring-projects/spring-ai/tree/main/spring-ai-docs/src/main/antora/modules/ROOT/pages/api/clients/bedrock
(Feel free to ping me if you need help with any of those)
Comment From: hemeda3
@tzolov Thanks for the feedback 🙌 working on it
- create an mistral boot starter project under the: https://github.com/spring-projects/spring-ai/tree/main/spring-ai-spring-boot-starters
I can see there is already a starter project for bedrock spring-ai-bedrock-ai-spring-boot-starter
which I think includes Ai21Jurassic2ChatBedrockApi
So should we create new one and call it ( for example : spring-ai-bedrock-**jurassic2/ai21**-ai-spring-boot-starter
) ?
Comment From: tzolov
@hemeda3 , ah, of course we don't. My bad. Forgot we collocate all bedrock auto-configurations into a single boot starter. You only need to make sure that the Jurassic auto-configuration is disabled by default using an enabled property like this .
Comment From: hemeda3
When spring.ai.bedrock.jurassic2.chat.enabled=false
or when the property is absent ✅
When spring.ai.bedrock.jurassic2.chat.enabled=true
✅
Example: ```Java spring.ai.bedrock.aws.access-key=${AWS_ACCESS_KEY_ID} spring.ai.bedrock.aws.secret-key=${AWS_SECRET_ACCESS_KEY} spring.ai.bedrock.aws.region=${AWS_REGION}
BedrockAi21Jurassic2ChatOptions.Penalty penalty = new BedrockAi21Jurassic2ChatOptions.Penalty.Builder()
.applyToEmojis(false)
.applyToWhitespaces(true)
.applyToNumbers(true)
.applyToStopwords(true)
.applyToPunctuations(true)
.build();
BedrockAi21Jurassic2ChatOptions options = new BedrockAi21Jurassic2ChatOptions
.Builder()
.withPresencePenalty(penalty)
.withMaxTokens(400)
.build();
String promptText = "Can you express happiness using 2 emoji?";
Prompt prompt = new Prompt(promptText, options);
ChatResponse resp = chatClient.call(prompt);
System.out.println("Prompt: " + promptText);
System.out.println("Response: " + resp.getResult().getOutput().toString());
System.out.println("Finish Reason: " + resp.getResult().getMetadata().getFinishReason());
```
Comment From: hemeda3
Should we change the name of BedrockAi21Jurassic2ChatOptions
to BedrockJurassic2ChatOptions
?
Comment From: tzolov
Hey @hemeda3 ,
Finally I've got time to review your PR.
Good job. All checkbox checked including the documentation.
I did some small adjustments before i can merge it and noticed that the BedrockAi21Jurassic2ChatClientIT.emojiPenaltyWhenTrueByDefaultApplyPenaltyTest()
fails when run in combination with the other jurassic2 tests. I've disabled it for the merge, but feel free to investigate .
Comment From: tzolov
Rebased, squashed and merged at c036931065730619a9fb01c90fbe63d7ffbccb1d