Open keshavd opened 3 months ago
@keshavd I am not able to test the cohere model with these changes. Here is the sample code I used.
params = {
"region_name": "us-west-2",
"model_id": "cohere.command-r-v1:0"
}
model = BedrockLLM(**params)
response = model.invoke("Hello!")
Here is the exception thrown in _prepare_input_and_invoke
try:
response = self.client.invoke_model(**request_options)
(
text,
tool_calls,
body,
usage_info,
stop_reason,
) = LLMInputOutputAdapter.prepare_output(provider, response).values()
except Exception as e:
> raise ValueError(f"Error raised by bedrock service: {e}")
E ValueError: Error raised by bedrock service: 'NoneType' object is not subscriptable
Cohere's Command-R and Command-R-Plus models have a different API than the Command model provided on Bedrock.
This pull request adds compatibility based on model ID instead of the provider exclusively.
closes https://github.com/langchain-ai/langchain-aws/issues/66