
Research
Malicious npm Packages Impersonate Flashbots SDKs, Targeting Ethereum Wallet Credentials
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.
A minimal TypeScript RAG pipeline, built on top of sqlite/libsql, supporting PDF and DOCX
RAGLite is a minimal, TypeScript-first Retrieval-Augmented Generation (RAG) pipeline. It's designed for simplicity, extensibility, and performance, supporting PDF and DOCX ingestion, local embeddings, and fast vector search using SQLite/LibSQL.
npm install raglite
Add documents to the data store:
import { load, search } from "raglite";
// Load a document from a file path
const records = await load("path/to/document.pdf");
records; // The chunked records created from the document
records[0].content; // The content of the document chunk
records[0].metadata; // The metadata of the document chunk
records[0].vector; // The vector of the document chunk
records[0].id; // The database id of the document chunk
// Load a document from a URL
await load("https://example.com/path/to/document.docx");
// Load a document from text
await load("Hello, world!");
// Include metadata with the document
await load("Hello, world!", {
source: "https://example.com/path/to/document.docx",
});
Search for relevant documents:
const results = await search("What is retrieval-augmented generation?");
console.log(results); // [{ content: "...", metadata: { source: "..." } }, ...]
You can customize the pipeline by passing in your own components.
Variable | Default | Description |
---|---|---|
DATABASE_URL | file:data/ragpipe.db | The URL of the SQLite/LibSQL database |
TABLE_NAME | embeddings | The name of the table to store the embeddings |
DIMENSIONS | 384 | The dimensions of the embeddings |
MODEL | sentence-transformers/all-MiniLM-L12-v2 | The model to use for embedding |
CHUNK_SIZE | 200 | The maximum number of words to embed per chunk |
OVERLAP | 0 | The number of words to overlap between chunks |
You can customize the pipeline by passing in your own components.
import {
Pipeline,
UrlLoader,
FileLoader,
PdfLoader,
DocxLoader,
EmbeddingLoader,
DataStoreLoader,
} from "raglite";
// Create a writer pipeline
const writer = new Pipeline([
new UrlLoader({
headers: {
Authorization: `Bearer ${process.env.TOKEN}`,
},
}), // add fetch request options
new FileLoader(),
new PdfLoader(),
new DocxLoader(),
new EmbeddingLoader({
model: "sentence-transformers/all-MiniLM-L6-v2",
chunkSize: 200,
overlap: 10,
}), // customize the embedding model
new DataStoreLoader({
databaseUrl: "path/to/database.db",
tableName: "documents",
dimensions: 384,
}), // customize the data store
]);
const records = await writer.load("path/to/document.pdf");
// Create a reader pipeline
const reader = new Pipeline([
new EmbeddingLoader(),
new DataStoreLoader({ search: true }),
]);
const results = await reader.search("What is retrieval-augmented generation?");
pnpm test
or npm test
pnpm build
or npm run build
MIT
Contributions, issues, and feature requests are welcome! Please open an issue or PR.
FAQs
A minimal TypeScript RAG pipeline, built on top of sqlite/libsql, supporting PDF and DOCX
The npm package raglite receives a total of 7 weekly downloads. As such, raglite popularity was classified as not popular.
We found that raglite demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.
Security News
Ruby maintainers from Bundler and rbenv teams are building rv to bring Python uv's speed and unified tooling approach to Ruby development.
Security News
Following last week’s supply chain attack, Nx published findings on the GitHub Actions exploit and moved npm publishing to Trusted Publishers.