Skip to content
Skillv1.0.0

pinecone

Pinecone is a managed vector database for AI and machine learning applications. Learn to create indexes, upsert embeddings, query by similarity, use namespaces and metadata filtering for semantic sear

by terminalskills(0) 0 installs
Free
Sign in to install

Free account. Installing gives you the manifest plus copy-paste snippets.

See reviews

About

Imported from terminalskills/skills (skills/pinecone/SKILL.md). Install upstream with npx skills add terminalskills/skills --skill pinecone. Copyright stays with the author (Apache-2.0).

Pinecone

Pinecone is a fully managed vector database that makes it easy to store, index, and query high-dimensional vectors for similarity search, recommendation systems, and RAG (Retrieval-Augmented Generation).

Installation

# Node.js client
npm install @pinecone-database/pinecone

# Python client
pip install pinecone-client

Create an Index

// create-index.js: Initialize Pinecone and create a serverless index
const { Pinecone } = require('@pinecone-database/pinecone');

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

async function createIndex() {
  await pc.createIndex({
    name: 'knowledge-base',
    dimension: 1536, // OpenAI text-embedding-3-small
    metric: 'cosine',
    spec: {
      serverless: {
        cloud: 'aws',
        region: 'us-east-1',
      },
    },
  });
}

createIndex().catch(console.error);

Upsert Vectors

// upsert.js: Store embeddings with metadata in Pinecone
const index = pc.index('knowledge-base');

// Upsert vectors with metadata
await index.namespace('articles').upsert([
  {
    id: 'article-1',
    values: embedding1, // Float32Array of dimension 1536
    metadata: {
      title: 'Introduction to Vector Databases',
      source: 'blog',
      category: 'technology',
      published: '2026-01-15',
    },
  },
  {
    id: 'article-2',
    values: embedding2,
    metadata: {
      title: 'Building RAG Applications',
      source: 'docs',
      category: 'ai',
      published: '2026-02-01',
    },
  },
]);

Query Vectors

// query.js: Find similar vectors with metadata filtering
const index = pc.index('knowledge-base');

// Simple similarity search
const results = await index.namespace('articles').query({
  vector: queryEmbedding,
  topK: 5,
  includeMetadata: true,
  includeValues: false,
});

results.matches.forEach(match => {
  console.log(`${match.id}: ${match.score} — ${match.metadata.title}`);
});

// Query with metadata filter
const filtered = await index.namespace('articles').query({
  vector: queryEmbedding,
  topK: 10,
  filter: {
    category: { $eq: 'technology' },
    published: { $gte: '2026-01-01' },
  },
  includeMetadata: true,
});

Python Client

# app.py: Pinecone with Python client
from pinecone import Pinecone
import os

pc = Pinecone(api_key=os.environ['PINECONE_API_KEY'])
index = pc.Index('knowledge-base')

# Upsert
index.upsert(
    vectors=[
        {'id': 'doc-1', 'values': embedding, 'metadata': {'title': 'Hello'}},
    ],
    namespace='articles',
)

# Query
results = index.query(
    namespace='articles',
    vector=query_embedding,
    top_k=5,
    include_metadata=True,
    filter={'category': {'$eq': 'technology'}},
)

for match in results['matches']:
    print(f"{match['id']}: {match['score']:.3f}{match['metadata']['title']}")

# List and delete
index.delete(ids=['doc-1'], namespace='articles')
index.delete(delete_all=True, namespace='old-data')

RAG Pipeline Example

// rag.js: Retrieval-Augmented Generation with Pinecone + OpenAI
const { OpenAI } = require('openai');
const { Pinecone } = require('@pinecone-database/pinecone');

const openai = new OpenAI();
const pc = new Pinecone({ apiKey: process.env.PINECONE_API_KEY });
const index = pc.index('knowledge-base');

