-
Notifications
You must be signed in to change notification settings - Fork 116
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
Support bedrock rerank API #298
Comments
@wuodar Do you have a specific use case that can help with this decision? Are there other APIs like this that are available from other providers, and how have they implemented this? |
I supose this is a good feature to implement, since I need to compare the Bedrock KnowlegeBases with other retrievers. It would be easier to switch between retrievers and choose a better option. |
I suppose the possibility of using it both in Bedrock KB and as a standalone are needed for some groups of people. In my case - I'm using both approaches in several projects and I would love if LC supported them. :) |
The Cohere rerank is used as contextual retrievers on large applications. Based on the documentation, we can see the use case: from langchain.retrievers.contextual_compression import ContextualCompressionRetriever
from langchain_cohere import CohereRerank
from langchain_community.llms import Cohere
llm = Cohere(temperature=0)
compressor = CohereRerank(model="rerank-english-v3.0")
compression_retriever = ContextualCompressionRetriever(
base_compressor=compressor, base_retriever=retriever
)
compressed_docs = compression_retriever.invoke(
"What did the president say about Ketanji Jackson Brown"
)
pretty_print_docs(compressed_docs) This kind of implementation is very relevant when you have to use other tools, such as Langgraph. Usually we need to create a single compressed retriever with rerank capability to create nodes. Since rerank APIs are still emerging (no many companies offer the service) I think it is very valid that there is already a set of tools that facilitate its use. I already created a PR #331 with the code I used on internal projects. Its based on the Cohere Rerank implementation, so its replaceable with the Langchain patterns (i.e. Document Compression) The PR comments show some snippets and some comparisons with the documentation provided by Cohere |
As AWS Bedrock supports now rerank API, I wanted to ask whether there are any plans to integrate it into langchain-aws, either into bedrock retriever or as a standalone module, like Document Compressor? Here is boto3 documentation
The text was updated successfully, but these errors were encountered: