Skip to content

botpress/rag-migration

Repository files navigation

RAG Migration Tool

A utility to migrate Botpress files from v1 to v2 indexing stack. This tool identifies legacy indexed files and re-uploads them with updated indexing configuration.

What it does

This migration tool:

  • Connects to your Botpress workspace
  • Scans all files to identify those using the legacy v1 indexing stack
  • Downloads and re-uploads these files with v2 indexing configuration
  • Processes files in batches to avoid overwhelming the API
  • Preserves all file metadata, access policies, and tags during migration

Prerequisites

Installing Bun

This project uses Bun, a fast all-in-one JavaScript runtime. To install Bun:

macOS/Linux:

curl -fsSL https://bun.sh/install | bash

Windows:

powershell -c "irm bun.sh/install.ps1 | iex"

Via npm (alternative):

npm install -g bun

Setup

  1. Install dependencies:
bun install
  1. Configure authentication using one of these methods:

    Option A: Botpress CLI Profile (recommended)

    bp login
    bp profiles list # Edit profiles in $HOME/.botpress/profiles.json if needed

    Option B: Environment variables

    export BOT_ID=your-bot-id
    export API_URL=https://api.botpress.cloud
    export TOKEN=your-token

    Option C: Command line arguments

    bun run index.ts --botId=your-bot-id --apiUrl=https://api.botpress.cloud --token=your-token

Usage

Run the migration:

bun run index.ts

The tool will:

  1. Connect to your workspace and display workspace/bot information
  2. Scan all files and identify those needing migration
  3. Show how many files need migration and ask for confirmation
  4. Process files in batches of 5 concurrent uploads
  5. Display progress for each file and final success/error status

Configuration

  • BATCH_SIZE: Number of concurrent file migrations (default: 5)
  • Modify this in index.ts if you need to adjust the concurrency level

Notes

  • Files are processed in batches to prevent API rate limiting
  • All file properties (metadata, access policies, tags) are preserved
  • Only files with indexingStack === "v1" are migrated
  • The tool will exit gracefully if no files need migration

About

Migration tool to RAG v2 stack

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published