Pinecone Integration
Pinecone is the vector database powering the RAG (Retrieval-Augmented Generation) system for AI email generation.
Setup
Two Pinecone indexes are required:
| Index | Dimensions | Embedding Model |
|---|---|---|
| Primary | 1536 | text-embedding-3-small (OpenAI) |
| Large | 3072 | text-embedding-3-large (OpenAI) |
Both indexes are queried and updated simultaneously.
Configuration
PINECONE_API_KEY=your-api-key
PINECONE_INDEX=your-index-name # 1536-dim
PINECONE_INDEX_LARGE=your-large-index # 3072-dim
Vector Metadata
Each vector in Pinecone stores metadata used for filtering. The metadata structure varies by content type:
HTML Code Examples (type: 'html')
{
"type": "html",
"description": "Product showcase with tabbed navigation",
"technique": "tabs",
"complexity": "intermediate",
"htmlType": "complete",
"emailPurpose": "ecommerce",
"exampleType": "positive",
"keyFeatures": ["lightswitch", "mobileResponsive"],
"bestPracticeTags": ["tableStructure", "msoConditionals"],
"html": "<!DOCTYPE html>...",
"notes": "",
"submittedAt": "2025-01-15T..."
}
AMP Code Examples (type: 'amp')
{
"type": "amp",
"description": "AMP tabbed product showcase",
"technique": "tabs",
"complexity": "intermediate",
"htmlType": "complete",
"html": "<!doctype html><html ⚡4email>...",
"notes": "",
"submittedAt": "2025-01-15T..."
}
Blog Articles (type: 'blog')
{
"type": "blog",
"contentFocus": "kinetic",
"blogTitle": "Building Accessible Tab Interfaces in Email",
"blogContent": "Full article text...",
"blogTopic": "kinetic-techniques",
"learningLevel": "intermediate",
"techniquesCovered": ["tabs", "accessibility"],
"keyTakeaways": "Summary of key learnings...",
"submittedAt": "2025-01-15T..."
}
The contentFocus field controls which build type receives the blog during generation:
| Value | Included In |
|---|---|
kinetic | Kinetic builds only |
amp | AMP builds only |
general | Both kinetic and AMP builds |
Blogs without contentFocus default to general.
Query Patterns
Technique-Filtered Query
# Pinecone query with metadata filter
index.query(
vector=embedding,
top_k=10,
filter={"technique": {"$eq": "tabs"}},
include_metadata=True
)
Broad Unfiltered Query
index.query(
vector=embedding,
top_k=15,
include_metadata=True
)
Content Management
Admin endpoints manage Pinecone content:
| Endpoint | Action |
|---|---|
POST /api/admin/submit-content | Upload new content (embeds + stores in both indexes) |
POST /api/admin/update-content | Re-embed and update existing content |
POST /api/admin/delete-content | Remove from both indexes |
GET /api/admin/list-content | Browse content with filters |
See RAG Overview for the full retrieval pipeline.