CoolFace
Apppublic

mtyrrell/chatfed_retriever

sourceHugging Faceupdated 1y agoView on Hugging Face
0likes
App README

ChatFed Retriever - MCP Server

A semantic document retrieval and reranking service designed for ChatFed RAG (Retrieval-Augmented Generation) pipelines. This module serves as an MCP (Model Context Protocol) server that retrieves semantically similar documents from vector databases with optional cross-encoder reranking.

MCP Endpoint

The main MCP function is retrieve_mcp which provides a top_k retrieval and reranking function when properly connected to an external vector database.

Parameters:

  • —query (str, required): The search query text
  • —reports_filter (str, optional): Comma-separated list of specific report filenames
  • —sources_filter (str, optional): Filter by document source type
  • —subtype_filter (str, optional): Filter by document subtype
  • —year_filter (str, optional): Comma-separated list of years to filter by

Returns: List of dictionaries containing:

  • —answer: Document content
  • —answer_metadata: Document metadata
  • —score: Relevance score [disabled when reranker used]

Example useage:

python
from gradio_client import Client

client = Client("ENTER CONTAINER URL / SPACE ID")
result = client.predict(
		query="...",
		reports_filter="",
		sources_filter="",
		subtype_filter="",
		year_filter="",
		api_name="/retrieve_mcp"
)
print(result)

Configuration

Vector Store Configuration

  1. 1.Set your data source according to the provider
  2. 2.Set the embedding model to match the data source
  3. 3.Set the retriever parameters
  4. 4.[Optional] Set the reranker parameters
  5. 5.Run the app:
bash
docker build -t chatfed-retriever .
docker run -p 7860:7860 chatfed-retriever