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

Fixed cohere #64

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions libs/aws/langchain_aws/llms/bedrock.py
Original file line number Diff line number Diff line change
Expand Up @@ -211,8 +211,10 @@ def prepare_input(
input_body["prompt"] = _human_assistant_format(prompt)
if "max_tokens_to_sample" not in input_body:
input_body["max_tokens_to_sample"] = 1024
elif provider in ("ai21", "cohere", "meta", "mistral"):
elif provider in ("ai21", "meta", "mistral"):
input_body["prompt"] = prompt
elif provider == "cohere":
input_body["message"] = prompt
elif provider == "amazon":
input_body = dict()
input_body["inputText"] = prompt
Expand All @@ -238,7 +240,7 @@ def prepare_output(cls, provider: str, response: Any) -> dict:
if provider == "ai21":
text = response_body.get("completions")[0].get("data").get("text")
elif provider == "cohere":
text = response_body.get("generations")[0].get("text")
text = response_body.get("text")
elif provider == "meta":
text = response_body.get("generation")
elif provider == "mistral":
Expand Down