The platform for continuously improving AI agents.
import importlib
import django.db.models.deletion
from django.db import migrations, models
one_agent = importlib.import_module("overbae.migrations.0073_one_agent")
def dataset_threads_to_experiments(apps, schema_editor):
"""A dataset conversation started after 0073 ran becomes an experiment the same way."""
# Checked at once: the ALTER TABLE below refuses a table with pending foreign-key checks.
schema_editor.execute("SET CONSTRAINTS ALL IMMEDIATE")
one_agent.dataset_threads_to_experiments(apps, schema_editor)
class Migration(migrations.Migration):
dependencies = [("overbae", "0074_eval_judge_context_and_one_score_per_row")]
operations = [
migrations.RunPython(dataset_threads_to_experiments, migrations.RunPython.noop),
migrations.RemoveConstraint(
model_name="assistantthread", name="assistant_thread_one_subject"
),
migrations.RemoveField(model_name="assistantthread", name="dataset"),
migrations.AlterField(
model_name="assistantthread",
name="experiment",
field=models.OneToOneField(
on_delete=django.db.models.deletion.CASCADE,
related_name="assistant_thread",
to="overbae.experiment",
),
),
]