Hi,
The below python code is executing successfully to load the texts in Pinecone INDEX_NAME=medium-blog-embeddings-index.
But, I still don’t see the records in Pinecone index. Please suggest if there is Pinecone issue or I need to write additional Python code to ingest data?
from langchain_pinecone import PineconeVectorStore
PineconeVectorStore.from_documents(texts, embeddings, index_name=os.environ[‘INDEX_NAME’])
To verify if your data was successfully loaded, you can check the index stats:
python
from pinecone.grpc import PineconeGRPC as Pinecone
pc = Pinecone(api_key="YOUR_API_KEY")index = pc.Index(host="INDEX_HOST")
index.describe_index_stats()
This will return stats including the total vector count and namespace details to confirm if your records were ingested.
For loading documents with LangChain, make sure you’re following this pattern:
python
import osfrom langchain_pinecone import PineconeVectorStorefrom langchain_openai import OpenAIEmbeddings
os.environ['OPENAI_API_KEY'] = '<YOUR_OPENAI_API_KEY>'os.environ['PINECONE_API_KEY'] = '<YOUR_PINECONE_API_KEY>'
index_name = "<YOUR_PINECONE_INDEX_NAME>"embeddings = OpenAIEmbeddings()
vectorstore_from_texts = PineconeVectorStore.from_texts( texts, index_name=index_name, embedding=embeddings)
Things to verify:
- Make sure your environment variables are set correctly
- Check that the embeddings object is properly initialized
- Verify the index exists and is ready before loading data