Skip to main content

Pinecone Integration

Pinecone is the vector database powering the RAG (Retrieval-Augmented Generation) system for AI email generation.

Setup

Two Pinecone indexes are required:

IndexDimensionsEmbedding Model
Primary1536text-embedding-3-small (OpenAI)
Large3072text-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:

ValueIncluded In
kineticKinetic builds only
ampAMP builds only
generalBoth 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:

EndpointAction
POST /api/admin/submit-contentUpload new content (embeds + stores in both indexes)
POST /api/admin/update-contentRe-embed and update existing content
POST /api/admin/delete-contentRemove from both indexes
GET /api/admin/list-contentBrowse content with filters

See RAG Overview for the full retrieval pipeline.