What This Document Covers:
- AI-powered feedback analysis for memecoin editing
- Intelligent field detection from natural language
- Targeted regeneration of affected metadata only
- Edit proposal caching for approval workflow
- MemeStorageOrchestrator integration
Sections in This Document:
Related Documentation:
- → ../WORKFLOWS.md - All workflows overview
- → ../rag_memecoin_update_workflow/README.md - Update workflow
- → ../../docs/features/AI_GENERATION.md - LLM services
- → ./rag_memecoin_edit_analysis_workflow.py - Implementation
Context Tags: #workflow #editing #ai-analysis #proposal-system #metadata-generation
AI-powered memecoin editing workflow that analyzes user feedback and generates intelligent edit proposals using LLM-based field analysis.
The RAG Memecoin Edit Analysis Workflow provides intelligent memecoin editing through:
- LLM-powered feedback analysis - Understands user intent from natural language
- Targeted field regeneration - Updates only affected metadata fields
- Proposal-based editing - Generates editable proposals for user review
- No executor needed - Returns edited data directly for orchestrator integration
File: src/workflows/rag_memecoin_edit_analysis_workflow.py
MemoryMemecoinInputSource → RAGMemecoinEditProcessor → Edited MemecoinEntry
↓ ↓ ↓
Single memecoin Feedback analysis Proposal data
from memory + LLM regeneration (cached 5 min)
Unique Design: This workflow does NOT use an executor. It processes the memecoin and returns the edited entry directly to the orchestrator for caching and proposal generation.
RAGMemecoinEditProcessor - Single-stage intelligent analysis:
- FeedbackAnalysisAndRegenerationStage:
- Analyzes user feedback to determine affected fields
- Regenerates only the fields mentioned in feedback
- Preserves unchanged fields from original data
- Returns updated MemecoinEntry
LLM Analysis Logic:
- "incorrect entity/characters" → Regenerate
caption_entity - "wrong context/meme reference" → Regenerate
caption_context - "incorrect visual style" → Regenerate
caption_visual - "wrong emotions/tone" → Regenerate
caption_emotions - "change tags" → Update
tagsarray - "rename to X" → Update
token_name/ticker/description
from src.workflows.rag_memecoin_edit_analysis_workflow import RAGMemecoinEditAnalysisWorkflow
# Initialize workflow
workflow = RAGMemecoinEditAnalysisWorkflow()
await workflow.initialize()
# Run with user feedback
memecoin_data = {
"token_name": "CryptoDog",
"ticker": "CDOG",
"description": "A memecoin featuring a dog",
"token_address": "ABC123...",
"tags": ["animal", "meme"],
"caption_structured": {
"entity": "A cartoon dog",
"context": "Internet meme culture",
"visual": "Cartoon style",
"emotions": "Happy and playful"
}
}
user_feedback = "The entity should be a cat, not a dog"
# Get edited memecoin
edited_entry = await workflow.run(memecoin_data, user_feedback)
# Cleanup
await workflow.cleanup()Entity Correction:
"The entity should be a cat, not a dog"
→ Regenerates: caption_entity
Multiple Fields:
"The context is wrong - should reference Nyan Cat meme. Also add rainbow tags."
→ Regenerates: caption_context
→ Updates: tags
{
"token_name": str, # Memecoin name
"ticker": str, # Ticker symbol
"description": str, # Description
"token_address": str, # Blockchain address
"tags": List[str], # Classification tags
"image_base64": str, # Base64 image (unchanged)
"image_mime_type": str, # Image MIME type
"caption_structured": { # 4-part caption structure
"entity": str, # What is shown
"context": str, # Meme references
"visual": str, # Art style
"emotions": str # Mood/tone
}
}Output: Returns MemecoinEntry with updated fields based on feedback analysis.
The processor uses a targeted prompt for intelligent analysis:
CURRENT MEMECOIN DATA:
- Token Name: {name}
- Ticker: {ticker}
- Description: {description}
- Tags: {tags}
CURRENT CAPTION:
- Entity: {entity}
- Context: {context}
- Visual: {visual}
- Emotions: {emotions}
USER FEEDBACK:
"{user_feedback}"
TASK: Analyze feedback and regenerate ONLY affected fields
RESPONSE FORMAT (JSON):
{
"token_name": "...",
"ticker": "...",
"description": "...",
"tags": [...],
"caption_entity": "...",
"caption_context": "...",
"caption_visual": "...",
"caption_emotions": "..."
}
Key Features:
- Lower temperature (0.3) for focused edits
- JSON response for structured updates
- Preserves unchanged fields
- Maintains caption structure consistency
success, message, result = await orchestrator.generate_edit_proposal(
token_address="ABC123...",
user_feedback="The entity should be a cat, not a dog"
)
if success:
proposal_uuid = result["proposal_uuid"]
proposal_data = result["proposal"]
# Proposal cached for 5 minutes
# User can review and accept/reject- Fetch from Vector DB: Orchestrator retrieves memecoin
- Run Workflow: Calls
RAGMemecoinEditAnalysisWorkflow.run() - Generate UUID: Creates unique proposal identifier
- Cache Proposal: Stores in orchestrator with 5-minute TTL
- Return to API: Frontend displays proposal for review
# In MemeStorageOrchestrator
self._edit_proposals: Dict[str, Tuple[datetime, Dict[str, Any]]] = {}
# Entry format:
{
"proposal_uuid_here": (
datetime.now(), # Timestamp
{
"token_name": "...",
"ticker": "...",
"description": "...",
"tags": [...],
"caption_structured": {...}
}
)
}
# TTL: 5 minutes (300 seconds)The workflow handles validation errors (empty data/feedback), LLM response parsing failures (markdown code blocks), and processing errors (stage failures). See implementation for details.
Request:
{
"feedback": "The entity should be a cat, not a dog"
}Response:
{
"status": 200,
"success": true,
"message": "Edit proposal generated successfully",
"proposal_uuid": "550e8400-e29b-41d4-a716-446655440000",
"proposal": {
"token_name": "CryptoCat",
"ticker": "CCAT",
"description": "A memecoin featuring a cat",
"tags": ["animal", "meme", "cat"],
"caption_structured": {
"entity": "A cartoon cat", // UPDATED
"context": "Internet meme culture",
"visual": "Cartoon style",
"emotions": "Happy and playful"
}
}
}- User selects memecoin in database browser
- Clicks "Edit" button (keyboard shortcut:
E) - Enters feedback in modal: "The entity should be a cat"
- Frontend POSTs to edit endpoint
- Receives proposal with UUID
- Displays proposal for review
- User can:
- Accept: PATCH to base endpoint with proposal UUID
- Edit manually: Modify proposal fields
- Reject: Cancel operation
See tests/workflows/test_rag_memecoin_edit_analysis_workflow.py for unit tests and tests/integration/orchestrator/test_meme_storage_orchestrator.py for integration tests.
Solution: Processor handles markdown code blocks with JSON extraction
Solution: Lower temperature (0.3) with explicit instructions to preserve unchanged fields
Solution: Frontend warns user at 4 minutes, auto-refreshes proposal
Solution: Processor creates empty structure if missing from original data
- RAG Memecoin Update Workflow - Vector DB update pipeline
- MemeStorageOrchestrator - Orchestrator integration
- Web UI Database Routes - API endpoints
- Domain Architecture - Event → Processor → Action pattern
✅ LLM-Powered Analysis - Intelligent field detection from natural language ✅ Targeted Regeneration - Updates only affected fields ✅ No Executor Needed - Returns data directly for caching ✅ 5-Minute Proposal Cache - TTL-based cleanup ✅ JSON Response Parsing - Handles markdown code blocks ✅ Low Temperature - Focused edits (0.3) ✅ Orchestrator Integration - Seamless proposal workflow ✅ Web UI Support - Complete edit interface
For the complete update pipeline (re-embedding + vector DB update), see RAG Memecoin Update Workflow