-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feature/Make AISettings sparse overrides only (#1180)
* Make AISettings sparse overrides only * bug fix * remove nulls * set all values to null
- Loading branch information
Showing
3 changed files
with
287 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
242 changes: 242 additions & 0 deletions
242
.../redbox_core/migrations/0067_alter_aisettings_agentic_give_up_question_prompt_and_more.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,242 @@ | ||
# Generated by Django 5.1.2 on 2024-11-12 06:09 | ||
import django | ||
from django.db import migrations, models | ||
|
||
def set_ai_settings_prompt_value_to_null(apps, schema_editor): | ||
AISettings = apps.get_model("redbox_core", "AISettings") | ||
for ai_settings in AISettings.objects.all(): | ||
ai_settings.context_window_size = None | ||
ai_settings.llm_max_tokens = None | ||
ai_settings.max_document_tokens = None | ||
ai_settings.self_route_enabled = None | ||
ai_settings.map_max_concurrency = None | ||
ai_settings.stuff_chunk_context_ratio = None | ||
ai_settings.recursion_limit = None | ||
ai_settings.chat_system_prompt = None | ||
ai_settings.chat_question_prompt = None | ||
ai_settings.chat_with_docs_system_prompt = None | ||
ai_settings.chat_with_docs_question_prompt = None | ||
ai_settings.chat_with_docs_reduce_system_prompt = None | ||
ai_settings.retrieval_system_prompt = None | ||
ai_settings.retrieval_question_prompt = None | ||
ai_settings.agentic_retrieval_system_prompt = None | ||
ai_settings.agentic_retrieval_question_prompt = None | ||
ai_settings.agentic_give_up_system_prompt = None | ||
ai_settings.agentic_give_up_question_prompt = None | ||
ai_settings.condense_system_prompt = None | ||
ai_settings.condense_question_prompt = None | ||
ai_settings.chat_map_system_prompt = None | ||
ai_settings.chat_map_question_prompt = None | ||
ai_settings.reduce_system_prompt = None | ||
ai_settings.rag_k = None | ||
ai_settings.rag_num_candidates = None | ||
ai_settings.rag_gauss_scale_size = None | ||
ai_settings.rag_gauss_scale_decay = None | ||
ai_settings.rag_gauss_scale_min = None | ||
ai_settings.rag_gauss_scale_max = None | ||
ai_settings.rag_desired_chunk_size = None | ||
ai_settings.elbow_filter_enabled = None | ||
ai_settings.match_boost = None | ||
ai_settings.match_name_boost = None | ||
ai_settings.match_description_boost = None | ||
ai_settings.match_keywords_boost = None | ||
ai_settings.knn_boost = None | ||
ai_settings.similarity_threshold = None | ||
|
||
ai_settings.save() | ||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('redbox_core', '0066_alter_aisettings_agentic_retrieval_system_prompt'), | ||
] | ||
|
||
operations = [ | ||
migrations.AlterField( | ||
model_name='aisettings', | ||
name='context_window_size', | ||
field=models.PositiveIntegerField(blank=True, null=True), | ||
), | ||
migrations.AlterField( | ||
model_name='aisettings', | ||
name='llm_max_tokens', | ||
field=models.PositiveIntegerField(blank=True, null=True), | ||
), | ||
migrations.AlterField( | ||
model_name='aisettings', | ||
name='map_max_concurrency', | ||
field=models.PositiveIntegerField(blank=True, null=True), | ||
), | ||
migrations.AlterField( | ||
model_name='aisettings', | ||
name='max_document_tokens', | ||
field=models.PositiveIntegerField(blank=True, null=True), | ||
), | ||
migrations.AlterField( | ||
model_name='aisettings', | ||
name='recursion_limit', | ||
field=models.PositiveIntegerField(blank=True, null=True), | ||
), | ||
migrations.AlterField( | ||
model_name='aisettings', | ||
name='self_route_enabled', | ||
field=models.BooleanField(blank=True, null=True), | ||
), | ||
migrations.AlterField( | ||
model_name='aisettings', | ||
name='stuff_chunk_context_ratio', | ||
field=models.FloatField(blank=True, null=True), | ||
), | ||
migrations.AlterField( | ||
model_name='aisettings', | ||
name='agentic_give_up_question_prompt', | ||
field=models.TextField(blank=True, null=True), | ||
), | ||
migrations.AlterField( | ||
model_name='aisettings', | ||
name='agentic_give_up_system_prompt', | ||
field=models.TextField(blank=True, null=True), | ||
), | ||
migrations.AlterField( | ||
model_name='aisettings', | ||
name='agentic_retrieval_question_prompt', | ||
field=models.TextField(blank=True, null=True), | ||
), | ||
migrations.AlterField( | ||
model_name='aisettings', | ||
name='agentic_retrieval_system_prompt', | ||
field=models.TextField(blank=True, null=True), | ||
), | ||
migrations.AlterField( | ||
model_name='aisettings', | ||
name='chat_map_question_prompt', | ||
field=models.TextField(blank=True, null=True), | ||
), | ||
migrations.AlterField( | ||
model_name='aisettings', | ||
name='chat_map_system_prompt', | ||
field=models.TextField(blank=True, null=True), | ||
), | ||
migrations.AlterField( | ||
model_name='aisettings', | ||
name='chat_question_prompt', | ||
field=models.TextField(blank=True, null=True), | ||
), | ||
migrations.AlterField( | ||
model_name='aisettings', | ||
name='chat_system_prompt', | ||
field=models.TextField(blank=True, null=True), | ||
), | ||
migrations.AlterField( | ||
model_name='aisettings', | ||
name='chat_with_docs_question_prompt', | ||
field=models.TextField(blank=True, null=True), | ||
), | ||
migrations.AlterField( | ||
model_name='aisettings', | ||
name='chat_with_docs_reduce_system_prompt', | ||
field=models.TextField(blank=True, null=True), | ||
), | ||
migrations.AlterField( | ||
model_name='aisettings', | ||
name='chat_with_docs_system_prompt', | ||
field=models.TextField(blank=True, null=True), | ||
), | ||
migrations.AlterField( | ||
model_name='aisettings', | ||
name='condense_question_prompt', | ||
field=models.TextField(blank=True, null=True), | ||
), | ||
migrations.AlterField( | ||
model_name='aisettings', | ||
name='condense_system_prompt', | ||
field=models.TextField(blank=True, null=True), | ||
), | ||
migrations.AlterField( | ||
model_name='aisettings', | ||
name='reduce_system_prompt', | ||
field=models.TextField(blank=True, null=True), | ||
), | ||
migrations.AlterField( | ||
model_name='aisettings', | ||
name='retrieval_question_prompt', | ||
field=models.TextField(blank=True, null=True), | ||
), | ||
migrations.AlterField( | ||
model_name='aisettings', | ||
name='retrieval_system_prompt', | ||
field=models.TextField(blank=True, null=True), | ||
), | ||
migrations.AlterField( | ||
model_name='aisettings', | ||
name='rag_gauss_scale_decay', | ||
field=models.DecimalField(blank=True, decimal_places=2, max_digits=5, null=True, validators=[django.core.validators.MinValueValidator(0.0)]), | ||
), | ||
migrations.AlterField( | ||
model_name='aisettings', | ||
name='rag_gauss_scale_max', | ||
field=models.DecimalField(blank=True, decimal_places=2, max_digits=5, null=True, validators=[django.core.validators.MinValueValidator(1.0)]), | ||
), | ||
migrations.AlterField( | ||
model_name='aisettings', | ||
name='rag_gauss_scale_min', | ||
field=models.DecimalField(blank=True, decimal_places=2, max_digits=5, null=True, validators=[django.core.validators.MinValueValidator(1.0)]), | ||
), | ||
migrations.AlterField( | ||
model_name='aisettings', | ||
name='rag_gauss_scale_size', | ||
field=models.PositiveIntegerField(blank=True, null=True), | ||
), | ||
migrations.AlterField( | ||
model_name='aisettings', | ||
name='rag_k', | ||
field=models.PositiveIntegerField(blank=True, null=True), | ||
), | ||
migrations.AlterField( | ||
model_name='aisettings', | ||
name='rag_num_candidates', | ||
field=models.PositiveIntegerField(blank=True, null=True), | ||
), | ||
migrations.AlterField( | ||
model_name='aisettings', | ||
name='elbow_filter_enabled', | ||
field=models.BooleanField(blank=True, null=True), | ||
), | ||
migrations.AlterField( | ||
model_name='aisettings', | ||
name='knn_boost', | ||
field=models.DecimalField(blank=True, decimal_places=2, max_digits=5, null=True), | ||
), | ||
migrations.AlterField( | ||
model_name='aisettings', | ||
name='match_boost', | ||
field=models.DecimalField(blank=True, decimal_places=2, max_digits=5, null=True), | ||
), | ||
migrations.AlterField( | ||
model_name='aisettings', | ||
name='match_description_boost', | ||
field=models.DecimalField(blank=True, decimal_places=2, max_digits=5, null=True), | ||
), | ||
migrations.AlterField( | ||
model_name='aisettings', | ||
name='match_keywords_boost', | ||
field=models.DecimalField(blank=True, decimal_places=2, max_digits=5, null=True), | ||
), | ||
migrations.AlterField( | ||
model_name='aisettings', | ||
name='match_name_boost', | ||
field=models.DecimalField(blank=True, decimal_places=2, max_digits=5, null=True), | ||
), | ||
migrations.AlterField( | ||
model_name='aisettings', | ||
name='rag_desired_chunk_size', | ||
field=models.PositiveIntegerField(blank=True, null=True), | ||
), | ||
migrations.AlterField( | ||
model_name='aisettings', | ||
name='similarity_threshold', | ||
field=models.DecimalField(blank=True, decimal_places=2, max_digits=5, null=True, validators=[django.core.validators.MinValueValidator(0.0), django.core.validators.MaxValueValidator(1.0)]), | ||
), | ||
migrations.RunPython(set_ai_settings_prompt_value_to_null, migrations.RunPython.noop), | ||
|
||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters