Why Pinecone?
Pinecone is a fully managed vector database built for production AI. No infrastructure, no tuning — just fast, scalable similarity search.
Free tier (Starter): 100K vectors, 1 index, 2 GB storage.
Getting Started
pip install pinecone-client
from pinecone import Pinecone, ServerlessSpec
pc = Pinecone(api_key="YOUR_API_KEY")
# Create index
pc.create_index(
name="products",
dimension=1536, # OpenAI ada-002
metric="cosine",
spec=ServerlessSpec(cloud="aws", region="us-east-1")
)
index = pc.Index("products")
# Upsert vectors
index.upsert(vectors=[
("prod-1", [0.1, 0.2, ...], {"name": "Laptop", "price": 999}),
("prod-2", [0.3, 0.4, ...], {"name": "Phone", "price": 699})
])
# Query
results = index.query(vector=[0.1, 0.2, ...], top_k=5, include_metadata=True)
for match in results.matches:
print(f"{match.metadata[name]}: {match.score:.3f}")
# Filtered query
results = index.query(
vector=query_vec,
top_k=5,
filter={"price": {"$lt": 800}}
)
JavaScript
import { Pinecone } from "@pinecone-database/pinecone";
const pc = new Pinecone({ apiKey: "YOUR_API_KEY" });
const index = pc.index("products");
await index.upsert([{ id: "doc-1", values: [...], metadata: { title: "Hello" } }]);
const results = await index.query({ vector: [...], topK: 5, includeMetadata: true });
Use Cases
- E-commerce search — find products by description
- RAG — retrieve context for LLM answers
- Recommendation — similar items/content
- Anomaly detection — find outliers in embeddings
Need data for your AI pipeline? Check out my Apify actors or email spinov001@gmail.com for custom scrapers.
What vector DB are you using in production? Share below!
Top comments (0)