Skip to content

Support local embeddings for self-hosted installs (model downloaded on demand) #202

Open

Description

@clbotdev

Why

Without an embedding API key, FrontLit falls back to hash vectors, which barely capture meaning, so self-hosters without a provider key effectively get keyword-only search. A small local embedding model closes that gap and gives a strong self-hosting story:

  • Content is never sent to a third party just to be indexed (data residency, regulated customers)
  • Works on installs with no internet after setup
  • Reindexing a large site has no per-document bill

Reference: Software vs model local RAG uses FastEmbed with a small model on the same machine.

Proposal

  • Add a local embedding provider (e.g. FastEmbed / ONNX with a small model such as BGE-small) alongside the existing API providers.
  • Do not bundle the model in the Docker image. The model is downloaded when the user configures indexing in their workspace, then cached on a persistent volume.
  • When no API key is set, offer local embeddings as the default instead of the hash fallback.
  • Hosted FrontLit can keep its current provider.

Details to handle

  • Download progress and errors shown in workspace settings; indexing waits until the model is ready (keyword search keeps working meanwhile)
  • Configurable model cache path, and an option to pre-seed the model for air-gapped installs
  • Store the embedding model id and dimension with the index; changing models triggers a full reindex (vectors from different models can't be mixed)
  • Batching and CPU limits so indexing a large site doesn't starve the web server

Acceptance criteria

  • Docker image size unchanged (no model files baked in)
  • Choosing local embeddings in workspace settings downloads the model once and reuses it across restarts
  • Self-hosted install with no API key gets semantic results from the local model, not hash vectors
  • Switching models reindexes cleanly
  • Retrieval eval suite for help desk and chatbot answers #198 eval shows recall vs the hash fallback

Related

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions