Source: data_layer/docs/QUICK_START_MIGRATION.md
Quick Start: Few-Shot Examples Migration
π What's Happening
Moving few-shot examples service from:
β database/few_shot_examples_training_data/To proper locations:
β
apps/backend/services/few_shot_examples/ (service logic)
β
database/output-styles/examples/ (data)π Execute Migration (Easy Mode)
Option 1: Automated Script
cd /path/to/project
./scripts/migrate_few_shot_service.shThe script will:
- β Create backup automatically
- β Create new directory structure
- β Copy all files
- β Test imports
- β οΈ Prompt before archiving old structure
Option 2: Manual Step-by-Step
See EXECUTION_PLAN.md for detailed instructions
β±οΈ Time Estimate
- Automated: ~5 minutes (mostly waiting for confirmations)
- Manual: ~60 minutes (careful review at each step)
π― What You'll Need to Do
Before Running
- Read this file
- Commit any uncommitted changes
- Be ready to review file changes
During Migration
- β Review suggested changes
- β Confirm each major step
- β Test imports work
After Migration
- β Update any imports in your code
- β Test your application
- β Run seed scripts to verify
π Key Changes
Import Changes
# OLD
from database.few_shot_examples_training_data import FewShotExamplesAPI
# NEW
from apps.backend.services.few_shot_examples import FewShotExamplesAPIPath Changes
# OLD
Path("database/few_shot_examples_training_data/data/triage.jsonl")
# NEW
from apps.backend.services.few_shot_examples import config
config.SEEDS_DIR / "triage.jsonl"β Verification
After migration, verify with:
# Test imports
python3 -c "from apps.backend.services.few_shot_examples import config; print('β
', config.SEEDS_DIR)"
# Check files exist
ls -la database/output-styles/examples/seeds/
# Verify service
ls -la apps/backend/services/few_shot_examples/π If Something Goes Wrong
Rollback
# Restore from backup
backup=$(ls -td backups/pre-migration-* | head -1)
rm -rf database/few_shot_examples_training_data/
cp -r "$backup/few_shot_examples_training_data" database/Get Help
- Check
EXECUTION_PLAN.mdfor detailed troubleshooting - Review
migration-dependencies.txt(created during migration) - Check backup location:
backups/pre-migration-*/
π Success Criteria
Migration complete when:
- β
New service imports work:
from apps.backend.services.few_shot_examples import config - β
Data files in correct location:
database/output-styles/examples/seeds/*.jsonl - β
Old location archived/removed:
database/few_shot_examples_training_data/ - β
No old imports in code:
grep -r "from database.few_shot_examples_training_data" - β Application tests pass
- β Seed scripts work
π What Gets Moved Where
| Old Location | New Location | Type |
|---|---|---|
database/few_shot_examples_training_data/*.py | apps/backend/services/few_shot_examples/ | Service code |
database/few_shot_examples_training_data/data/*.jsonl | database/output-styles/examples/seeds/ | Data files |
database/few_shot_examples_training_data/README.md | apps/backend/services/few_shot_examples/README.md | Docs |
π Additional Resources
- Detailed Plan:
EXECUTION_PLAN.md- Step-by-step with rollback - Conceptual Plan:
CONSOLIDATION_PLAN_REVISED.md- Architecture explanation - Migration Script:
scripts/migrate_few_shot_service.sh- Automated execution
π¦ Ready?
# Review the script first
cat scripts/migrate_few_shot_service.sh
# When ready, execute
./scripts/migrate_few_shot_service.shThe script will guide you through each step with confirmations.