--- title: ChatFed Re-Ranker Service emoji: 🤖 colorFrom: blue colorTo: purple sdk: docker pinned: false license: mit --- # ReRanker Module This is an LLM-based generation service designed to be deployed as a modular component of a broader RAG system. The service runs on a docker container and exposes a gradio UI on port 7860 as well as an MCP endpoint. ## Configuration 1. The module requires an API key (set as an environment variable) for a model provider to run. Make sure to set the appropriate environment variables: - HuggingFace: `HF_TOKEN` 2. Inference provider and model settings are accessible via params.cfg ## MCP Endpoint ### Available Tools #### `rerank_context` Re-ranks a list of context dicts (each with 'page_content' & 'metadata') using a cross-encoder and returns the top_n sorted results. **Input Schema:** | Parameter | Type | Description | |-----------|------|-------------| | `query` | string | The search query to rank contexts against | | `contexts` | string | List of context dictionaries to be re-ranked | **Example Usage:** ```json { "query": "your search query here", "contexts": "your context data here" } ``` --- *This tool uses a cross-encoder model to improve the relevance ranking of retrieved contexts based on their similarity to the input query.*