JSPM

wise-rag

1.0.1
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 2
  • Score
    100M100P100Q9443F
  • License MIT

A lightweight RAG helper library (embeddings, splitter, in-memory store, Postgres adapter)

Package Exports

  • wise-rag
  • wise-rag/dist/index.cjs

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (wise-rag) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

my-rag-lib

Minimal RAG helper library with:

  • Text splitter
  • In-memory vector store (dev)
  • OpenAI Embeddings wrapper (official OpenAI Node SDK)

Usage:

  1. Install dependencies and build:
cd my-rag-lib
npm install
npm run build
  1. Example:
import { TextSplitter, InMemoryStore, OpenAIEmbeddings } from 'my-rag-lib';

const splitter = new TextSplitter(800, 200);
const parts = splitter.splitToDocuments('Long text...');

const emb = new OpenAIEmbeddings({ apiKey: process.env.OPENAI_API_KEY });
const vectors = await emb.embedBatch(parts.map(p => p.content));

const store = new InMemoryStore();
await store.add(parts, vectors);

const q = await emb.embed('query');
const results = await store.search(q, 3);