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

@xanots/vector

v0.1.1

Published

Plug-and-play vector search & multimodal Gemini embedding pipeline (document/chunk tables, ingestion, chunking strategies, management APIs, and agent tool) as typed XanoTS defs.

Readme

@xanots/vector

npm version License: MIT

A complete, production-grade vector embedding, document ingestion, chunking, and semantic similarity search module for XanoTS. Built around Google Gemini Multimodal Embeddings 2 (gemini-embedding-2) at 768 dimensions with native PostgreSQL pgvector indexing and AI agent search tools.


Features

  • Gemini Embeddings 2: Native multimodal embeddings across text, images (PNG, JPEG, WebP), audio (WAV, MP3), and video (MP4) scaled to 768 dimensions via Matryoshka Representation Learning (MRL).
  • Cross-Modal Vector Search: Seamlessly search text-to-text, text-to-image, image-to-image, or visual queries using cosine similarity (vector_cosine_ops).
  • Configurable Chunking: Multi-strategy text segmentation (paragraph, sentence, markdown, fixed, custom) with configurable chunk size and character overlap.
  • Document Management: Complete lifecycle tracking (pending, indexing, indexed, failed), multi-chunk storage, and atomic reindexing.
  • AI Agent & MCP Tool: Ready-to-use vector_search tool definition for Xano LLM agents and MCP toolsets.
  • Typed Client Interfaces: End-to-end type safety for request payloads and responses with zero runtime overhead.

Installation

npm install @xanots/vector @xanots/sdk

Quickstart

import { workspace, workspaceConfig } from "@xanots/sdk";
import { registerVector } from "@xanots/vector";

const ws = workspace("my-app").registerWorkspace(
  workspaceConfig({
    name: "my-app",
    env: {
      GEMINI_API_KEY: process.env.GEMINI_API_KEY!,
    },
  }),
);

export const vector = registerVector(ws, {
  apiKeyEnv: "GEMINI_API_KEY",
  defaultStrategy: "markdown",
});

export default vector.xano;

Configuration Options

| Option | Type | Default | Description | | :--- | :--- | :--- | :--- | | apiKeyEnv | string | "GEMINI_API_KEY" | Environment variable name storing the Google Gemini API key. | | model | string | "gemini-embedding-2" | Embedding model identifier (gemini-embedding-2). | | defaultStrategy | ChunkStrategy | "paragraph" | Default chunking strategy: fixed, paragraph, sentence, markdown, custom. | | defaultChunkSize | number | 500 | Target character count per chunk (20 to 10000). | | defaultChunkOverlap | number | 50 | Overlap character count between consecutive chunks (>= 0 and < size). | | searchLimit | number | 10 | Default top-k results returned by vector search (1 to 100). | | searchThreshold | number | 0.0 | Default cosine similarity threshold (0.0 to 1.0). | | authTable | TableDef \| string | undefined | User authentication table for multi-tenant ownership scoping. | | authenticated | boolean | false | When true, scopes documents and endpoints to $auth.id. | | routePrefix | string | "vector" | URL route prefix for generated API endpoints. | | canonical | string | undefined | Canonical URL slug for the API group. |


API Endpoints

All endpoints are registered under the configured API Group (default route: /api:vector/vector/*):

| Verb | Path | Description | | :--- | :--- | :--- | | POST | /documents/create | Ingest and index a new text document or multimodal media asset. | | GET | /documents | List uploaded documents with pagination. | | GET | /documents/{id} | Retrieve a document and all of its vector chunks. | | DELETE | /documents/{id}/delete | Delete a document and cascade-delete its chunks. | | POST | /documents/{id}/reindex | Re-chunk and re-embed an existing document. | | POST | /search | Perform cosine similarity search (text, image, or raw vector). | | POST | /embed | Directly generate a 768-dim vector embedding for text or media. |


Examples

1. Ingesting Text Documents

await fetch("https://your-instance.xano.io/api:vector/vector/documents/create", {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({
    title: "System Architecture Guide",
    content: "# System Architecture\nOur service runs on Kubernetes with PostgreSQL...",
    mime_type: "text/markdown",
    strategy: "markdown",
    chunk_size: 400,
    chunk_overlap: 40,
  }),
});

2. Ingesting Multimodal Assets (Images, Audio, Video)

await fetch("https://your-instance.xano.io/api:vector/vector/documents/create", {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({
    title: "Product Diagram",
    content: "Diagram illustrating cloud sync architecture.",
    media_data: "<base64_image_data>",
    mime_type: "image/png",
    metadata: { category: "diagrams", width: 1024, height: 768 },
  }),
});

3. Cross-Modal Semantic Search

// Search using a natural language query
const res = await fetch("https://your-instance.xano.io/api:vector/vector/search", {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({
    query: "Find architecture diagrams explaining cloud sync",
    limit: 5,
  }),
});
const { results, count } = await res.json();

AI Agent Search Tool

Include the vector_search tool directly in your LLM agent or MCP toolset definitions:

import { agent } from "@xanots/sdk";
import { vector } from "./vector-setup.js";

export const ragAgent = agent({
  name: "support_agent",
  instructions: "Answer user inquiries using the vector search tool to retrieve knowledge.",
  tools: [vector.searchTool],
});

License

MIT