Expand description
Cohere integration for Synaptic.
This crate provides CohereReranker, a reranker that uses the
Cohere Rerank API to
reorder documents by relevance to a query.
When the retrieval feature is enabled, CohereReranker also implements
the DocumentCompressor trait,
making it usable with
ContextualCompressionRetriever.
§Example
use synaptic_cohere::{CohereReranker, CohereRerankerConfig};
use synaptic_core::Document;
let config = CohereRerankerConfig::new("your-api-key")
.with_top_n(3);
let reranker = CohereReranker::new(config);
let docs = vec![
Document::new("1", "Rust is a systems programming language"),
Document::new("2", "Python is great for data science"),
];
let reranked = reranker.rerank("systems programming", docs, None).await?;Structs§
- Cohere
Embeddings - Embeddings backed by the Cohere Embed API.
- Cohere
Embeddings Config - Configuration for
CohereEmbeddings. - Cohere
Reranker - A reranker that uses the Cohere Rerank API to reorder documents by relevance to a query.
- Cohere
Reranker Config - Configuration for the Cohere Reranker.
- Document
- A document with content and metadata, used throughout the retrieval pipeline.
Enums§
- Cohere
Input Type - Input type for Cohere embeddings.