# File Objective : CLI for the retrieval pipeline — verify hybrid search + rerank. # Scope : Dev script — accepts a query, prints top-5 chunks with scores. # What it does : Calls retrieve() and formats results to stdout. # What it does not: Call an LLM or return a natural-language answer. from __future__ import annotations import sys from vantage_core.adapters.embedder_st import STEmbedder from vantage_core.adapters.reranker_cross_encoder import CrossEncoderReranker from vantage_core.adapters.vector_qdrant import QdrantVectorRepo from vantage_core.domain.retrieval import retrieve def main() -> None: query = " ".join(sys.argv[1:]).strip() or input("Query: ").strip() if not query: print("No query provided.") sys.exit(1) print(f"\n── Search: {query!r} ────────────────────────────────────────") results = retrieve( query = query, embedder = STEmbedder(), repo = QdrantVectorRepo(), reranker = CrossEncoderReranker(), ) if not results: print(" No results — run scripts/ingest.py first.") sys.exit(1) for rank, sc in enumerate(results, start=1): c = sc.chunk print(f"\n [{rank}] score={sc.score:.4f} category={c.category}") print(f" title : {c.title}") print(f" text : {c.chunk_text[:200]}") print() if __name__ == "__main__": main()