async function askQuestion(question) {
  // 1. Generate embedding for the question
  const embeddingRes = await openai.embeddings.create({
    model: 'text-embedding-3-small',
    input: question,
  });
  const queryVector = embeddingRes.data[0].embedding;

  // 2. Find relevant documents
  const searchResults = await index.namespace('articles').query({
    vector: queryVector,
    topK: 5,
    includeMetadata: true,
  });

  const context = searchResults.matches
    .map(m => m.metadata.content)
    .join('\n\n');

  // 3. Generate answer with context
  const completion = await openai.chat.completions.create({
    model: 'gpt-4o',
    messages: [
      { role: 'system', content: `Answer based on this context:\n\n${context}` },
      { role: 'user', content: question },
    ],
  });

  return completion.choices[0].message.content;
}

Index Management

// manage.js: List, describe, and manage Pinecone indexes
// List all indexes
const indexes = await pc.listIndexes();
console.log(indexes);

// Describe index stats
const stats = await index.describeIndexStats();
console.log(stats); // { dimension, totalRecordCount, namespaces: {...} }

// Delete a namespace
await index.namespace('old-data').deleteAll();

// Delete the entire index
await pc.deleteIndex('knowledge-base');

Use it

Copy one of these into your project. Installing also returns the manifest and these snippets.

yaml
targets:
  - https://api.opensmartroute.ai/api/v1/registry/terminalskills-skills-pinecone/manifest   # or paste the manifest below

Manifest

An Open Capability Manifest: the router reads it to know what this does, what it costs and when to pick it.

terminalskills-skills-pinecone.ocm.jsonjson
{
  "ocm": "1",
  "id": "terminalskills-skills-pinecone",
  "kind": "skill",
  "name": "pinecone",
  "description": "Pinecone is a managed vector database for AI and machine learning applications. Learn to create indexes, upsert embeddings, query by similarity, use namespaces and metadata filtering for semantic search and RAG pipelines.",
  "publisher": "terminalskills",
  "version": "1.0.0",
  "capabilities": {
    "domains": [
      "data_analysis"
    ],
    "tags": [
      "skill-md",
      "pinecone",
      "vector-database",
      "embeddings",
      "ai",
      "semantic-search",
      "skills-sh"
    ],
    "languages": [
      "en"
    ]
  },
  "quality_prior": 0.6,
  "examples": [
    "Pinecone is a managed vector database for AI and machine learning applications. Learn to create indexes, upsert embeddings, query by similarity, use namespaces and metadata filtering for semantic search and RAG pipelines."
  ],
  "primary": false,
  "metadata": {
    "source": {
      "provider": "skills.sh",
      "repository": "https://github.com/terminalskills/skills",
      "path": "skills/pinecone/SKILL.md",
      "ref": "HEAD",
      "url": "https://github.com/terminalskills/skills/blob/HEAD/skills/pinecone/SKILL.md",
      "key": "terminalskills/skills/skills/pinecone/SKILL.md"
    },
    "compatibility": "macos, linux, windows",
    "license": "Apache-2.0"
  },
  "instructions": "# Pinecone\n\nPinecone is a fully managed vector database that makes it easy to store, index, and query high-dimensional vectors for similarity search, recommendation systems, and RAG (Retrieval-Augmented Generation).\n\n## Installation\n\n```bash\n# Node.js client\nnpm install @pinecone-database/pinecone\n\n# Python client\npip install pinecone-client\n```\n\n## Create an Index\n\n```javascript\n// create-index.js: Initialize Pinecone and create a serverless index\nconst { Pinecone } = require('@pinecone-database/pinecone');\n\nconst pc = new Pinecone({ apiKey: process.env.PINECONE_API_KEY });\n\nasync function cr",
  "cost": {
    "context_tokens": 1160
  }
}

Fetch it by URL: GET /api/v1/registry/terminalskills-skills-pinecone/manifest?version=1.0.0

Reviews

Star ratings from people who tried it. One review per account; edit yours any time.

No reviews yet. Install it, try it, and be the first to rate it.