npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@matteuccimarco/slim-vector-db

v0.1.0

Published

SLIM compression for vector database metadata (Pinecone, Chroma, Qdrant, Weaviate)

Readme

@matteuccimarco/slim-vector-db

SLIM compression for vector database metadata. Reduce metadata storage by 40-50% in Pinecone, Chroma, and other vector databases.

Installation

npm install @matteuccimarco/slim-vector-db

Quick Start

Pinecone

import { Pinecone } from '@pinecone-database/pinecone';
import { SlimPinecone } from '@matteuccimarco/slim-vector-db/pinecone';

const pinecone = new Pinecone({ apiKey: process.env.PINECONE_API_KEY });

const slim = new SlimPinecone({
  client: pinecone,
  indexName: 'my-index',
  preserveFields: ['category'], // Keep for filtering
});

// Upsert with SLIM-encoded metadata
await slim.upsert([
  {
    id: 'doc-1',
    values: [0.1, 0.2, 0.3, ...],
    metadata: {
      category: 'tech',           // Preserved for filtering
      content: 'Long text...',    // SLIM-encoded
      attributes: {               // SLIM-encoded
        author: 'Alice',
        tags: ['ai', 'ml'],
      },
    },
  },
]);

// Query with automatic decoding
const results = await slim.query({
  vector: [0.1, 0.2, 0.3, ...],
  topK: 10,
  filter: { category: 'tech' },
});

console.log(results[0].metadata);
// { category: 'tech', content: 'Long text...', attributes: { author: 'Alice', tags: ['ai', 'ml'] } }

ChromaDB

import { ChromaClient } from 'chromadb';
import { SlimChroma } from '@matteuccimarco/slim-vector-db/chroma';

const chroma = new ChromaClient();

const slim = new SlimChroma({
  client: chroma,
  preserveFields: ['source'],
});

const collection = await slim.getOrCreateCollection('documents');

// Add with SLIM-encoded metadata
await collection.add({
  ids: ['doc-1', 'doc-2'],
  embeddings: [[0.1, 0.2], [0.3, 0.4]],
  metadatas: [
    { source: 'file.pdf', content: { page: 1, text: '...' } },
    { source: 'file.pdf', content: { page: 2, text: '...' } },
  ],
});

// Query with automatic decoding
const results = await collection.query({
  queryEmbeddings: [[0.1, 0.2]],
  nResults: 5,
});

How It Works

Metadata is stored with SLIM encoding:

// Original metadata
{
  category: 'tech',
  attributes: { author: 'Alice', tags: ['ai', 'ml'], rating: 4.5 }
}

// Stored in vector DB (with SLIM)
{
  category: 'tech',  // Preserved for filtering
  attributes: '__slim__{author:Alice,tags:@[ai,ml],rating:#4.5}'  // ~40% smaller
}

Options

const slim = new SlimPinecone({
  client: pinecone,
  indexName: 'my-index',

  // Fields to compress (default: all object fields)
  slimFields: ['content', 'attributes'],

  // Fields to keep uncompressed (for filtering)
  preserveFields: ['category', 'timestamp'],

  // Disable SLIM (pass-through mode)
  enabled: true,
});

API Reference

SlimPinecone

class SlimPinecone {
  upsert(vectors: VectorRecord[], namespace?: string): Promise<void>;
  query(options: QueryOptions): Promise<QueryResult[]>;
  fetch(ids: string[], namespace?: string): Promise<Record<string, VectorRecord>>;
  delete(ids: string[], namespace?: string): Promise<void>;
  deleteAll(namespace?: string): Promise<void>;
}

SlimChroma

class SlimChroma {
  getOrCreateCollection(name: string): Promise<SlimCollection>;
  getCollection(name: string): Promise<SlimCollection>;
  deleteCollection(name: string): Promise<void>;
  listCollections(): Promise<string[]>;
}

class SlimCollection {
  add(params: AddParams): Promise<void>;
  query(params: QueryParams): Promise<QueryResults>;
  get(params: GetParams): Promise<GetResults>;
  update(params: UpdateParams): Promise<void>;
  upsert(params: UpsertParams): Promise<void>;
  delete(params: DeleteParams): Promise<void>;
  count(): Promise<number>;
}

Benchmarks

| Metadata Type | JSON Size | SLIM Size | Savings | |---------------|-----------|-----------|---------| | Document chunk | 500 bytes | 290 bytes | 42% | | Product data | 2 KB | 1.1 KB | 45% | | User profile | 1.5 KB | 850 bytes | 43% |

Use Cases

  • RAG Applications: Compress document metadata
  • E-commerce: Compact product attributes
  • Recommendation Systems: Reduce user profile storage
  • Knowledge Bases: Efficient entity metadata

License

MIT