Skip to content
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

Cohere on Bedrock has been a failure #186

Open
mutazmq1 opened this issue Oct 31, 2024 · 3 comments
Open

Cohere on Bedrock has been a failure #186

mutazmq1 opened this issue Oct 31, 2024 · 3 comments

Comments

@mutazmq1
Copy link

Try this and it doesn't work:

import cohere_aws
import boto3

co = cohere_aws.Client(mode=cohere_aws.Mode.BEDROCK)
message = "Write a LinkedIn post about starting a career in tech:"

response = co.chat(message=message, model_id="cohere.command-r-plus-v1:0", stream=False)

print(response)

Try summarize from cohere_aws. Also doesn't work.

Try BedrockLLM from Langchain, Cohere also doesn't work.

All I need is a code snippet that allows me to use Cohere "cohere.command-r-plus-v1:0" on Bedrock us-east-1 to summarise text. And that seems impossible so far!! I just want to call Bedrock directly without creating an end point.

Appreciate your help.

@leilacc
Copy link
Contributor

leilacc commented Oct 31, 2024

Hello, that code snippet works for me. Can you share the error you're getting? Please make sure you're using the latest version of cohere_aws and that you're providing your AWS credentials.

Also, this package is being deprecated. I suggest using the cohere package instead - there's an example for querying Bedrock here. I've just double checked that it works. Again, if it doesn't work for you, please share the error you're getting.

@mutazmq1
Copy link
Author

mutazmq1 commented Nov 4, 2024

Hi, here is the error I'm getting https://jpst.it/3ZOMz

I tried the snippet you shared and is working, thank you. My project is built on Langchain and would be great if you could share a working example in Langchain because there where my problem started. Cohere Bedrock doesn't work on Langchain.

This is the error I got https://justpaste.it/ar82c when I tried this code

from langchain_aws import BedrockLLM

llm = BedrockLLM( region_name="us-east-1", model_id="cohere.command-r-plus-v1:0")

llm.invoke(input="What is the recipe of mayonnaise?")

@billytrend-cohere
Copy link
Contributor

Hey @mutazmq1 I reccommend you try the cohere python sdk to achieve this. There is a snippet on this page: https://docs.cohere.com/docs/cohere-works-everywhere#bedrock please let me know if you have issues running that!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants