Skip to main content
deleted 25 characters in body
Source Link
mkrieger1
  • 24.2k
  • 7
  • 68
  • 84

ERROR:


ValueError Traceback (most recent call last) in <cell line: 0>() 28 29 ---> 30 docsearch = PineconeLangchain.from_existing_index(index_name, embeddings) 31 32

2 frames /usr/local/lib/python3.11/dist-packages/langchain_community/vectorstores/pinecone.py in init(self, index, embedding, text_key, namespace, distance_strategy) 71 ) 72 if not isinstance(index, pinecone.Index)Error: ---> 73 raise ValueError( 74 f"client should be an instance of pinecone.Index, " f"got {type(index)}" 75 )

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

---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-33-f1e2e49d4e0a> in <cell line: 0>()
     28 
     29 
---> 30 docsearch = PineconeLangchain.from_existing_index(index_name, embeddings)
     31 
     32 

2 frames
/usr/local/lib/python3.11/dist-packages/langchain_community/vectorstores/pinecone.py in __init__(self, index, embedding, text_key, namespace, distance_strategy)
     71             )
     72         if not isinstance(index, pinecone.Index):
---> 73             raise ValueError(
     74                 f"client should be an instance of pinecone.Index, " f"got {type(index)}"
     75             )

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

The code was working correctly 2~3 weeks ago, but I checked today and this error was persistently coming up. I can see the problem is in these bits:

But idk what'sWhat's the problem, bcs it was working fine before.?

ERROR:


ValueError Traceback (most recent call last) in <cell line: 0>() 28 29 ---> 30 docsearch = PineconeLangchain.from_existing_index(index_name, embeddings) 31 32

2 frames /usr/local/lib/python3.11/dist-packages/langchain_community/vectorstores/pinecone.py in init(self, index, embedding, text_key, namespace, distance_strategy) 71 ) 72 if not isinstance(index, pinecone.Index): ---> 73 raise ValueError( 74 f"client should be an instance of pinecone.Index, " f"got {type(index)}" 75 )

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

The code was working correctly 2~3 weeks ago, but I checked today and this error was persistently coming up. I can see the problem is in these bits

But idk what's the problem, bcs it was working fine before.

Error:

---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-33-f1e2e49d4e0a> in <cell line: 0>()
     28 
     29 
---> 30 docsearch = PineconeLangchain.from_existing_index(index_name, embeddings)
     31 
     32 

2 frames
/usr/local/lib/python3.11/dist-packages/langchain_community/vectorstores/pinecone.py in __init__(self, index, embedding, text_key, namespace, distance_strategy)
     71             )
     72         if not isinstance(index, pinecone.Index):
---> 73             raise ValueError(
     74                 f"client should be an instance of pinecone.Index, " f"got {type(index)}"
     75             )

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

The code was working correctly 2~3 weeks ago, but I checked today and this error was persistently coming up. I can see the problem is in these bits:

What's the problem?

Source Link
Pkun
  • 11
  • 1

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

Please help me fix this:

import os
from pinecone import Pinecone, ServerlessSpec
from langchain.vectorstores import Pinecone as PineconeLangchain


os.environ["PINECONE_API_KEY"] = PINECONE_API_KEY


pc = Pinecone(api_key=PINECONE_API_KEY)


index_name = "medchat"


if index_name not in pc.list_indexes().names():
    pc.create_index(
        name=index_name,
        dimension=384,
        metric="cosine",
        spec=ServerlessSpec(
            cloud="aws",
            region=PINECONE_API_ENV
        )
    )


index = pc.Index(index_name)


docsearch = PineconeLangchain.from_existing_index(index_name, embeddings)


qa = RetrievalQA.from_chain_type(
    llm=llm,
    chain_type="stuff",
    retriever=docsearch.as_retriever(search_kwargs={'k': 2}),
    return_source_documents=True,
    chain_type_kwargs=chain_type_kwargs
)

ERROR:


ValueError Traceback (most recent call last) in <cell line: 0>() 28 29 ---> 30 docsearch = PineconeLangchain.from_existing_index(index_name, embeddings) 31 32

2 frames /usr/local/lib/python3.11/dist-packages/langchain_community/vectorstores/pinecone.py in init(self, index, embedding, text_key, namespace, distance_strategy) 71 ) 72 if not isinstance(index, pinecone.Index): ---> 73 raise ValueError( 74 f"client should be an instance of pinecone.Index, " f"got {type(index)}" 75 )

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

The code was working correctly 2~3 weeks ago, but I checked today and this error was persistently coming up. I can see the problem is in these bits

index = pc.Index(index_name)


docsearch = PineconeLangchain.from_existing_index(index_name, embeddings)

But idk what's the problem, bcs it was working fine before.