repositories
loading repo index
repositories
loading repo index
repository
loading code, commits, and activity
public Clawd ADK gateway launch mirror
stars
latest
clone command
git clone gitlawb://did:key:z6Mkq5mY...iFZ5/my-project-publ...git clone gitlawb://did:key:z6Mkq5mY.../my-project-publ...2fa351d6docs: add automaton and perps launch sources16d ago| #1 | --- |
| #2 | title: Config |
| #3 | description: "Configuration options for rerankers in Mem0" |
| #4 | --- |
| #5 | |
| #6 | ## Common Configuration Parameters |
| #7 | |
| #8 | All rerankers share these common configuration parameters: |
| #9 | |
| #10 | | Parameter | Description | Type | Default | |
| #11 | | ---------- | --------------------------------------------------- | ----- | -------- | |
| #12 | | `provider` | Reranker provider name | `str` | Required | |
| #13 | | `top_k` | Maximum number of results to return after reranking | `int` | `None` | |
| #14 | | `api_key` | API key for the reranker service | `str` | `None` | |
| #15 | |
| #16 | ## Provider-Specific Configuration |
| #17 | |
| #18 | ### Zero Entropy |
| #19 | |
| #20 | | Parameter | Description | Type | Default | |
| #21 | | --------- | -------------------------------------------- | ----- | ------------ | |
| #22 | | `model` | Model to use: `zerank-1` or `zerank-1-small` | `str` | `"zerank-1"` | |
| #23 | | `api_key` | Zero Entropy API key | `str` | `None` | |
| #24 | |
| #25 | ### Cohere |
| #26 | |
| #27 | | Parameter | Description | Type | Default | |
| #28 | | -------------------- | -------------------------------------------- | ------ | ----------------------- | |
| #29 | | `model` | Cohere rerank model | `str` | `"rerank-english-v3.0"` | |
| #30 | | `api_key` | Cohere API key | `str` | `None` | |
| #31 | | `return_documents` | Whether to return document texts in response | `bool` | `False` | |
| #32 | | `max_chunks_per_doc` | Maximum chunks per document | `int` | `None` | |
| #33 | |
| #34 | ### Sentence Transformer |
| #35 | |
| #36 | | Parameter | Description | Type | Default | |
| #37 | | ------------------- | -------------------------------------------- | ------ | ---------------------------------------- | |
| #38 | | `model` | HuggingFace cross-encoder model name | `str` | `"cross-encoder/ms-marco-MiniLM-L-6-v2"` | |
| #39 | | `device` | Device to run model on (`cpu`, `cuda`, etc.) | `str` | `None` | |
| #40 | | `batch_size` | Batch size for processing | `int` | `32` | |
| #41 | | `show_progress_bar` | Show progress during processing | `bool` | `False` | |
| #42 | |
| #43 | ### Hugging Face |
| #44 | |
| #45 | | Parameter | Description | Type | Default | |
| #46 | | --------- | -------------------------------------------- | ----- | --------------------------- | |
| #47 | | `model` | HuggingFace reranker model name | `str` | `"BAAI/bge-reranker-large"` | |
| #48 | | `api_key` | HuggingFace API token | `str` | `None` | |
| #49 | | `device` | Device to run model on (`cpu`, `cuda`, etc.) | `str` | `None` | |
| #50 | |
| #51 | ### LLM-based |
| #52 | |
| #53 | | Parameter | Description | Type | Default | |
| #54 | | ---------------- | ------------------------------------------ | ------- | ---------------------- | |
| #55 | | `model` | LLM model to use for scoring | `str` | `"gpt-4o-mini"` | |
| #56 | | `provider` | LLM provider (`openai`, `anthropic`, etc.) | `str` | `"openai"` | |
| #57 | | `api_key` | API key for LLM provider | `str` | `None` | |
| #58 | | `temperature` | Temperature for LLM generation | `float` | `0.0` | |
| #59 | | `max_tokens` | Maximum tokens for LLM response | `int` | `100` | |
| #60 | | `scoring_prompt` | Custom prompt template for scoring | `str` | Default scoring prompt | |
| #61 | |
| #62 | ### LLM Reranker |
| #63 | |
| #64 | | Parameter | Description | Type | Default | |
| #65 | | -------------- | --------------------------- | ------ | -------- | |
| #66 | | `llm.provider` | LLM provider for reranking | `str` | Required | |
| #67 | | `llm.config` | LLM configuration object | `dict` | Required | |
| #68 | | `top_n` | Number of results to return | `int` | `None` | |
| #69 | |
| #70 | ## Environment Variables |
| #71 | |
| #72 | You can set API keys using environment variables: |
| #73 | |
| #74 | - `ZERO_ENTROPY_API_KEY` - Zero Entropy API key |
| #75 | - `COHERE_API_KEY` - Cohere API key |
| #76 | - `HUGGINGFACE_API_KEY` - HuggingFace API token |
| #77 | - `OPENAI_API_KEY` - OpenAI API key (for LLM-based reranker) |
| #78 | - `ANTHROPIC_API_KEY` - Anthropic API key (for LLM-based reranker) |
| #79 | |
| #80 | ## Basic Configuration Example |
| #81 | |
| #82 | ```python Python |
| #83 | config = { |
| #84 | "vector_store": { |
| #85 | "provider": "chroma", |
| #86 | "config": { |
| #87 | "collection_name": "my_memories", |
| #88 | "path": "./chroma_db" |
| #89 | } |
| #90 | }, |
| #91 | "llm": { |
| #92 | "provider": "openai", |
| #93 | "config": { |
| #94 | "model": "gpt-4.1-nano-2025-04-14" |
| #95 | } |
| #96 | }, |
| #97 | "reranker": { |
| #98 | "provider": "zero_entropy", |
| #99 | "config": { |
| #100 | "model": "zerank-1", |
| #101 | "top_k": 5 |
| #102 | } |
| #103 | } |
| #104 | } |
| #105 | ``` |
| #106 |