langchain4j / langchain4j

Java version of LangChain
https://docs.langchain4j.dev
Apache License 2.0
4.52k stars 887 forks source link

[FEATURE] Use Converse API instead of InvokeModel API for Amazon Bedrock integrations #1789

Open AndrewSerbin opened 1 week ago

AndrewSerbin commented 1 week ago

Currently, Langchain4j’s Amazon Bedrock integration utilizes the InvokeModel API. Amazon has introduced the Converse API, which provides a consistent interface that works with all models that support messages. https://docs.aws.amazon.com/bedrock/latest/APIReference/API_runtime_Converse.html

langchain4j commented 1 week ago

@AndrewSerbin sounds great! Would you like to implement this? 🙏

herbert-beckman commented 1 week ago

@langchain4j see my example in issue #1074. I propose a new architecture to implement the converse API or create a new package.

langchain4j commented 6 days ago

@herbert-beckman if converse API uses the same SDK, I would keep it in langchain4j-bedrock module. We could create BedrockChatModel that could eventually be used instead of all Bedrock{Model}ChatModel classes. WDYT?

herbert-beckman commented 6 days ago

I agree. However, some details still remain from the models, such as the input schemas and inference configs. I'm going to open a PR with the proposal.

langchain4j commented 5 days ago

@herbert-beckman awesome, thank you!