Using the latest Pinecone client installed by pip install pinecone-client, you'll need to change import pinecone to from pinecone import Pinecone. When creating an index, you'll also need to import the ServerlessSpec or PodSpec class.
With an up-to-date client, initialization is a little different and doesn't include environment. Instead of:
pinecone.init(
api_key=PINECONE_API_KEY, # find at app.pinecone.io
environment=PINECONE_API_ENV # next to api key in console
)
https://github.com/gkamradt/langchain-tutorials/blob/main/data_generation/Ask%20A%20Book%20Questions.ipynb
The notebook is out of sync with the current version of Pinecone. Here are some thoughts:
from langchain.vectorstores import Chroma, Pinecone
: I think it's better to installlangchain_pinecone
and usefrom langchain_pinecone import PineconeVectorStore
: https://python.langchain.com/docs/integrations/vectorstores/pineconepip install pinecone-client
, you'll need to changeimport pinecone
tofrom pinecone import Pinecone
. When creating an index, you'll also need to import theServerlessSpec
orPodSpec
class.environment
. Instead of:you use: