Advanced Retrieval
Last updated
Last updated
Advanced retrieval techniques can help you improve the relevance of your search results. This guide covers query rewriting and using metadata to enhance retrieval performance. By adding any of the following features to your retrieval pipeline, you will use an Advanced Retrieval which is a seperate quota from the standard retrieval quota. A single advanced retrieval request will only consume one advanced retrieval quota regardless of the number of features used in the request.
Reranking is a technique that reorders search results to improve relevance. When you enable reranking, the system uses a cohere to re-rank the top search results based on the context of the conversation. This can help you provide more relevant answers to user queries.
To enable reranking, include the rerank
parameter and set to true
in the request body. Here's an example request:
rerank
is an optional boolean parameter in the request
Set rerank
to true
to enable reranking
Set rerank
to false
or omit it to disable reranking
Query rewriting uses conversation history to improve retrieval relevance. Before retrieving relevant documents, the system reformulates the user query based on the context of the conversation. This can help you provide more accurate answers to user queries. When making a request to the retrieval endpoint, you can include previous messages to help the system understand context and reformulate queries appropriately.
Tip: Query rewriting is particularly helpful in chat applications.
Include previous context in the request body to help the system understand the conversation history. Here's an example request:
context
is an optional object in the request
messages
must be a non-empty array
Each message must have a role
and content
. Role can be any string, but user
and assistant
are common values
Messages should be in chronological order with the most recent message last
Include both sides of the conversation for best results