-
Notifications
You must be signed in to change notification settings - Fork 2.1k
feat: optional reranking for mix and naive query mode. #1415
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
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reranking the results of cos similarity search can indeed improve query quality. I have a few questions that I would like you to clarify:
-
Does the current approach consider allowing users to choose different reranker options? For example, selecting the bge-reranker-v2-m3 model deployed with Ollama, or choosing the jina-reranker-v2-base-multilingual model from Jina AI.
-
At present, using QueryParam to pass the reranker function does not seem very appropriate, because Web APIs generally should not specify reranker functions via QueryParam. Is there a better way for users to choose whether to enable reranking and which reranker to use?
-
Currently, I notice that you only modified
naive_query
to allow it to utilize thereranker_func
. Why didn’t you similarly modifymix_kg_vector_query
? -
In addition, PR Feature: Implemented an option to use DeepSeek Reasoner for intelligent semantic node re-ranking and retrieval #1400 proposes an idea to perform reranking on nodes. I would like to hear your opinion on this approach. If it is necessary to rerank both chunks and nodes, how should the interface be designed?
As long as it follows the defined Signature Line 63 in 1e4ea22
it accepts a query, and list of chunks to rerank. One would need to wrap it around your specific reranker (be it API or a simple filter as illustrated) just like for the other model funcs.
Which Web APIs do you mean - this?
Passing a callable function directly as a parameter within a web API request introduces several fundamental problems... Client-Side code (e.g. allowing clients to send scripts to be executed on the server) is probably not desired due to the security implications? Otherwise we could use a configuration object and provide the set of rerankers by langchain and langchain community : https://python.langchain.com/docs/integrations/retrievers/#all-retrieverse.g. https://api.python.langchain.com/en/latest/vertex_rank/langchain_google_community.vertex_rank.VertexAIRank.html We would need to wrap context into langchain Documents which is not a bad thing in principle but needs some work.
I simply missed it. You are right, it should be in both. I expected
I saw this PR and share the following remarks (some already mentioned):
Let me know what you @danielaskdd think, reranking is not a big feature for me but I can work on it. |
Obviously query_param is not suitable for callable object, we need to refactor the program to allow API clients to select different reranker models via query_param. |
Description
Adds an optional reranking in
naive
andmix
query mode.Related Issues
#1414
Changes Made
Checklist