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

Throw when trying to rerank with v1 #616

merged 1 commit into from
Dec 4, 2024

Conversation

billytrend-cohere
Copy link
Collaborator

@billytrend-cohere billytrend-cohere commented Dec 4, 2024

Fixes #613

The PR introduces a new function, rerank, to the BedrockClient class. This function is not available in the v1 client, cohere.BedrockClient, and users are advised to use cohere.BedrockClientV2 instead.

  • A new function, rerank, is added to the BedrockClient class.
  • The function raises a NotImplementedError to inform users that it is not available in the v1 client, cohere.BedrockClient.
  • Users are advised to use cohere.BedrockClientV2 instead.

@billytrend-cohere billytrend-cohere enabled auto-merge (squash) December 4, 2024 17:21
@@ -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.")

@billytrend-cohere billytrend-cohere merged commit 9fe3df8 into main Dec 4, 2024
4 checks passed
@billytrend-cohere billytrend-cohere deleted the billy/thro branch December 4, 2024 17:24
@billytrend-cohere billytrend-cohere restored the billy/thro branch December 4, 2024 17:25
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

Successfully merging this pull request may close these issues.

Cohere rerank on Bedrock - api_version missing in the sdk
2 participants