Skip to content

feat: add rank_fields to rerank v3 #12

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

Merged
merged 1 commit into from
Apr 17, 2024

Conversation

mahjongmen
Copy link
Contributor

No description provided.

@harry-cohere harry-cohere changed the title added rerank v3 param feat: add rank_fields to rerank v3 Apr 12, 2024
Copy link
Collaborator

@harry-cohere harry-cohere left a comment

Choose a reason for hiding this comment

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

Thanks for the contribution! We'll need to update the minimum SDK version to 5.2.5, which is blocked currently. We'll work on resolving this though.

Copy link
Collaborator

@harry-cohere harry-cohere left a comment

Choose a reason for hiding this comment

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

As above - I'll get back to you!

@harry-cohere harry-cohere merged commit 537b388 into langchain-ai:main Apr 17, 2024
Anirudh31415926535 added a commit to Anirudh31415926535/langchain-cohere-fork that referenced this pull request Jul 30, 2024
* fix nits and small bugs

* nits

* nits

* update func tool name

* update tests
Anirudh31415926535 added a commit to Anirudh31415926535/langchain-cohere-fork that referenced this pull request Aug 12, 2024
* fix nits and small bugs

* nits

* nits

* update func tool name

* update tests
@btiernay
Copy link

btiernay commented Jan 6, 2025

This seems to have broken compatibility with the cohere.BedrockClientV2 client which does not support the rank_fields option. To fix this, I've have to patch using:

    # HACK: Override the `rerank` method to remove any unsupported parameters in this version of LangChain.
    cohere.BedrockClientV2.rerank = (lambda original:
                                     lambda self, *args, **kwargs: original(
                                         self, *args,
                                         **{k: v for k, v in kwargs.items() if
                                            k in inspect.signature(original).parameters}
                                     )
                                     )(cohere.BedrockClientV2.rerank)

cohere.BedrockClientV2 is required in my case because its the only client that supports rerank

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.

3 participants