Generated banner for Upstash Vector JS
Generated logo for Upstash Vector JS

Upstash Vector JS

UpstashOfficialCreated by Upstash

  • Skill
  • Tool integration
  • Data and AI
  • MIT
  • No issues found

From the author

Work with the @upstash/vector TypeScript/JavaScript SDK, a serverless vector database for embeddings, similarity search, semantic search, and RAG (retrieval-augmented generation). Use when upserting, querying, fetching, ranging, or deleting vectors, upserting raw text against an index with a built-in embedding model, choosing dense, sparse, or hybrid indexes, filtering by metadata, organizing data with namespaces, running resumable queries, or connecting Upstash Vector to an AI or LLM application. Also use when the user asks for a vector store, vector search, nearest-neighbor or kNN search, embeddings storage, semantic cache, recommendations or similarity features, or a hosted vector index that needs no infrastructure.
— the description by Upstash

AutoGineer summary

Written by AutoGineer from the skill’s own files, not by the author

This skill provides guidance for using the @upstash/vector TypeScript/JavaScript SDK. It covers the core functionality required to interact with a serverless vector database, including upserting vectors, performing similarity searches, managing namespaces, and utilizing metadata filtering. The skill serves as a reference for developers building AI and RAG applications who need to store and retrieve embeddings without managing infrastructure.

What it does

  • Provides methods for upserting, querying, fetching, and deleting vectors.
  • Explains how to organize data using namespaces.
  • Details the implementation of dense, sparse, and hybrid index structures.
  • Guides users on applying metadata filters during vector queries.
  • Supports the integration of vector storage into LLM and AI applications.
  • Offers instructions for running resumable queries and managing index information.

When to use it

  • When building RAG applications that require a vector database.
  • When implementing semantic search or recommendation features.
  • When you need to store and query vector embeddings in a serverless environment.
  • When you need to filter vector search results based on associated metadata.
  • When working with hybrid or sparse indexing strategies.

Advantages

  • Simplifies interaction with serverless vector storage via a dedicated SDK.
  • Provides clear patterns for managing vector data and namespaces.
  • Enables advanced search capabilities like hybrid indexing and metadata filtering.
  • Facilitates easy integration with AI and LLM workflows.

Usage examples

“How do I initialize the Upstash Vector client in TypeScript?”
The agent provides the code to import the Index class and initialize it using the required REST URL and token from environment variables.
“Show me how to perform a similarity search with metadata filtering.”
The agent demonstrates the index.query method, showing how to include the vector data and a filter object to narrow results by metadata.

Install

  1. Download the skill as a ZIP:

    https://mp-staging.autogineer.com/agent-skills/upstash/upstash-vector-js/download
  2. Unzip it into the cross-client skills folder of your project:

    mkdir -p .agents/skills && unzip upstash-vector-js.zip -d .agents/skills

Documentation by Upstash

Vector Documentation Skill

Bundled docs and source

Before writing or debugging SDK code, check node_modules/@upstash/vector/docs/ for bundled docs and node_modules/@upstash/vector/src/ for readable TypeScript source. Read and search the relevant files when present; otherwise use the references in this skill.

Quick Start

Vector is a high‑performance vector database for storing, querying, and managing vector embeddings.

Basic workflow:

  • Install the Vector TS SDK.

  • Connect to a Vector instance.

  • Upsert vectors, query them, and manage namespaces.

Example (TypeScript):

import { Index } from "@upstash/vector";
const index = new Index({
  url: process.env.UPSTASH_VECTOR_REST_URL!,
  token: process.env.UPSTASH_VECTOR_REST_TOKEN!,
});

await index.upsert([{ id: "1", vector: [0.1, 0.2], metadata: { tag: "example" } }]);

const results = await index.query({
  vector: [0.1, 0.2],
  topK: 5,
});

For full usage, refer to the linked skill files below.

Other Skill Files

TS SDK Reference
  • sdk-methods: Explains SDK commands: delete, fetch, info, query, range, reset, resumable-query, upsert

Features
  • features/namespaces: Explains namespaces and dataset organization.

  • features/index-structure: Covers hybrid and sparse index structures.

  • features/filtering-and-metadata: Details metadata storage and server-side filtering.

Use these files for deeper guidance on SDK usage, advanced configurations, algorithms, and integrations.

Files

sdk-methods.md

Vector TS SDK

Upsert

Add or update vectors. Also accepts raw text (data) to embed automatically.

Pitfalls

  • Vector dimension must match index dimension.

  • Passing both vector and data is invalid.

  • Metadata is optional but recommended for filtering.

