pulseDemo / lm_index.py
svummidi's picture
Update lm_index.py
942e8e6
raw
history blame
404 Bytes
from llama_index import GPTSimpleVectorIndex, SimpleDirectoryReader
from pathlib import Path
from llama_index import download_loader
import os
os.environ["OPENAI_API_KEY"] = "REPLACE"
PandasCSVReader = download_loader("PandasCSVReader")
loader = PandasCSVReader()
documents = loader.load_data(file=Path('./retro/retro.csv'))
index = GPTSimpleVectorIndex(documents)
index.save_to_disk('index.json')