Invaild api key while key was used successfully in same .py earlier in script

I used pinecone to upsert and index. It was created successfully. When i imported langchain_pinecone PineconeVectorStore and called: vector_store = PineconeVectorStore.from_existing_index(index_name=index, embedding=embedding_model) i received a 401 error invalid api key. originally i called from pinecone import Pinecone as PineconeClient. I set pc= PineconeClient(api_key=“some_data”) this created the index. I’m assuming when i call the PineconeVectorStore it is looking somewhere else?

Hi @george.blueocean, your assumption is correct. The LangChain package looks for an environment variable named PINECONE_API_KEY.

For an example, please see Initializing a vector store in our LangChain integration docs.

1 Like