匠人学院 JR Academy
Skip to article
Learning guide
Pinecone Guide

Use Pinecone for vector search, semantic retrieval, and scalable RAG infrastructure.

2 chapters·4 guides·Access varies by chapter
Quickstart
On this page

Pinecone Quickstart

Pinecone is a managed vector database. Choose a supported serverless setup and verify account, region and billing requirements before creating resources.

#Prepare access

Create an appropriate key in the console↗ and record the intended cloud/region. Keep the actual key outside code.

bash
pip install pinecone

#Small vector example

python
import os from pinecone import Pinecone, ServerlessSpec pc = Pinecone(api_key=os.environ["PINECONE_API_KEY"]) name = "tutorial-vectors" if name not in pc.list_indexes().names(): pc.create_index( name=name, dimension=3, metric="cosine", spec=ServerlessSpec(cloud="aws", region="us-east-1"), ) # Wait for the index's ready state before the following operations. index = pc.Index(name) index.upsert(vectors=[ ("id1", [0.1, 0.2, 0.3], {"topic": "AI"}), ("id2", [0.3, 0.4, 0.1], {"topic": "Biology"}), ]) print(index.query( vector=[0.1, 0.2, 0.3], top_k=2, include_metadata=True ))

These three-dimensional vectors are synthetic teaching data, not text embeddings or proof of retrieval quality. The original source's abbreviated 1536-dimensional example used ellipses; a real embedding workflow must provide complete vectors matching its model and index.

#Alternative ingestion

Supported integrated-embedding indexes can accept source text through a configured embedding model. This differs from supplying your own vectors; check the relevant create/upsert APIs.

#Constraints

Index dimensions must match the vectors. Namespaces can separate query scope, but application authorization still controls who may access each scope. Verify successful writes and read-back before adding more workflow layers.

#Next step

Published by
JR Academy
Learning resources

Individual authors and reviewers are credited where recorded.

System Design

Core system design concepts and practical case studies

Learn the trade-offs and patterns that matter in technical interviews.

Open System Design →

Related Roadmaps

Done reading? Next steps