langchain icon indicating copy to clipboard operation
langchain copied to clipboard

`v.0.0.138` does not create a `Pinecone` index when initiating a vectorstore.

Open homanp opened this issue 1 year ago • 2 comments

In previous versions of LC running the following code would create an index in Pinecone:

loader = TextLoader(join('data', 'ad.txt'))
documents = loader.load()
text_splitter = CharacterTextSplitter(chunk_size=1000, chunk_overlap=0)
docs = text_splitter.split_documents(documents)

embeddings = OpenAIEmbeddings()

pinecone.init(
    api_key="cc7f8b80-2cc9-4d72-8c0d-0e2d287977d5", 
    environment="asia-southeast1-gcp"
)

index_name = "langchain-demo"
vectorstore = Pinecone.from_documents(docs, embeddings, index_name=index_name)

This would create an index in v.0.0.123, instead I'm seeing this error:

ValueError: No active indexes found in your Pinecone project, are you sure you're using the right API key and environment?

Are there any breaking changes to this implementation we should be aware of?

homanp avatar Apr 13 '23 11:04 homanp

As far as I know, you need to create index, either from pinecone dashboard or using code

pinecone.create_index(index_name, dimension=1536,
                          metric="cosine", pods=1, pod_type="p1.x1")

Let me know if this works.

nepalprabin avatar Apr 16 '23 04:04 nepalprabin

@nepalprabin provided the answer. Created the index in the UI and it worked.

natasha-savic-msft avatar May 15 '23 08:05 natasha-savic-msft

Hi, @homanp! I'm Dosu, and I'm helping the LangChain team manage their backlog. I wanted to let you know that we are marking this issue as stale.

Based on my understanding, in version v.0.0.138, the code no longer creates an index in Pinecone and throws a ValueError. It seems that nepalprabin suggested creating the index either from the Pinecone dashboard or using the provided code snippet. And natasha-savic-msft confirmed that creating the index in the UI resolved the issue.

Before we close this issue, we wanted to check with you if it is still relevant to the latest version of the LangChain repository. If it is, please let us know by commenting on the issue. Otherwise, feel free to close the issue yourself, or it will be automatically closed in 7 days.

Thank you for your contribution to the LangChain repository!

dosubot[bot] avatar Sep 19 '23 16:09 dosubot[bot]