A Next.js application that uses RAG (Retrieval Augmented Generation) to search through LinkedIn posts, create embeddings, and generate content in an authentic voice.
- Node.js (v22+)
- Yarn package manager
- OpenAI API key
- Pinecone account (free tier available)
git clone https://github.com/yourusername/cringe-influencer-rag.git
cd cringe-influencer-rag
yarn installCreate a .env file in the project root:
# Required for vector database
PINECONE_API_KEY=your_pinecone_api_key
PINECONE_INDEX_NAME=your_index_name
# Required for OpenAI embeddings and search
OPENAI_API_KEY=your_openai_api_key- Sign up at Pinecone (free tier includes 1 index)
- Create a new index with these settings:
- Name: Choose a name (use this as PINECONE_INDEX_NAME in .env)
- Dimensions: 512 (for OpenAI text-embedding-3-small)
- Metric: cosine
- Cloud: Any region (e.g., aws/us-east-1)
- Copy your API key from the Pinecone console to your .env file
- Sign up at OpenAI Platform
- Navigate to API Keys
- Create a new API key and copy it to your .env file
- Add $5 credit to your account (OpenAI offers pay-as-you-go pricing)
- Go to Billing
- Click "Add to credit balance"
- Add $5 (this is enough for thousands of embeddings and queries)
yarn uploadThis uploads pre-generated vectors from output/brian_posts_vectors.json to your Pinecone index. Please use the correct index name.
yarn devVisit http://localhost:3000 to use the application.
- Enter a search query in the text area (e.g., "AI startup advice")
- Click the SEARCH button
- View results from both basic vector search and re-ranked results
- Compare how the re-ranking improves search relevance
app/- Next.js application filesapi/- API routes for search and re-rankingcomponents/- React components
data/- Source data fileslibs/- Utility libraries for OpenAI and Pineconescripts/- Scripts for embedding and uploading vectorsoutput/- Generated vector files
yarn dev- Start development serveryarn build- Build for productionyarn start- Start production serveryarn embed- Generate embeddings from source datayarn upload- Upload vectors to Pinecone
For those interested in the technology behind this application:
- Essence of Linear Algebra - Visual introduction to vectors
- Neural Networks - How neural networks work
- Transformers, explained - Understanding the transformer architecture