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

Throw when trying to rerank with v1 #616

Merged
merged 1 commit into from
Dec 4, 2024
Merged
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
2 changes: 2 additions & 0 deletions src/cohere/bedrock_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ def __init__(
timeout=timeout,
)

def rerank(self, *, query, documents, model = ..., top_n = ..., rank_fields = ..., return_documents = ..., max_chunks_per_doc = ..., request_options = None):
raise NotImplementedError("Please use cohere.BedrockClientV2 instead: method rerank is not available in the v1 client, cohere.BedrockClient.")
Copy link
Collaborator

@mkozakov mkozakov Dec 4, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this makes it sound like we haven't added support in the V1 sdk yet. should we change the message t o say

Suggested change
raise NotImplementedError("Please use cohere.BedrockClientV2 instead: method rerank is not available in the v1 client, cohere.BedrockClient.")
raise NotImplementedError("Rerank API on Bedrock is not supported with cohere.BedrockClient for this model. Please use cohere.BedrockClientV2 instead.")


class BedrockClientV2(AwsClientV2):
def __init__(
Expand Down