vantage / scripts /peek.py
sourabh gupta
feat(p2): implement data ingestion pipeline with dense and BM25 sparse vectors
6985a83
Raw
History Blame Contribute Delete
1.46 kB
# File Objective : Verify the Qdrant collection was populated correctly.
# Scope : Phase 2 pass/fail gate β€” run after scripts/ingest.py.
# What it does : 1. Prints total point count. 2. Shows one sample chunk payload.
# What it does not: 1. Run search (Phase 3). 2. Modify anything.
from __future__ import annotations
import sys
from qdrant_client import QdrantClient
from vantage_core.config import get_settings
from vantage_core.constants import QDRANT_COLLECTION_NAME
def main() -> None:
s = get_settings()
client = QdrantClient(url=s.qdrant_url, api_key=s.qdrant_api_key, timeout=15)
count = client.count(QDRANT_COLLECTION_NAME).count
print(f"\n── Vantage Peek ────────────────────────────────────────────")
print(f" collection : {QDRANT_COLLECTION_NAME}")
print(f" total pts : {count}")
if count == 0:
print(" ⚠️ Empty β€” run scripts/ingest.py first.")
sys.exit(1)
results, _ = client.scroll(
QDRANT_COLLECTION_NAME, limit=1, with_payload=True, with_vectors=False
)
if results:
p = results[0]
print(f"\n Sample chunk (id={p.id}):")
for key in ("chunk_id", "category", "title", "chunk_text"):
print(f" {key:<12}: {str((p.payload or {}).get(key, 'β€”'))[:100]}")
print()
if __name__ == "__main__":
main()