CSV (comma-separated values) is a text format for tabular data: fields are commonly separated by commas and records by lines. Its low-friction shape makes it useful both for saving a local dataset and for asking an LLM to return data that another program can load. section 5.1 section 6.10
A practical CSV-to-AI workflow looks like this:
- Place a CSV file such as population.csv in a local data directory. section 5.1
- Load the UTF-8 file with SimpleCSVReader and build a GPTVectorStoreIndex from its documents. section 5.1
- Name relevant column headers in the question, including what their values represent, rather than hoping the model guesses correctly. section 5.1
- Check returned values and calculations: a response identified Poland as nearest the median, while Myanmar was actually closer. section 5.1
Requesting machine-loadable history
For a historical server comparison, request one row per year and prescribe the headers: Year, clock speed (GHz), Maximum RAM (GB), and Total Drive Capacity (GB). CSV output can then be loaded into Python, although different LLMs may format the requested CSV differently. section 6.10
SimpleCSVReader = download_loader("SimpleCSVReader")
loader = SimpleCSVReader(encoding="utf-8")
documents = loader.load_data(file=Path('./data/population.csv'))
index = GPTVectorStoreIndex.from_documents(documents)
This listing loads population.csv through SimpleCSVReader and turns the loaded data into a GPTVectorStoreIndex for later questions. section 5.1














