## Vector Search DB In Pinecone
from pinecone import Pinecone, ServerlessSpec
import os
pc = Pinecone(api_key='a561dac3-3246-4aff-97fb-1f648d2ce750')
index_name = "text-embeddings"
if index_name not in pc.list_indexes().names():
pc.create_index(
name=index_name,
dimension=384,
metric="cosine",
spec=ServerlessSpec(
cloud='aws',
region='us-east-1'
)
)
from langchain_pinecone import PineconeVectorStore
namespace = "wondervector5000"
docsearch = PineconeVectorStore.from_documents(
host="https://text-embeddings-nudmpai.svc.aped-4627-b74a.pinecone.io"
documents=doc,
index_name=index_name,
embedding=embedding,
namespace=namespace
)
Getting error as:
PineconeConfigurationError Traceback (most recent call last)
Cell In[31], line 5
1 from langchain_pinecone import PineconeVectorStore
3 namespace = "wondervector5000"
----> 5 docsearch = PineconeVectorStore.from_documents(
6 documents=doc,
7 index_name=index_name,
8 embedding=embedding,
9 namespace=namespace
10 )
File c:UsersPrernaDesktopgameReccomendermyenvLibsite-packageslangchain_corevectorstores.py:550, in VectorStore.from_documents(cls, documents, embedding, **kwargs)
548 texts = [d.page_content for d in documents]
549 metadatas = [d.metadata for d in documents]
--> 550 return cls.from_texts(texts, embedding, metadatas=metadatas, **kwargs)
File c:UsersPrernaDesktopgameReccomendermyenvLibsite-packageslangchain_pineconevectorstores.py:438, in PineconeVectorStore.from_texts(cls, texts, embedding, metadatas, ids, batch_size, text_key, namespace, index_name, upsert_kwargs, pool_threads, embeddings_chunk_size, **kwargs)
395 @classmethod
396 def from_texts(
397 cls,
(...)
409 **kwargs: Any,
410 ) -> PineconeVectorStore:
411 """Construct Pinecone wrapper from raw documents.
...
---> 54 raise PineconeConfigurationError("You haven't specified an Api-Key.")
55 if not host:
56 raise PineconeConfigurationError("You haven't specified a host.")
PineconeConfigurationError: You haven't specified an Api-Key.
I am working for a RAG model but not able to add embeddings to the Pinecone vectorDB. The code includes both host and apikey still I am getting error as api-key and host not defined. I am using pinecone vectorDB.The error in detail has been provided in the above question.