All skills
upstash avatar

/upstash-vector-js

@36daab8
by upstashupstash/skills27 stars
7

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.

Use this Skill: https://skilld.dev/gh/upstash/skills/upstash-vector-js

This session only. Nothing lands on disk.

featuresfiltering-and-metadata.md

≈549 tokens on demand. Your agent reads this file only when SKILL.md points to it.

Vector Feature: Filtering and Metadata

Upstash Vector supports attaching metadata and optional data to vectors. Metadata is structured JSON used for filtering; data is unstructured content returned in responses but not filterable.

Filtering uses a SQL‑like syntax and supports nested objects, array indexing, glob patterns, and boolean logic. The system applies both in‑filtering and post‑filtering according to a filtering budget, so highly selective filters may return fewer results than topK.

Setting Metadata and Data

You can upsert vectors with metadata and optional data. Metadata is any JSON structure; data is typically raw text.

import { Index } from "@upstash/vector";

const index = new Index({ url: "...", token: "..." });

await index.upsert([
  {
    id: "v0",
    vector: [0.1, 0.2],
    metadata: { city: "Istanbul", population: 15460000 },
    data: "Istanbul info",
  },
  {
    id: "v1",
    data: "Upstash is a serverless data platform.",
  },
]);

Querying with Metadata Filters

Include metadata in results and apply filters using SQL‑like expressions.

await index.query({
  vector: [0.9, 0.3],
  topK: 5,
  includeMetadata: true,
  filter: "population >= 1000000 AND geography.continent = 'Asia'",
});

Supported Operators

  • Equality: =, !=
  • Numeric comparators: <, <=, >, >=
  • Set membership: IN, NOT IN
  • Array tests: CONTAINS, NOT CONTAINS
  • Field existence: HAS FIELD, HAS NOT FIELD
  • Glob string matching: GLOB, NOT GLOB

Glob wildcards: *, ?, [], [^].

Boolean Logic

Use AND and OR, with parentheses for grouping. AND has higher precedence than OR.

Nested Objects and Arrays

  • Access nested fields: economy.currency, geography.coordinates.latitude.
  • Index arrays: industries[0] or from end: industries[#-1].

Example:

economy.major_industries CONTAINS 'Tourism' AND geography.coordinates.latitude >= 35

Retrieving Metadata and Data

// query
await index.query({
  vector: [0.9, 0.3],
  topK: 5,
  includeMetadata: true,
  includeData: true,
});

// range
await index.range({ cursor: "0", limit: 3, includeMetadata: true });

Source: SKILL.md on GitHub

No alerts16d3 checks · Risk SAFE
  • Gen Agent Trust Hub16d

    This skill provides documentation and usage examples for the Upstash Vector TypeScript SDK. It follows security best practices by utilizing environment variables for secret management and official vendor libraries. No malicious patterns or security vulnerabilities were detected.

  • Socket16d

    No alerts

  • Snyk16d

    Risk: LOW · No issues

Signed by skilld at 36daab8. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub 5 days ago.

Activeupdated last month
metadata
{
  "author": "Upstash",
  "homepage": "https://upstash.com"
}

README badge

README badge for upstash/skills/upstash-vector-js