-
Notifications
You must be signed in to change notification settings - Fork 82
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactor ChatBedrock to improve support for providers #224
Comments
Hello, I'm a student from University of Toronto. Me and my team from class are looking for ways we can contribute to langchain. Is this issue intended to solve the different promts model providers accept? How's the expected result different with ChatBedrockConverse class? It looks like also a solution to this issue. Thank you so much for your time reading this. |
I'm not @3coins but I'm happy to share my frustrations @Forma-Lin . For instance, I use llama models on bedrock, but right now the |
Hi @cab938, thank you so much for the answer. I totally get it now. Do you consider this class refactoring as a reasonable task for four fourth-year university students to complete in a month? |
Hi @Forma-Lin yes, I do, but I'll note that I'm not a langchain-aws committer so I can't approve any patches or the like. I don't know what the actual process is for creating langchain-aws PRs and getting them approved. The way I would break this problem down is to think about decoupling the underlying model based on the model ID passed into bedrock, and then creating some top level classes for major models. Sometimes there is no significant difference between two models (e.g. the 70b llama 3.1 and the 405b) with respect to their vocabulary, and sometimes there is (e.g. llama 3.2 90b and llama 3.1 70b). I think you could probably build out a great version just thinking about the different llama models which exist. 1 week planning architecture, 2 weeks writing code and tests, last week actually generating PRs and ensuring docs are good. Across four senior undergraduates in CS this seems doable to me. |
@Forma-Lin |
@cab938 If you have any other questions that is stopping you from contributing, don't hesitate to ask. I can also help assign specific issues or PRs or tag you on them, if you are interested in providing review/feedback. |
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.The text was updated successfully, but these errors were encountered: