langchain-aws icon indicating copy to clipboard operation
langchain-aws copied to clipboard

Refactor ChatBedrock to improve support for providers

Open 3coins opened this issue 4 months ago • 0 comments

Problem

Bedrock supports several providers (AI21, Anthropic, Amazon, Mistral, Meta etc.), each of which has a slightly different request/response structure. The current ChatBedrock class currently accommodates these providers by incorporating several conditional blocks which have become unsustainable as more providers, models and features have been introduced in Bedrock. This has also made it difficult and error prone to debug and add bug fixes over time.

Solution

Refactor the ChatBedrock class to individual provider classes, for example ChatBedrockAnthropic, and provide a mechanism in ChatBedrock to switch to these, so the users of don't have to create these classes separately.

3coins avatar Oct 03 '24 21:10 3coins