query
and a set of text inputs (called documents
), and returns a relevancy score for each document relative to the given query. In RAG pipelines, the reranking step sits between the initial retrieval step and the final generation phase, enhancing the quality of information fed into language models.
Try out Salesforce’s LlamaRank exclusively on Together’s serverless Rerank API endpoint. Together’s Rerank API is Cohere compatible, making it easy to integrate into your existing applications.
Key specs of Together Rerank + LlamaRank
LlamaRank along with Together Rerank has the following key specs:- Support for JSON and tabular data
- Long 8000 token context per document
- LlamaRank has been shown to outperform other models on accuracy for general docs and code.
- Compatible with Cohere’s Rerank API
- Low latency for fast search queries
- Linear relevancy scores, making it easier to interpret
Quickstart
1. Get your Together API key
First, register for an account to get an API key. Once you’ve registered, set your account’s API key to an environment variable namedTOGETHER_API_KEY
:
Shell
2. Install your preferred library
Together provides an official library for Python:3. Run your first reranking query against LlamaRank
In the example below, we use the Rerank API endpoint to index the list ofdocuments
from most to least relevant to the query What animals can I find near Peru?
.
Python
Cohere Rerank compatibility
The Together Rerank endpoint is compatible with Cohere Rerank, making it easy to test out LlamaRank for your existing applications. Simply switch it out by updating theURL
, API key
and model
.
Python
Interpreting Results
LlamaRank produces linear and calibrated scores across all (doc, query) pairs, normalized on a scale of 0-1, making it easier to interpret relevancy scores:- 0.9 — Highly Relevant
- 0.8 ~ 0.7 — Relevant
- 0.6 ~ 0.5 — Somewhat Relevant
- 0.4 ~ 0.3 — Marginally Relevant
- 0.2 ~ 0.1 — Slightly Relevant
- ~ 0.0 — Irrelevant
Next steps
- Learn more about reranking and Together’s Rerank endpoint
- Get started by signing up for a free together.ai account, and get your API key.
- If you’d like to discuss your production reranking use case, contact our sales team.
- Check out our playground to try out other models on the Together Platform for chat, images, languages or code.