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:
- Install dependencies and build:
cd my-rag-lib
npm install
npm run build- 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);