pinecone-io/python-sdk
Official Python SDK for the Pinecone vector database
Pinecone Python SDK – Quick Overview
What it is: A Python client library for Pinecone, a managed vector‑database service. It lets you create indexes, store (upsert) vector‑embedded documents, and run similarity searches directly from Python code.
Key capabilities
- Index management – create, configure, and delete Pinecone indexes via
pc.indexes.create. - Document‑oriented API – treat each record as a JSON document with an
_id, a dense vector field, and any custom metadata you define in the schema. - Similarity search – query with
DenseVectorQueryto retrieve the most similar items (top‑k) using cosine or other metrics. - Async support – an
AsyncPineconeclient works withasynciofor non‑blocking workloads. - Configuration – easy API‑key handling, custom host, timeout, and debug logging.
Typical workflow
- Initialize the client with an API key.
- Create an index specifying a schema that includes a
dense_vectorfield. - Upsert documents (vectors + metadata) into a namespace.
- Search using a dense‑vector query, retrieving matching document IDs and scores.
Why it matters: Vector databases are a core piece of modern AI pipelines—storing embeddings from LLMs, image models, etc., and enabling fast nearest‑neighbor retrieval for recommendation, semantic search, and RAG (retrieval‑augmented generation) use‑cases.
Getting started
pip install pinecone
from pinecone import Pinecone, DenseVectorQuery
pc = Pinecone(api_key="YOUR_KEY")
# create, upsert, search as shown in the README…
Development: Uses uv for dependency management, with testing, type‑checking (mypy), linting (ruff), and formatting built‑in. Integration tests hit the live service and require an API key.
License: Apache‑2.0.
All details are taken directly from the repository’s README.
Related
- Project
- Project
- Project
- Project