PhoenixKit.Migrations.Postgres.V34 (phoenix_kit v1.7.71)

Copy Markdown View Source

PhoenixKit V34 Migration: AI Endpoints System

This migration replaces the Accounts + Slots architecture with a unified Endpoints system where each endpoint contains credentials, model selection, and generation parameters in a single entity.

Architecture Change

Before (V32)

  • Accounts Table: Provider credentials only
  • Slots: Stored in Settings as JSON (4 types × 3 slots each)
  • Slots referenced account_id for credentials
  • Fallback chain: tries slot 0 → 1 → 2

After (V34)

  • Endpoints Table: Unified configuration
    • Provider credentials (name, api_key, base_url, provider_settings)
    • Model selection (single model per endpoint)
    • Generation parameters (temperature, max_tokens, etc.)
  • No type categorization (user decides endpoint purpose)
  • No fallback chain (explicit endpoint targeting)

Changes

New Table: phoenix_kit_ai_endpoints

  • Unified configuration combining account + slot fields
  • All generation parameters in one place
  • Sort order for display

Modified Table: phoenix_kit_ai_requests

  • Added endpoint_id for new requests
  • Added endpoint_name for denormalized history
  • Kept account_id/slot_index for backward compatibility

Cleanup

  • Remove slot Settings entries (ai_text_processing_slots, etc.)
  • Keep ai_enabled setting
  • Keep accounts table for historical request references

Summary

Functions

Rollback the V34 migration.

Run the V34 migration to add the AI Endpoints system.

Functions

down(opts)

Rollback the V34 migration.

up(opts)

Run the V34 migration to add the AI Endpoints system.