AttributeError while performing Pinecone.from_texts

docsearch=PV.from_texts([t.page_content for t in text_chunks], embeddings, index_name=index_name)

I don’t know why this is showing i tried a lot solving this and yesterday when i was practicing it was perfectly working . below is my whole code

print("hii")
from langchain import PromptTemplate
from langchain.chains import RetrievalQA
from langchain.embeddings import HuggingFaceEmbeddings
from langchain.vectorstores import Pinecone as PV
from pinecone import Pinecone 
from langchain.document_loaders import PyPDFLoader, DirectoryLoader
from langchain.text_splitter import RecursiveCharacterTextSplitter
from langchain.prompts import PromptTemplate
from langchain.llms import CTransformers
#Extract data from the PDF
def load_pdf(data):
    loader = DirectoryLoader(data,
                    glob="*.pdf",
                    loader_cls=PyPDFLoader)
    
    documents = loader.load()

    return documents
extracted_data = load_pdf("data/")
extracted_data
#Create text chunks
def text_split(extracted_data):
    text_splitter = RecursiveCharacterTextSplitter(chunk_size = 50, chunk_overlap = 10)
    text_chunks = text_splitter.split_documents(extracted_data)

    return text_chunks
text_chunks = text_split(extracted_data)
print("length of my chunk:", len(text_chunks))
#download embedding model
def download_hugging_face_embeddings():
    embeddings = HuggingFaceEmbeddings(model_name="sentence-transformers/all-MiniLM-L6-v2")
    return embeddings
embeddings = download_hugging_face_embeddings()
embeddings
query_result = embeddings.embed_query("Hello world")
print("Length", len(query_result))
import os 
PINECONE_API_KEY = os.environ.get('PINECONE_API_KEY')
pinecone_instance = Pinecone(PINECONE_API_KEY)
index = pinecone_instance.Index("chat")
    
index.upsert()
index_name = "chat"
docsearch=PV.from_texts([t.page_content for t in text_chunks], embeddings, index_name=index_name)

The error message is saying the pinecone-client is not installed. What does pip list for this environment show? What version of Langchain are you using?

image

i have updated my langchain latest version now its giving me
Index ‘None’ not found in your Pinecone project. Did you mean one of the following indexes
this error i have stored my index name with all the given methods but still its saying none

1 Like

Did you manage to solve it? I have the same problem.

same I have having the same problem can someone help please