This project demonstrates how to integrate Pinecone, a vector database, with Google Generative AI to perform operations such as embedding generation, data insertion, querying, and retrieving index statistics.
-
Insert-data.js
- Inserts embedding vectors into a Pinecone index.
- Generates embeddings for a given content using the Google Generative AI text-embedding model.
-
search.js
- Queries the Pinecone index using a vector generated from Google Generative AI embeddings.
- Retrieves the top K matching vectors with their metadata.
-
Find.js
- Retrieves and prints information about the Pinecone index, including namespace details and statistics.
-
Node.js
- Ensure you have Node.js installed on your system.
-
Install Dependencies
- Install the required libraries:
npm install @pinecone-database/pinecone @google/generative-ai
- Install the required libraries:
-
API Keys
- Obtain and set the following API keys:
- Pinecone API Key: Available in your Pinecone account.
- Google Generative AI Key: Available in your Google Cloud Console.
- Obtain and set the following API keys:
-
Environment Variables
- Store API keys securely by creating an
.env
file in the project root:PINECONE_API_KEY=your-pinecone-api-key GOOGLE_AI_API_KEY=your-google-ai-api-key
- Store API keys securely by creating an
-
Folder Structure:
/project-folder ├── Insert-data.js ├── search.js ├── Find.js ├── README.md ├── .env