I am using sentence transformer instead of openai for generating embedding. While creating chunks using the command:
docsearch = pc.from_texts([t.page_content for t in text_chunks], embedding, index_name=index_name)
I am getting error: no attribute from_texts.
Tried other method too like collision with langchain class and all but got different error as no api key defined.
I get it needs api key but instead of using openai I am using sentence transformer which doesn’t require api key for embedding. So how can I solve this?
Hi @rex718947, and welcome to the Pinecone forums! Thanks for your question.
- Could you please share ALL of your relevant code, including where you’re instantiating your Pinecone vector store?
- If you’re following particular documentation or a guide could you please link it here?
- It’s difficult to tell what’s going wrong from so little information, but it sounds like you may need to correctly export your PINECONE_API_KEY environment variable and then determine the correct methods available in sentence transformers or whichever third party library you’re using to interact with Pinecone
- Try taking a look at this complete guide and tutorial to do this with langchain. Even if you’re not using langchain, this tutorial is an excellent resource for learning about the right ways to do the things I mentioned in bullet 3
Feel free to share all your code (but do not include any secrets like your Pinecone API key) so we can better assist you!
Hope that helps
Hi, thanks for the reply, too late from my side though.
The issue is resolved after doing a lot of research. I had to use vector store to embedd my data on pinecone. instead of pc.from_texts
1 Like
Hi @rex718947,
Understood - glad to hear you got it working!
Best,
Zack
There’s one more thing I would like to ask–
I created pinecone vector database using PineconeVectorStore, since it is already created I tried retrieving this db as:
retrieve = PineconeVectorStore.from_existing_index(
index_name=“medical-chatbot”,
embedding=embeddings
)
While implementing retrievalQA on this as:
qa = RetrievalQA.from_chain_type(
llm=llm,
chain_type=“stuff”,
retriever = retrieve.as_retriever(),
chain_type_kwargs=chain_type_kwargs
)
I am getting this error:
Can’t instantiate abstract class BaseRetriever with abstract methods _aget_relevant_documents, _get_relevant_documents (type=type_error)
can you help resolve this issue?
Hi @rex718947,
I actually just responded to your similar query in the other thread:
Please take a look through this GitHub issue: Potential Bug in Retriever.py: Can't instantiate abstract class BaseRetriever with abstract method _get_relevant_documents · Issue #13624 · langchain-ai/langchain · GitHub for some suggestions.
Which version of LangChain are you running right now