---
title: LanceDB
---

LanceDB is a developer-friendly, open source database with great performance.
From hyper scalable vector search and advanced retrieval for RAG, to streaming training data and interactive exploration of large scale AI datasets.
You can run LanceDB locally and it is integrated into the LanceDb addon for EmbedJs.

## Install LanceDB addon

```bash
npm install @llm-tools/embedjs-lancedb
```

## Usage
<CodeGroup>
```ts Example
import { RAGApplicationBuilder } from '@llm-tools/embedjs';
import { OpenAiEmbeddings } from '@llm-tools/embedjs-openai';
import { LanceDb } from '@llm-tools/embedjs-lancedb';
import { WebLoader } from '@llm-tools/embedjs-loader-web';

// set OPENAI_API_KEY in your env
process.env.OPENAI_API_KEY = "sk-xxx";

const app = await new RAGApplicationBuilder()
.setEmbeddingModel(new OpenAiEmbeddings())
.setModel(SIMPLE_MODELS.OPENAI_GPT4_O)
.setVectorDatabase(
    new LanceDb({
        path: './lmdb',
    }),
)
.build();


//add data source and start query it
await app.addLoader(new WebLoader({ urlOrContent: 'https://www.forbes.com/profile/elon-musk' }));
await app.query('Tell me about Elon Musk');
```
</CodeGroup>

<Snippet file="missing-vector-db-tip.mdx" />