Example (single + batch, mix of vector/data)

// Single vector
await index.upsert({ id: "1", vector: [0.1, 0.2], metadata: { type: "doc" } });

// Multiple vectors
await index.upsert(
  [
    { id: "2", vector: [0.2, 0.3] },
    { id: "3", vector: [0.3, 0.4], metadata: { tag: "a" } },
  ],
  { namespace: "ns" }
);

// Using data (auto‑embedding. Only works if the vector index has an embedding model)
await index.upsert({ id: "4", data: "A fantasy movie" });

Fetch

Retrieve vectors by exact ID or prefix.

Example

// Exact
const out = await index.fetch(["1", "2"], { includeMetadata: true });
// → [{ id: "1", metadata: {...} }, null]

// Prefix
await index.fetch({ prefix: "user-" });

Delete

Remove vectors by IDs, prefix, or metadata filter.

Pitfalls

  • Only one of ids, prefix, or filter can be used.

  • Using filter triggers an O(N) scan.

Example

await index.delete(["1", "2"]);
await index.delete({ prefix: "user-" });
await index.delete({ filter: "status = 'expired'" });

Query

Find the top‑K most similar vectors. Supports dense, sparse, hybrid, and embedded-on-demand queries.

Pitfalls

  • Query vector dimension must match index.

  • Scores are normalized 0–1 no matter the similarity metric.

Example

// Dense vector
const results = await index.query({
  vector: [0.1, 0.2],
  topK: 3,
  includeMetadata: true,
  filter: "genre = 'fantasy'",
});

// Data (auto‑embedding)
await index.query({ data: "epic fantasy adventure", topK: 2 });

Resumable Query

Long-running, chunked queries with server-side state.

Pitfalls

  • Remember to call stop() to free resources.

  • fetchNext(k) retrieves N more results.

Example

const { result, fetchNext, stop } = await index.resumableQuery({
  vector: [0.1, 0.2],
  topK: 50,
  maxIdle: 3600,
});

const next = await fetchNext(10);
await stop();

Range

Paginated, stateless scanning of vectors; recommended for large prefix fetches.

Pitfalls

  • Always pass cursor; set to 0 initially.

Example

let cursor = 0;
while (cursor !== null) {
  const page = await index.range({ cursor, limit: 100, includeMetadata: true });
  console.log(page.vectors);
  cursor = page.nextCursor;
}

Info

Retrieve index statistics.

Example

const info = await index.info();
/* Returns:
{
  vectorCount: number;
  pendingVectorCount: number;
  indexSize: number;
  dimension: number;
  similarityFunction: "COSINE" | "EUCLIDEAN" | "DOT_PRODUCT";
  denseIndex?: {
    dimension: number;
    similarityFunction: "COSINE" | "EUCLIDEAN" | "DOT_PRODUCT";
    embeddingModel?: string;
  };
  sparseIndex?: {
    embeddingModel?: string;
  };
  namespaces: Record<string, {
    vectorCount: number;
    pendingVectorCount: number;
  }>;
}
*/

Reset

Clear a namespace or the entire index.

Pitfalls

  • { all: true } must be explicit.

Example

await index.reset(); // default namespace
await index.reset({ namespace: "my-namespace" });
await index.reset({ all: true });

Advanced

Request Timeout
const index = new Index({
  url,
  token,
  signal: () => AbortSignal.timeout(1000),
});
Telemetry

Disable with env variable:

UPSTASH_DISABLE_TELEMETRY=1

Requirements and compatibility

Works with: Claude Code, Claude apps, OpenAI Codex, GitHub Copilot, Cursor, Gemini CLI, Kiro, OpenCode, Goose, Amp, Roo Code, JetBrains Junie, Factory Droid, Devin (ex-Windsurf), Mistral Vibe, OpenHands, Letta

“Works with” means the tool reads the open Agent Skills format; a skill written for one tool may use features others lack.

Security

No issues found by our static scan· No issues found

A static scan is not a guarantee. Skills are third-party content: review a skill before you let an agent use it.

Attribution and licence

Created by
Upstash
Publisher
Upstash (Official)
Source
upstash/skills · skills/upstash-vector-js · commit 9f9e3e5
Licence
MIT License (redistribution allowed)
  • LICENSE (added by AutoGineer from LICENSE)
  • ATTRIBUTION.md (written by AutoGineer)
Synced

AutoGineer is not affiliated with or endorsed by Upstash.

Download ZIP

The ZIP holds the skill’s files, its licence files and an ATTRIBUTION.md. Download upstash-vector-js.zip