@mastra/libsql
SQLite implementation for Mastra, providing both vector similarity search and general storage capabilities with connection pooling and transaction support.
Installation
npm install @mastra/libsql
Usage
Vector Store
import { LibSQLVector } from '@mastra/libsql';
const vectorStore = new LibSQLVector({
url: 'file:./my-db.db',
});
await vectorStore.createIndex({
indexName: 'my_vectors',
dimension: 3,
metric: 'cosine',
});
const ids = await vectorStore.upsert({
indexName: 'my_vectors',
vectors: [
[0.1, 0.2, 0.3],
[0.3, 0.4, 0.5],
],
metadata: [{ text: 'doc1' }, { text: 'doc2' }],
});
const results = await vectorStore.query({
indexName: 'my_vectors',
queryVector: [0.1, 0.2, 0.3],
topK: 10,
filter: { text: 'doc1' },
includeVector: false,
minScore: 0.5,
});
Documentation
Changelog
See the package changelog for version history and release notes.
Support
We have an open community Discord. Come and say hello and let us know if you have any questions or need any help getting things running.