> ## 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.

# LibSQL

LibSQL is an open source fork of SQLite and in most cases it is a drop in replacement for SQLite. It has native in-built support for vector similarity search.
Read more about LibSQL's support for AI [here](https://docs.turso.tech/features/ai-and-embeddings).
You can run LibSQL locally with EmbedJs and is available via the LibSQL extension for embedJs.

<Note>
  LibSql can also be used to store conversations and other data generated in embedJs.
  This is done via the LibSqlStore available in the LibSQL extension for embedJs. Read more about it [here](/components/stores/libsql)
</Note>

## Install LibSQL addon

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

## Usage

<CodeGroup>
  ```ts Example theme={null}
  import { RAGApplicationBuilder } from '@llm-tools/embedjs';
  import { OpenAiEmbeddings } from '@llm-tools/embedjs-openai';
  import { WebLoader } from '@llm-tools/embedjs-loader-web';
  import { LibSqlDb } from '@llm-tools/embedjs-libsql';

  // set OPENAI_API_KEY in your env
  process.env.OPENAI_API_KEY = "sk-xxx";

  const app = await new RAGApplicationBuilder()
  .setVectorDatabase(new LibSqlDb({ path: './data.db' }))
  .setEmbeddingModel(new OpenAiEmbeddings())
  .setModel(SIMPLE_MODELS.OPENAI_GPT4_O)
  .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" />
