> ## Documentation Index
> Fetch the complete documentation index at: https://llm-tools.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# 📊 CSV

You can load any csv file from your local file system or through a URL.
Headers are included for each line, so if you have an `age` column, `18` will be added as `age: 18`.

## Install CSV addon

```bash theme={null}
npm install @llm-tools/embedjs-loader-csv
```

## Usage

### Load from a local file

```ts theme={null}
import { RAGApplicationBuilder } from '@llm-tools/embedjs';
import { OpenAiEmbeddings } from '@llm-tools/embedjs-openai';
import { HNSWDb } from '@llm-tools/embedjs-hnswlib';
import { CsvLoader } from '@llm-tools/embedjs-loader-csv';

const app = await new RAGApplicationBuilder()
.setModel(SIMPLE_MODELS.OPENAI_GPT4_O)
.setEmbeddingModel(new OpenAiEmbeddings())
.setVectorDatabase(new HNSWDb())
.build();

app.addLoader(new CsvLoader({ filePathOrUrl: '/path/to/file.csv' }))
```

### Load from URL

```ts theme={null}
import { RAGApplicationBuilder } from '@llm-tools/embedjs';
import { OpenAiEmbeddings } from '@llm-tools/embedjs-openai';
import { HNSWDb } from '@llm-tools/embedjs-hnswlib';
import { CsvLoader } from '@llm-tools/embedjs-loader-csv';

const app = await new RAGApplicationBuilder()
.setModel(SIMPLE_MODELS.OPENAI_GPT4_O)
.setEmbeddingModel(new OpenAiEmbeddings())
.setVectorDatabase(new HNSWDb())
.build();

app.addLoader(new CsvLoader({ filePathOrUrl: 'https://people.sc.fsu.edu/~jburkardt/data/csv/airtravel.csv' }))
```
