ValueError when initializing PineconeVectorStore with LangChain

Title: ValueError with langchain_community.vectorstores Pinecone Integration

Hi everyone,

I’m getting this error when trying to initialize a Pinecone vector store using the community package:

ValueError: client should be an instance of pinecone.Index, got <class 'pinecone.data.index.Index'>

Here’s my current code:

from langchain_community.vectorstores import Pinecone as LangChainPinecone

dense_retriever = LangChainPinecone.from_existing_index(
    index_name="sage", 
    embedding=embeddings, 
    namespace=namespace
).as_retriever(search_kwargs={"k": top_k})

I notice there are different ways to initialize Pinecone with LangChain. Could someone help clarify:

  1. What’s causing this specific error?
  2. Is there a difference between using langchain_community.vectorstores vs langchain_pinecone?

Thanks in advance!

Having the same issue but with slightly different syntax

vectorstore = LangchainPinecone(index, embed, text_field, namespace)

Hello @hisham and @alejogbravo,

Welcome to the community. Can you both share the version of LangChain and Pinecone you are using? The output of pip list might be the easiest way to do it.

Hi @patrick1

pinecone-client           5.0.1
pinecone-plugin-interface 0.0.7

langchain                 0.3.7
langchain-community       0.3.5
langchain-core            0.3.37
langchain-openai          0.3.6
langchain-text-splitters  0.3.2
langsmith                 0.1.140

Let me know if you want me to paste the entire pip list here