Created anthropic messages API for Claude 3

This package is an adaption of the existing anthropic package which supports the more recent Messages API. The API is compatible with all existing Bedrock models.

It does not currently support the Image input message type.

I would welcome guidance on how to best incorporate such support given there is already an existing anthropic package which supports only the Text Completions API. @tzolov in particular as author of the original Text Completions implementations.

Comment From: tzolov

@ben-gineer thank you very much for the great contribution.

Recently I've added a Claude 3 support for the Anthropic's own cloud infrastructure: https://github.com/spring-projects/spring-ai/commit/ce2bb131e567d551863166329b00824fcb746d3a based on their Message API. It seems like Bedrock's Anthropic Message API is a strip down version of the original Anthropic API. So it was very interesting to compare how we've approached the API mapping to the Spring AI abstractions. Looks like we made a very similar choices, which i guess cloud be expected. The stream handling is perhaps slightly different as i've tried to retain all historic chunk information in the output (not sure if this is that useful though). I also ported my multimodality impl. so you can prompt with text and images. Also added auto-configuration and Anthropic 3 documentation.

Comment From: tzolov

Rebased, squashed and merged at e004751842e71c996d72e31d14992f959740ce48

Comment From: tzolov

@ben-gineer, thanks again. I really like your work. So please let me know if there is anything else you would be interested to contribute to?

Comment From: tzolov

fyi, https://docs.spring.io/spring-ai/reference/1.0-SNAPSHOT/api/chat/bedrock/bedrock-anthropic3.html

Comment From: ben-gineer

Thanks for picking this up @tzolov. We're looking forward to using spring-ai. @snoopman previously implemented our own Bedrock abstraction, having found LangChain4J bringing in too many unwanted 3rd party dependencies. We're embedded in the Spring eco-system, so spring-ai suits our needs much better.

One question, LangChain Python OutputParser supports streaming of JSON responses (see https://python.langchain.com/docs/modules/model_io/output_parsers/types/json). Do you think this is doable with streaming output support in spring-ai? Most of our use cases involved some form of structured output, and having different elements of a map streamed could be helpful.

Comment From: ben-gineer

@ben-gineer, thanks again. I really like your work. So please let me know if there is anything else you would be interested to contribute to?

Many thanks, I'll keep this in mind. Right now, my focus is to help my team with their current AI features.

Comment From: tzolov

@ben-gineer

One question, LangChain Python OutputParser supports streaming of JSON responses (see https://python.langchain.com/docs/modules/model_io/output_parsers/types/json). Do you think this is doable with streaming output support in spring-ai? Most of our use cases involved some form of structured output, and having different elements of a map streamed could be helpful.

Are you referring to the structured output parsers: https://docs.spring.io/spring-ai/reference/1.0-SNAPSHOT/api/output-parser.html I guess you've already seen the List, Map, Bean and Record output parsers in the Anthropic3 ITs?