Semantic search#
The tutorial catalogue is split into ~850 heading-level passages, embedded with a local fastembed model (ONNX, CPU, no API keys), and stored in an embedded Qdrant index — a real vector database that runs in-process, with no server to operate.
Build the index once (downloads the embedding model on first run):
pip install "pyxel-config-core[rag]"
pyxel-config index
(pyxel-config-index, the older spelling, still works: it prints a deprecation
notice and forwards to the same command.)
Then query it:
from pyxel_config_core import semantic_search
for m in semantic_search("how do I add dark current to the detector", limit=5):
print(f"{m.score:.3f} {m.group}/{m.model} §{m.section}")
Once the index is built, the library’s search_tutorials(query) uses it by
default and falls back to keyword search if the index or the RAG extra is
absent; pass semantic=False to force keywords or semantic=True to insist on
the index. The MCP tool search_pyxel_tutorials is keyword search unless it is
called with semantic=true, so an assistant gets the same answer on every
machine regardless of what has been built there. Point the index elsewhere with
PYXEL_CONFIG_CORE_INDEX=/path/to/dir.
Scale note: at ~850 passages a brute-force index would also work; Qdrant is used because it is a standard vector store, scales cleanly, and here runs embedded — so the retrieval design is production-shaped without a production dependency.