Architecture

A seam, not a stack.

Polymathy is deliberately one box in a larger diagram. It owns the fetch-and-chunk coordination between a metasearch engine and a content processor, and nothing else. This is what the deployment looks like, and where the boundaries are.

System diagram

            ┌───────────────────────────────────────────────┐
   client ─▶│  Polymathy  (actix-web 4, single binary)      │
  GET /v1/  │                                               │
   search   │   1. query ──▶  SearxNG   (SEARXNG_URL)        │──▶ upstream engines
            │   2. top 10 URLs                              │
            │   3. fan out ─▶ Processor (PROCESSOR_URL)     │──▶ chunk + embed
            │   4. assemble chunk_id → (source_url, text)   │
            └───────────────────────────────────────────────┘
                              │
                              ▼
                    JSON chunk map ──▶  your LLM / rerank / UI

Everything outside the box — SearxNG, the processor, the downstream LLM and UI — is supplied by you. Polymathy is the middle coordination layer.

The stack, as shipped

LayerTechnologyRole
HTTP frameworkactix-web 4Serves /v1/search and the API doc UIs; async on tokio.
OpenAPIapistosGenerates the OpenAPI spec from the Rust handler types.
HTTP clientreqwestCalls SearxNG and fans out to the content processor.
Vector primitivesusearch 2.12384-dim, inner-product, F32-quantised index, per request.
RuntimetokioConcurrency for the parallel URL fan-out.

The two contracts you implement

SearxNG (SEARXNG_URL)

Must answer GET /search?q=…&format=json with a results[] array of objects carrying a url. Any SearxNG instance with JSON output enabled satisfies this.

Content processor (PROCESSOR_URL)

Must accept a POST with a URL and a config block (chunking_size, chunking_type, embedding_model) and return chunks with embeddings. This is where fetching, boilerplate stripping, chunking, and embedding actually happen.

Because Polymathy owns neither contract's implementation, you can evolve your retrieval and embedding independently — a different SearxNG instance, a different chunker, a different embedding model — without redeploying Polymathy.

Request handler step by step Features