Skip to main content

Common Configuration Parameters

All rerankers share these common configuration parameters:

Provider-Specific Configuration

Zero Entropy

Cohere

Sentence Transformer

Hugging Face

LLM-based

LLM Reranker

Environment Variables

You can set API keys using environment variables:
  • ZERO_ENTROPY_API_KEY - Zero Entropy API key
  • COHERE_API_KEY - Cohere API key
  • HUGGINGFACE_API_KEY - HuggingFace API token
  • OPENAI_API_KEY - OpenAI API key (for LLM-based reranker)
  • ANTHROPIC_API_KEY - Anthropic API key (for LLM-based reranker)

Basic Configuration Example

Python

TypeScript SDK

The self-hosted TypeScript SDK (mem0ai/oss) supports the same five providers. Config keys are camelCase (apiKey, topK, maxLength) and each provider’s SDK is a peer dependency you install per reranker.
The local cross-encoder providers (sentence_transformer, huggingface) run on Transformers.js and default to ONNX (Xenova/*) model mirrors, so Python default model strings must be swapped for their ONNX equivalents. batchSize and showProgressBar are accepted for parity with Python but are no-ops in the TypeScript runtime. See the reranker feature guide for full examples.