This example searches an auditable AI-infrastructure knowledge bundle containing
News, Earnings, and a pre-V1 LegacyPaper tree. New paper ingestion uses
PaperSemanticResult and LocalKnowledgeLibrary.put_paper(); the legacy type is
retained only so this existing bundle remains readable.
Put OPENAI_API_KEY in the repository .env, then run from the repository root:
python examples/library/semantic_search.pyThe bundled SQLite database already contains six 1536-dimensional
text-embedding-3-small document targets. Running the example embeds only the
query, then uses LocalKnowledgeLibrary.open(), search(), and get() to show
ranked evidence and tree paths.
semantic_search.pyis the user-facing query example.data/ai_infrastructure.jsonis the canonical, reviewable source bundle.data/ai_infrastructure.dbis the generated SQLite library with canonical records and model-specific embeddings. Do not edit it directly.
Regenerate the database after changing the source JSON, library schema, retrieval-target rules, embedding model, or dimension:
python scripts/examples/build_ai_infrastructure_bundle.pyThe build validates every source item as canonical QuantMind knowledge and removes an incomplete database if embedding generation fails.
See the library guide for storage, retrieval-grain, and financial-time semantics.