-
Notifications
You must be signed in to change notification settings - Fork 105
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
Adding for Cohere models in BedrockChat #42
Conversation
Hi @3coins, Thank you! |
I apologize, but I have discovered there are still some errors. I will fix them promptly. |
I realized that there were some areas lacking consideration, so I have revised the code. Could you please review the updated code? To successfully pass linting locally, I had to make changes to multiple files, but the only files with added code are and .chat_models/bedrock.pyllms/bedrock.py Thank you for your assistance. |
Hi @3coins, I'm investigating an issue with the CI tests but haven't been able to determine the cause. Could you provide some advice if possible? When I run make lint in my local environment, the same error does not appear. Thank you for your help. |
Hi @ksaegusa,
|
This merge is necessary to sync the add_cohere_model branch with the latest updates from the main branch to ensure consistency with the production environment.
Hi @revsystem Thank you for your comments! I have made the necessary corrections based on your advice! |
@3coins when should we expect this PR to get approved? |
@ksaegusa - seems like there are merge conflicts with the base branch. Can those be resolved so this functionality be added in? |
@supreetkt @3coins |
@@ -969,6 +986,12 @@ def validate_environment(cls, values: Dict) -> Dict: | |||
"Please use `from langchain_community.chat_models import BedrockChat` " | |||
"instead." | |||
) | |||
if model_id.startswith("cohere.command-r"): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
May I check why it's not supported here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
command-r has been excluded from BedrockLLM for the same reason as claude-3. Specifically, command-r differs from the standard command model in terms of output format and behavior. Due to these differences, it requires specialized handling, which is why it has been excluded from the general BedrockLLM class.
@ksaegusa Thanks so much for the help here! May I confirm that this PR doesn't add tool calling support for cohere in bedrock? May I check if this is something down the line that you'd want to add support to as well? |
Hi @Anirudh31415926535 Yes, tool calling for Cohere has not been added in this PR. I would like to add it in the future, but currently, I do not fully understand the tool calling mechanism. |
@3coins: can we get a review on this PR? |
@ksaegusa |
Hi, @3coins Thank you for your comment!
Please let me know if there are any additional aspects you think should be tested or if you have any further suggestions. Thank you! |
I see, yeah it could be a little confusing haha... But if you're keen to add support for this, I'd highly recommend taking a look at this page here: https://docs.cohere.com/docs/tools for single-step and multi-step tool use! Additionally, you could also take a look at how it's implemented in ChatCohere in langchain-cohere. But, as a first step, I think adding support for multi-step tool use would be highly beneficial, more so than the single step! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PR looks good imo!
Just a call out here that tool calling isn't supported for this integration as of now with the cohere models!
Thank you for your review! While I’m unable to implement tool support in this PR, I will definitely consider it for future improvements after reviewing the documentation you mentioned! |
@3coins |
Since it seems that this pull request hasn't garnered any interest, I will proceed to close it. I understand that the changes I proposed might not align with your project's direction, or perhaps the timing just wasn’t right to review this contribution. I had hoped this PR could add some value to the project, but unfortunately, it appears that wasn't meant to be. In any case, I wish the project continued success and all the best moving forward. |
BedrockChat did not have a Cohere model, so we will add one
The stream and tool calls are non-overlapping