langchain-ai / langchain-aws

Build LangChain Applications on AWS
MIT License
63 stars 47 forks source link

Adding for Cohere models in BedrockChat #42

Open ksaegusa opened 2 months ago

ksaegusa commented 2 months ago

BedrockChat did not have a Cohere model, so we will add one

The stream and tool calls are non-overlapping

ksaegusa commented 1 month ago

Hi @3coins, I have fixed the lint error. Could you please run the workflow again at your earliest convenience?

Thank you!

ksaegusa commented 1 month ago

I apologize, but I have discovered there are still some errors. I will fix them promptly.

ksaegusa commented 1 month ago

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.

ksaegusa commented 1 month ago

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.

revsystem commented 1 month ago

Hi @ksaegusa, What about adding model=self._get_model() argument to "convert_messages_to_prompt" of "ChatPromptAdapter"?

            elif provider == "cohere":
                if "command-r" in self.model_id:
                    prompt, chat_history = ChatPromptAdapter.format_cohere_message(
                        provider, messages
                    )
                else:
                    prompt = ChatPromptAdapter.convert_messages_to_prompt(
                        provider=provider, messages=messages, model=self._get_model()
                    )
ksaegusa commented 1 month ago

Hi @revsystem

Thank you for your comments! Upon reviewing the code, I realized that the state of the main branch had changed since I forked it, and I did not notice that the model was not applied correctly.

I have made the necessary corrections based on your advice!

arm-diaz commented 2 weeks ago

@3coins when should we expect this PR to get approved?