AI Processing
Teak’s AI processing pipeline automatically enriches your cards with metadata, tags, summaries, and transcripts. The system runs in the background after card creation, powered by Convex workflows with automatic retry logic.Processing Pipeline
Every new card enters a multi-stage processing workflow:Stage 1: Classification
Determines the card type if not explicitly provided. Input: Card content, file metadata, URL patterns Output:- Analyzes file extensions and MIME types
- Examines URL patterns for links
- Inspects content structure
- Assigns confidence score
- Determines subsequent pipeline steps
Stage 2: Categorization (Links Only)
Classifies link cards into specific categories and extracts rich metadata. Input: Link URL, fetched page metadata Output:-
Fetch Link Metadata
- Request page HTML
- Parse Open Graph tags
- Extract meta tags
- Download and cache preview image
- Capture screenshot (if applicable)
-
Classify Category
- Analyze URL patterns (youtube.com → video)
- Detect provider (GitHub, Medium, Twitter, etc.)
- Use AI to classify content type
- Assign confidence score
-
Fetch Structured Data (if applicable)
- Query provider-specific APIs
- Extract additional metadata
- Normalize to standard format
-
Merge and Save
- Combine all metadata sources
- Update card record
- Mark categorization stage complete
article- Blog posts, news, documentationvideo- YouTube, Vimeo, streaming contentproduct- E-commerce, SaaS productsrepository- GitHub repos, code samplesdesign- Dribbble, Behance, inspirationsocial- Twitter threads, LinkedIn poststool- Web apps, utilities, services
Stage 3: Metadata Generation
Generates AI tags, summaries, and transcripts. Input: Card content, file data, link metadata Output:- Text/Quote
- Link
- Image
- Video
- Audio
- Document
- Palette
AI Tags:
- Topic extraction
- Keyword identification
- Theme classification
- Key points extraction (for longer text)
- Main ideas condensation
Metadata generation has the highest retry count (8 attempts) because AI API calls can occasionally fail due to rate limits or temporary outages.
Stage 4: Renderables
Generates thumbnails and visual previews. Applies to: Image, video, document cards Process:Image Cards
Image Cards
- Check if image is larger than thumbnail threshold
- Generate optimized thumbnail (max dimensions, compressed)
- Save to Convex storage
- Update card with
thumbnailId
- Render SVG to raster format first
- Generate thumbnail from rasterized version
- Use thumbnail for palette extraction (SVGs need raster for color analysis)
Video Cards
Video Cards
- Extract frame (first frame or middle frame)
- Generate thumbnail image
- Optimize and compress
- Save to Convex storage
- Update card with
thumbnailId
Document Cards
Document Cards
- Render first page/slide
- Generate preview image
- Optimize for display
- Save to Convex storage
- Update card with
thumbnailId
- Image already smaller than thumbnail size
- File doesn’t support thumbnail generation
- Previous thumbnail generation succeeded
Palette Extraction (Images Only)
Runs in parallel with other processing stages for raster images, or after renderables for SVG images. Process:- Load image (or thumbnail for SVGs)
- Sample dominant colors
- Extract color palette (5-8 colors)
- Compute RGB and HSL values
- Categorize into hue buckets
- Save to card:
Palette extraction failures are logged but don’t fail the entire workflow. The card remains valid without color data.
Processing Status
Each card tracks processing progress:Status Values
pending- Stage not yet startedin_progress- Currently runningcompleted- Successfully finishedfailed- Error occurred (witherrorfield)
Confidence Scores
Classification and categorization stages include confidence scores:0.9 - 1.0- Very high confidence0.7 - 0.89- High confidence0.5 - 0.69- Medium confidence< 0.5- Low confidence (may need review)
Workflow Implementation
The processing pipeline uses Convex workflows with retry logic:Retry Behavior
Workflow steps automatically retry on failure:| Stage | Max Attempts | Initial Backoff | Backoff Base |
|---|---|---|---|
| Link Metadata | 5 | 5000ms | 2.0 |
| Categorization | 5 | 1200ms | 1.6 |
| Metadata Generation | 8 | 400ms | 1.8 |
- Attempt 1: 400ms
- Attempt 2: 720ms (400 * 1.8)
- Attempt 3: 1,296ms (400 * 1.8²)
- Attempt 4: 2,333ms (400 * 1.8³)
Execution Order
Standard Flow (Text, Link, Document, Audio)
Video/SVG Flow (Thumbnail Required)
This ensures the thumbnail is ready for visual AI analysis.Image Flow (Non-SVG)
Raster images can extract palettes immediately from the source file.Performance Considerations
Processing Time Estimates
| Card Type | Avg Time | Notes |
|---|---|---|
| Text | 1-2 sec | Fast, minimal AI processing |
| Quote | 1-2 sec | Similar to text |
| Link | 5-15 sec | Depends on external site response time |
| Image | 3-8 sec | Includes palette extraction |
| Video | 10-30 sec | Thumbnail + transcription (if speech) |
| Audio | 5-20 sec | Depends on audio length |
| Document | 5-15 sec | Depends on page count |
| Palette | <1 sec | No external processing |
Resource Usage
- File Storage: Thumbnails typically 50-200KB
- AI API Calls: 1-3 calls per card (classification, tagging, summarization)
- Workflow Executions: 1 workflow per card
Optimization Strategies
- Parallel Execution: Metadata and renderables run simultaneously when possible
- Early Termination: Skip stages that don’t apply to card type
- Incremental Updates: Save progress after each stage
- Graceful Degradation: Failed stages don’t block completion
Monitoring Processing
You can monitor processing status in real-time:Real-Time Updates
Convex provides real-time reactivity:Manual Triggers
In some cases, you may want to manually trigger reprocessing:Next Steps
Card Types
See what AI features apply to each type
Search
Search across AI-generated metadata
Workflows
Deep dive into workflow architecture
Schema
Explore the complete card schema