| from __future__ import annotations |
|
|
| import argparse |
| import logging |
|
|
|
|
| try: |
| from _bootstrap import add_project_root_to_path |
| except ModuleNotFoundError: |
| from scripts._bootstrap import add_project_root_to_path |
|
|
|
|
| add_project_root_to_path() |
|
|
| from src.config import load_settings |
| from src.vector_store import VectorStore |
|
|
|
|
| logging.basicConfig(level=logging.INFO, format="%(levelname)s:%(name)s:%(message)s") |
| logger = logging.getLogger(__name__) |
|
|
|
|
| def main() -> None: |
| parser = argparse.ArgumentParser(description="Clear the configured Upstash Vector namespace.") |
| parser.add_argument("--yes", action="store_true", help="Skip the interactive confirmation prompt.") |
| args = parser.parse_args() |
|
|
| settings = load_settings() |
| logger.warning("This will delete all vectors in namespace: %s", settings.upstash_namespace) |
| if not args.yes: |
| confirmation = input("Type YES to continue: ") |
| if confirmation != "YES": |
| logger.info("Cancelled.") |
| return |
|
|
| vector_store = VectorStore(settings) |
| vector_store.clear_namespace() |
| logger.info("Namespace cleared: %s", settings.upstash_namespace) |
|
|
|
|
| if __name__ == "__main__": |
| main() |
|
|
|
|