fix(reranker): support omitting top_n#7199
Conversation
Signed-off-by: Mikhail Khludnev <mkhl@apache.org>
✅ Deploy Preview for localai ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
Signed-off-by: Mikhail Khludnev <mkhl@apache.org>
Signed-off-by: Mikhail Khludnev <mkhludnev@users.noreply.github.com>
| request = backend_pb2.RerankRequest( | ||
| query="I love you", | ||
| documents=["I hate you", "I really like you"], | ||
| top_n=0 # |
There was a problem hiding this comment.
otherwise we can better handle top_n REST API param
notice https://api.jina.ai/redoc#tag/rerank/operation/rank_v1_rerank_post
defaults to the length of documents
Yes, that would make def. sense! |
|
asserts #7284 |
Description
This PR fixes the issue introduced in #7025
Notes for Reviewers
#7025 introduced handling result cropping by
top_n. However, I believe the most users just omittop_n, just because don't bother to countlen(documents). So, I'm afraid releasing #7025 causes a trouble for many users. @mudler, beg your pardon.This PR let users to omit
top_nor sendtop_n=0meaning all docs.One thing about tests, since tey bring up the backend every time, isn't it worth to loop three alt requests in the single test method?
Signed commits