Speakr is a personal, self-hosted web application designed for transcribing audio recordings
Python
Acknowledge API-mode embeddings in Inquire startup banner and lite-image docs
Murtaza Nasirb5a32bca1955
diff --git a/docs/admin-guide/model-configuration.md b/docs/admin-guide/model-configuration.mdindex ee7eb5bb..62c190c3 100644--- a/docs/admin-guide/model-configuration.md+++ b/docs/admin-guide/model-configuration.md@@ -454,7 +454,7 @@ EMBEDDING_API_KEY=sk-or-...EMBEDDING_MODEL=openai/text-embedding-3-large```-API mode does not require sentence-transformers to be installed, which makes it the natural fit for the lightweight Docker image (`learnedmachine/speakr:lite`). Semantic search still requires `scikit-learn` for cosine similarity; the lite image includes it.+API mode does not require sentence-transformers to be installed, so the lightweight Docker image (`learnedmachine/speakr:lite`) can now run full semantic search by combining `EMBEDDING_BASE_URL` with any compatible provider. The lite image already ships `openai` and `scikit-learn`, so no further dependencies are needed.### Compatibility Notediff --git a/docs/admin-guide/vector-store.md b/docs/admin-guide/vector-store.mdindex 76409f24..e0d287d5 100644--- a/docs/admin-guide/vector-store.md+++ b/docs/admin-guide/vector-store.md@@ -11,7 +11,11 @@ Before diving into management, it's worth understanding what you're managing. InThis approach goes beyond simple keyword matching. The system understands that "budget concerns" relates to "financial constraints" and "cost overruns" even though the exact words differ. This semantic understanding makes Inquire Mode powerful for discovering information that users might not remember precisely.!!! note "Lightweight Image"- If you're using the `lite` Docker image (`learnedmachine/speakr:lite`), the embedding model is not included. Inquire Mode still works but falls back to keyword-based text search instead of semantic search. To use full semantic search, switch to the `latest` image tag.+ The `lite` Docker image (`learnedmachine/speakr:lite`) ships without the local sentence-transformers model. Two options to enable semantic search on lite:+ - Set `EMBEDDING_BASE_URL` to an OpenAI-compatible embeddings endpoint (vLLM, OpenRouter, OpenAI, etc.). Inquire Mode then runs in full semantic-search mode using API-generated vectors. See [Model Configuration](model-configuration.md#configurable-embedding-model) for setup.+ - Switch to the `latest` image tag, which includes the local sentence-transformers model.++ Without either, Inquire Mode falls back to keyword-based text search.## The Embedding Modeldiff --git a/src/app.py b/src/app.pyindex 0e0bed3c..a5b22aff 100644--- a/src/app.py+++ b/src/app.py@@ -88,12 +88,26 @@ ENABLE_PUBLIC_SHARING = os.environ.get('ENABLE_PUBLIC_SHARING', 'true').lower()# Video retention - when enabled, video files keep their video stream for playbackVIDEO_RETENTION = os.environ.get('VIDEO_RETENTION', 'false').lower() == 'true'-# Log embedding status on startup+# Log embedding status on startup. Two paths can power Inquire mode: a local+# sentence-transformers model (full image) or an OpenAI-compatible HTTP+# provider (works in the lite image too, as long as scikit-learn is present+# for cosine similarity, which it is in both images).+_inquire_uses_api = bool(os.environ.get('EMBEDDING_BASE_URL', '').strip())+try:+ from sklearn.metrics.pairwise import cosine_similarity as _has_sklearn # noqa: F401+ _SKLEARN_AVAILABLE = True+except ImportError:+ _SKLEARN_AVAILABLE = False+if ENABLE_INQUIRE_MODE and EMBEDDINGS_AVAILABLE:- print("✅ Inquire Mode: Full semantic search enabled (embeddings available)")+ print("✅ Inquire Mode: Full semantic search enabled (local embedding model)")+elif ENABLE_INQUIRE_MODE and _inquire_uses_api and _SKLEARN_AVAILABLE:+ print("✅ Inquire Mode: Full semantic search enabled (API embedding provider)")+elif ENABLE_INQUIRE_MODE and _inquire_uses_api and not _SKLEARN_AVAILABLE:+ print("⚠️ Inquire Mode: Basic text search only (scikit-learn missing, cannot rank API embeddings)")elif ENABLE_INQUIRE_MODE and not EMBEDDINGS_AVAILABLE:print("⚠️ Inquire Mode: Basic text search only (embedding dependencies not available)")- print(" To enable semantic search, install: pip install sentence-transformers==2.7.0 huggingface-hub>=0.19.0")+ print(" To enable semantic search, install sentence-transformers locally OR set EMBEDDING_BASE_URL to use an OpenAI-compatible API.")elif not ENABLE_INQUIRE_MODE:print("ℹ️ Inquire Mode: Disabled (set ENABLE_INQUIRE_MODE=true to enable)")