Spaces:
Sleeping
Sleeping
File size: 1,057 Bytes
f866820 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# RAG-document-assistant/scripts/check_index_metadata.py
"""
Check Pinecone index metadata using pinecone>=5.x SDK.
Purpose:
Checks and displays metadata for the configured Pinecone index, including dimensions,
metric type, and vector count. Ensures the index configuration matches the ingestion pipeline.
Inputs:
Uses configuration from src.config (PINECONE_API_KEY, PINECONE_INDEX_NAME)
Outputs:
Prints index metadata and statistics to stdout
Usage:
python scripts/check_index_metadata.py
"""
import os
import sys
from pinecone import Pinecone
# Add parent to path for config import
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
import src.config as cfg
def main():
pc = Pinecone(api_key=cfg.PINECONE_API_KEY)
index_name = cfg.PINECONE_INDEX_NAME
idx = pc.Index(index_name)
# Stats call provides useful metadata
stats = idx.describe_index_stats()
print("Index:", index_name)
print("describe_index_stats():")
print(stats)
if __name__ == "__main__":
main() |