Schema mismatches after a Pinecone index upgrade are sneaky because the upsert often succeeds silently but then query returns nothing
import pinecone
pc = Pinecone(api_key="your-api-key")
index = pc.Index("your-index-name")
# First, check what your index actually expects
index_info = pc.describe_index("your-index-name")
print(index_info.dimension) # what the index expects
# Then check what you're actually sending
import numpy as np
your_vector = np.random.rand(1536) # Is this matching?
print(len(your_vector)) # must match index dimension exactly
Embedding model changed during the upgrade
Super common. If you switched models (even accidentally by upgrading a library), the vector dimensions change:
# OpenAI embedding dimensions by model
# text-embedding-ada-002 → 1536 dimensions
# text-embedding-3-small → 1536 (default) or custom
# text-embedding-3-large → 3072 dimensions
# So if you upserted with ada-002 but now query with 3-large
# you'll get nothing back — dimension mismatch
from openai import OpenAI
client = OpenAI()
def get_embedding(text, model="text-embedding-ada-002"):
response = client.embeddings.create(input=text, model=model)
print(f"Embedding dimension: {len(response.data[0].embedding)}")
return response.data[0].embedding