Want GPT to answer questions about your organization’s CSVs instead of making you scroll through them like a digital archaeologist? GPTSimpleVectorIndex, also used as GPTVectorStoreIndex, turns source documents into an embedding-backed index that LlamaIndex can query. section 5.1
A practical workflow looks like this:
- Install LlamaIndex, confirm Python and pip, and provide an OpenAI API key. section 5.1
- Load a local file with a reader such as SimpleCSVReader. section 5.1
- Build the index with GPTVectorStoreIndex.from_documents(documents). section 5.1
- Create a query engine and ask natural-language questions about the indexed data. section 5.1
Querying a population CSV
After indexing data/population.csv, a query about the pop2010 column returns Canada’s 2010 population; another identifies Poland as closest to the median population. section 5.1
SimpleCSVReader = download_loader("SimpleCSVReader")
loader = SimpleCSVReader(encoding="utf-8")
documents = loader.load_data(file=Path('./data/population.csv'))
index = GPTVectorStoreIndex.from_documents(documents)
Inspect the compact Python path for loading a CSV and constructing the vector index. section 5.1
