langchain pinecone update

My RAG example no longer works after pinecone update. Apparently, I can’t rely on LLM on this. Both gpt4o and claude gave misleading solution. Claude did solve some but can’t fix all.

Basically, pinecone expect to generate as class like

pc = Pinecone(api_key=PINECONE_API_KEY, environment=PINECONE_API_ENV)

rather than using init like

pinecone.init(api_key=PINECONE_API_KEY, environment=PINECONE_API_ENV)

My problem is that I can’t pass the key to pinecone vectorstore any more. My code used to be

vector_store = LangchainPinecone(
            index_name=PINECONE_INDEX,
            embedding=embedding,
            text_key="text",
            namespace=request.form['retrievalIndex'],
            # pinecone_client=pc
        )

After many trial and errors and this tutorial helps a lot. I should have just used index rather than index_name instead

    index = pc.Index(PINECONE_INDEX)
    # Create a LangchainPinecone vector store
    vector_store = LangchainPinecone(
        index=index,
        embedding=embedding,
        text_key="text",
        namespace=request.form['retrievalIndex'],
        # pinecone_client=pc
    )
        




Leave a Reply

Your email address will not be published. Required fields are marked *