Skip to main content

Usage


Parameters

str
required
Pinecone index name. First positional argument.
str | None
default:"None"
Pinecone API key. Falls back to PINECONE_API_KEY.
str | None
default:"None"
OpenAI API key used for creating embeddings. Falls back to OPENAI_API_KEY.
str
default:"text-embedding-3-large"
OpenAI embedding model for both indexing and retrieval.

Environment variables


Embedding models

Your Pinecone index dimensions must match the embedding model:
  • text-embedding-3-large → create index with 3072 dimensions
  • text-embedding-3-small → create index with 1536 dimensions
Change the embedding model:

Creating a Pinecone index

  1. Go to app.pinecone.io
  2. Create a Serverless index:
    • Dimensions: 3072 (for text-embedding-3-large)
    • Metric: cosine
    • Cloud/Region: choose based on your API server location
  3. Copy the index name and your API key to .env

Namespaces

Use namespaces to partition a single index into logical sections:
The retriever uses the namespace you configured when creating the Pinecone instance. For multi-namespace retrieval, you need separate LangChat instances or a custom adapter.