Pinecone.from_texts - type object 'Pinecone' has no attribute 'from_texts'

Hello Team,

I am trying to use pinecone for the first time for studying the application, I have installed the pinecone-client (3.0.0) and tried to run the following query. However, I am getting an error given below. Please guide me if possible.

docsearch = Pinecone.from_texts([t.page_content for t in text_chunks], embedding, index_name=index_name)

Error - type object ‘Pinecone’ has no attribute ‘from_texts’

Hi @girishsawant9999! Without seeing the rest of your code, it’s hard to know exactly what’s happening, but I suspect you’re not calling the query operation the right way. Do the examples on this docs page help? You might also want to run through the Quickstart, if you haven’t already.

Thank you for the response. Here is the full code. (I am running this each line in Jupyter Notebook). Let me also have a look at the URLs shared by you.

from langchain.document_loaders import PyPDFDirectoryLoader

mkdir pdfs

text_splitter = RecursiveCharacterTextSplitter(chunk_size=500, chunk_overlap=20)
text_chunks = text_splitter.split_documents(data)

(skipping the VertexAI Authentication piece)
embedding = VertexAIEmbeddings(model_name=‘textembedding-gecko@003’)

abc = len(embedding.embed_query(“How are you”))

embedding.embed_query(“How are you”)

from langchain.vectorstores import Chroma, Pinecone
from langchain.embeddings.vertexai import VertexAIEmbeddings
import pinecone
pinecone( api_key=PINECONE_API_KEY, # find at
environment=PINECONE_API_ENV # next to api key in console

index_name = “testing”

index = pinecone.Index(‘testing’)

docsearch = Pinecone.from_texts([t.page_content for t in text_chunks], embedding, index_name=index_name)

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.