File size: 687 Bytes
6754826 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | """
One-off: create the persistent OpenAI Vector Store used by anam's local RAG feature.
Run once:
OPENAI_API_KEY=sk-... python scripts/create_vector_store.py
Copy the printed id into OPENAI_VECTOR_STORE_ID (anam/.env locally, or a Hugging
Face Space repository secret in production) so uploaded documents survive restarts.
"""
import os
import sys
from openai import OpenAI
api_key = os.getenv("OPENAI_API_KEY")
if not api_key:
sys.exit("Set OPENAI_API_KEY in the environment before running this script.")
store = OpenAI(api_key=api_key).vector_stores.create(name="anam-local-rag")
print(f"Created vector store: {store.id}")
print(f"Set OPENAI_VECTOR_STORE_ID={store.id}")
|