diff --git a/backend/dataset/migrations/0048_auto_20240219_0524.py b/backend/dataset/migrations/0048_auto_20240219_0524.py new file mode 100644 index 00000000..a1f3d326 --- /dev/null +++ b/backend/dataset/migrations/0048_auto_20240219_0524.py @@ -0,0 +1,53 @@ +# Generated by Django 3.2.14 on 2024-02-19 05:24 + +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + dependencies = [ + ("dataset", "0047_alter_instruction_meta_info_language"), + ] + + operations = [ + migrations.AddField( + model_name="promptanswer", + name="eval_form_output_json", + field=models.JSONField( + blank=True, + help_text="Form output of the prompt response (JSON)", + null=True, + verbose_name="evaluation_form_output", + ), + ), + migrations.AddField( + model_name="promptanswer", + name="eval_output_likert_score", + field=models.IntegerField( + blank=True, + help_text="Rating of the prompt response", + null=True, + verbose_name="evaluation_prompt_response_rating", + ), + ), + migrations.AddField( + model_name="promptanswer", + name="eval_time_taken", + field=models.FloatField( + blank=True, + help_text="Time taken to complete the prompt response", + null=True, + verbose_name="evaluation_time_taken", + ), + ), + migrations.AddField( + model_name="promptanswer", + name="interaction_id", + field=models.ForeignKey( + blank=True, + null=True, + on_delete=django.db.models.deletion.CASCADE, + to="dataset.interaction", + ), + ), + ] diff --git a/backend/dataset/models.py b/backend/dataset/models.py index 47dfbe15..a10b59dd 100644 --- a/backend/dataset/models.py +++ b/backend/dataset/models.py @@ -767,6 +767,9 @@ class PromptAnswer(DatasetBase): Dataset for storing prompt response data """ + interaction_id = models.ForeignKey( + Interaction, on_delete=models.CASCADE, null=True, blank=True + ) prompt = models.TextField( verbose_name="prompt", null=True, @@ -788,6 +791,24 @@ class PromptAnswer(DatasetBase): language = models.CharField( verbose_name="language", choices=LANG_CHOICES, max_length=15 ) + eval_output_likert_score = models.IntegerField( + verbose_name="evaluation_prompt_response_rating", + null=True, + blank=True, + help_text=("Rating of the prompt response"), + ) + eval_form_output_json = models.JSONField( + verbose_name="evaluation_form_output", + null=True, + blank=True, + help_text=("Form output of the prompt response (JSON)"), + ) + eval_time_taken = models.FloatField( + verbose_name="evaluation_time_taken", + null=True, + blank=True, + help_text=("Time taken to complete the prompt response"), + ) def __str__(self): return str(self.id) diff --git a/backend/projects/migrations/0055_alter_project_project_type.py b/backend/projects/migrations/0055_alter_project_project_type.py new file mode 100644 index 00000000..d8f1a66f --- /dev/null +++ b/backend/projects/migrations/0055_alter_project_project_type.py @@ -0,0 +1,25 @@ +# Generated by Django 3.2.14 on 2024-02-19 05:24 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + dependencies = [ + ("projects", "0054_alter_project_project_type"), + ] + + operations = [ + migrations.AlterField( + model_name="project", + name="project_type", + field=models.CharField( + choices=[ + ("ModelOutputEvaluation", "ModelOutputEvaluation"), + ("ModelInteractionEvaluation", "ModelInteractionEvaluation"), + ("InstructionDrivenChat", "InstructionDrivenChat"), + ], + help_text="Project Type indicating the annotation task", + max_length=100, + ), + ), + ] diff --git a/backend/projects/project_registry.yaml b/backend/projects/project_registry.yaml index 7dcb2507..01c4b735 100644 --- a/backend/projects/project_registry.yaml +++ b/backend/projects/project_registry.yaml @@ -20,6 +20,25 @@ ModelOutputEvaluation: - form_output_json - output_likert_score - time_taken + ModelInteractionEvaluation: + input_dataset: + class: Interaction + fields: + - id + - interactions_json + - no_of_turns + - model + - language + output_dataset: + class: PromptAnswer + save_type: new_record + fields: + copy_from_input: + id: interaction_id + annotations: + - eval_form_output_json + - eval_output_likert_score + - eval_time_taken Chat: description: "Instruction Driven Chat" project_types: