-
Notifications
You must be signed in to change notification settings - Fork 112
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
Wrong input key for Cohere models in BedrockLLM #43
Comments
Hello. I think the format of json_body is different between command-r and command, so I have to rewrite the following. # Command-R
if messages:
input_body["chat_history"] = messages['chat_history']
input_body["message"] = messages['message']
# Command
else:
input_body["prompt"] = prompt I assume that Command R will be currently unsupported, just as Claude3 does not support BedrockBase. @root_validator()
def validate_environment(cls, values: Dict) -> Dict:
model_id = values["model_id"]
if model_id.startswith("anthropic.claude-3"):
raise ValueError(
"Claude v3 models are not supported by this LLM."
"Please use `from langchain_community.chat_models import BedrockChat` "
"instead."
)
return super().validate_environment(values) It would be better to use ChatBedrock for this purpose. I am now implementing my own Rv request with the following PR. |
I was trying to do my own commit; however, I'm not really sure how to locally test it. Any pointers @ksaegusa? |
@HFR1994
After that, I wrote a simple script to verify the functionality. I hope this answers your question |
Thanks for this update! Any news on when #43 will be merged? |
Use |
I'm using the
cohere.command-r-v1:0
model to test some prompts. After noticing that Cohere doesn't support Chat #33, I changed to BedrockLLM. However I keep getting the following message:ValueError: Error raised by bedrock service: An error occurred (ValidationException) when calling the InvokeModel operation: Malformed input request: #: required key [message] not found#: extraneous key [prompt] is not permitted, please reformat your input and try again.
I have tried several methods including:
After validating the error message and line 134 in libs/aws/langchain_aws/llm/bedrock I think it should be rewritten as:
Here are my dependencies:
langchain==0.1.19
langchain-aws==0.1.3
I'm using Python 3.11
The text was updated successfully, but these errors were encountered: