# Generated by Django 5.0.6 on 2024-07-09 06:02

import django.db.models.deletion
from django.db import migrations, models


class Migration(migrations.Migration):

    initial = True

    dependencies = []

    operations = [
        migrations.CreateModel(
            name="Dataset",
            fields=[
                (
                    "id",
                    models.BigAutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                ("name", models.CharField(max_length=100)),
                ("description", models.TextField()),
                ("created_at", models.DateTimeField(auto_now_add=True)),
                ("updated_at", models.DateTimeField(auto_now=True)),
            ],
            options={
                "verbose_name": "Dataset",
                "verbose_name_plural": "Datasets",
                "db_table": "dataset",
            },
        ),
        migrations.CreateModel(
            name="EvalConfig",
            fields=[
                (
                    "id",
                    models.BigAutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                ("name", models.CharField(max_length=100)),
                ("description", models.TextField()),
                (
                    "sys_prompt",
                    models.TextField(
                        default="You are a helpful assistant designed to answer questions.\nProvide concise and accurate responses, ensuring you follow the provided instructions thoroughly."
                    ),
                ),
                ("created_at", models.DateTimeField(auto_now_add=True)),
                ("updated_at", models.DateTimeField(auto_now=True)),
            ],
            options={
                "verbose_name": "EvalConfig",
                "verbose_name_plural": "EvalConfig",
                "db_table": "eval_config",
            },
        ),
        migrations.CreateModel(
            name="LLMBackend",
            fields=[
                (
                    "id",
                    models.BigAutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                ("name", models.CharField(max_length=100)),
                ("parameteres", models.TextField()),
            ],
            options={
                "verbose_name": "LLM Backend",
                "verbose_name_plural": "LLM Backends",
                "db_table": "llm_backed",
            },
        ),
        migrations.CreateModel(
            name="LLMModel",
            fields=[
                (
                    "id",
                    models.BigAutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                ("name", models.CharField(max_length=100)),
                ("parameters", models.TextField()),
                ("created_at", models.DateTimeField(auto_now_add=True)),
                ("updated_at", models.DateTimeField(auto_now=True)),
                (
                    "backend",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        to="commons.llmbackend",
                    ),
                ),
            ],
            options={
                "verbose_name": "LLM Model",
                "verbose_name_plural": "LLM Models",
                "db_table": "llm_model",
            },
        ),
        migrations.CreateModel(
            name="EvalSession",
            fields=[
                (
                    "id",
                    models.BigAutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                ("created_at", models.DateTimeField(auto_now_add=True)),
                ("updated_at", models.DateTimeField(auto_now=True)),
                (
                    "config",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        to="commons.evalconfig",
                    ),
                ),
                (
                    "llm_model",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        to="commons.llmmodel",
                    ),
                ),
            ],
            options={
                "verbose_name": "EvalSession",
                "verbose_name_plural": "EvalSession",
                "db_table": "eval_session",
            },
        ),
        migrations.CreateModel(
            name="QA",
            fields=[
                (
                    "id",
                    models.BigAutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                ("question", models.TextField()),
                ("correct_answer", models.TextField()),
                (
                    "target",
                    models.CharField(
                        choices=[("test", "test"), ("train", "train"), ("dev", "dev")],
                        db_index=True,
                        default="test",
                        max_length=100,
                    ),
                ),
                ("options", models.JSONField()),
                ("correct_answer_idx", models.CharField(max_length=100)),
                ("hash", models.CharField(max_length=100, unique=True)),
                (
                    "dataset",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        to="commons.dataset",
                    ),
                ),
            ],
            options={
                "verbose_name": "QA",
                "verbose_name_plural": "QAs",
                "db_table": "qa",
            },
        ),
        migrations.CreateModel(
            name="EvalAnswer",
            fields=[
                (
                    "id",
                    models.BigAutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                ("instruction", models.TextField()),
                ("assistant_answer", models.TextField()),
                ("is_correct", models.BooleanField()),
                ("created_at", models.DateTimeField(auto_now_add=True)),
                ("hash", models.CharField(max_length=100)),
                (
                    "eval_session",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        to="commons.evalsession",
                    ),
                ),
                (
                    "llm_backend",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        to="commons.llmbackend",
                    ),
                ),
                (
                    "llm_model",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        to="commons.llmmodel",
                    ),
                ),
                (
                    "question",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE, to="commons.qa"
                    ),
                ),
            ],
            options={
                "verbose_name": "EvalAnswer",
                "verbose_name_plural": "EvalAnswer",
                "db_table": "eval_answer",
            },
        ),
        migrations.CreateModel(
            name="RoleMessage",
            fields=[
                (
                    "id",
                    models.BigAutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                (
                    "role",
                    models.CharField(
                        choices=[("assistant", "assistant"), ("user", "user")],
                        db_index=True,
                        max_length=100,
                    ),
                ),
                ("content", models.TextField()),
                (
                    "eval_config",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        to="commons.evalconfig",
                    ),
                ),
            ],
            options={
                "verbose_name": "RoleMessage",
                "verbose_name_plural": "RoleMessage",
                "db_table": "role_message",
            },
        ),
    ]
