Skip to content

Conversation

kalaspuffar
Copy link

This is a PR as per the suggestion from danny-avila/LibreChat#9102

This will add an endpoint /rerank in order to use open source models to rerank documents. The endpoint needs a query to rerank against and documents to rank. We can also add information on how many results we need, k, and a configuration to set the model and keys in order to run this operation.

All available configuration options could be found over at https://github.com/AnswerDotAI/rerankers, which this endpoint is a thin wrapper over.

Test call

curl -s http://localhost:8000/rerank -H 'Content-Type: application/json' -d '{
    "query":"I love you", 
    "docs":["I hate you","I really like you"],
    "config": {
      "model_name":"mixedbread-ai/mxbai-rerank-large-v1",
      "model_type":"cross-encoder"
    }
}'

Expected response:

[["I really like you",-1.537894606590271],["I hate you",-4.30911111831665]]

@kalaspuffar
Copy link
Author

Force push was due to black linting.

All done! ✨ 🍰 ✨
1 file reformatted, 1 file left unchanged.

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.

1 participant