-
Notifications
You must be signed in to change notification settings - Fork 31
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature/add settings to chat model #1027
Merged
gecBurton
merged 12 commits into
feature/llm-selector
from
feature/add-settings-to-chat-model
Sep 9, 2024
Merged
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
09afad5
added ai-settings to chat model
c37b52d
added migration test
ce02880
simplified
113af40
Add LLM selector to the UI
KevinEtchells 7e9731d
Send selected LLM back to Django (via form submit and websocket)
KevinEtchells 7d26746
Explicitly set value attributes on LLM selector, so "(default)" isn't…
KevinEtchells efa0d4a
pasing values to front end
3b31e52
Merge branch 'feature/llm-selector' into feature/add-settings-to-chat…
gecBurton c283520
reduced the scale of change
cf7032a
now updating
2a5e0f1
added temprature
3028767
added temperature to consumer
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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
63 changes: 63 additions & 0 deletions
63
...p/redbox_core/migrations/0042_chat_chat_backend_chat_chat_map_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,63 @@ | ||
# Generated by Django 5.1.1 on 2024-09-07 11:53 | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
|
||
def back_populate_ai_settings_on_chat(apps, schema_editor): | ||
Chat = apps.get_model("redbox_core", "Chat") | ||
for chat in Chat.objects.all(): | ||
chat.chat_backend = chat.user.ai_settings.chat_backend | ||
chat.temperature = 0 | ||
chat.save() | ||
|
||
AISettings = apps.get_model("redbox_core", "AISettings") | ||
for ai_settings in AISettings.objects.all(): | ||
ai_settings.temperature = 0 | ||
ai_settings.save() | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('redbox_core', '0041_alter_aisettings_chat_backend'), | ||
] | ||
|
||
operations = [ | ||
migrations.AddField( | ||
model_name='chat', | ||
name='chat_backend', | ||
field=models.CharField(blank=True, choices=[('gpt-35-turbo-16k', 'gpt-35-turbo-16k'), ('gpt-4-turbo-2024-04-09', 'gpt-4-turbo-2024-04-09'), ('gpt-4o', 'gpt-4o'), ('anthropic.claude-3-sonnet-20240229-v1:0', 'claude-3-sonnet'), ('anthropic.claude-3-haiku-20240307-v1:0', 'claude-3-haiku')], default='gpt-4o', help_text='LLM to use in chat', max_length=64, null=True), | ||
), | ||
migrations.AddField( | ||
model_name='aisettings', | ||
name='temperature', | ||
field=models.FloatField(blank=True, default=0, help_text='temperature for LLM', null=True), | ||
), | ||
migrations.AddField( | ||
model_name='chat', | ||
name='temperature', | ||
field=models.FloatField(blank=True, default=0, help_text='temperature for LLM', null=True), | ||
), | ||
migrations.RunPython(back_populate_ai_settings_on_chat, migrations.RunPython.noop), | ||
migrations.AlterField( | ||
model_name='chat', | ||
name='chat_backend', | ||
field=models.CharField( | ||
choices=[('gpt-35-turbo-16k', 'gpt-35-turbo-16k'), ('gpt-4-turbo-2024-04-09', 'gpt-4-turbo-2024-04-09'), | ||
('gpt-4o', 'gpt-4o'), ('anthropic.claude-3-sonnet-20240229-v1:0', 'claude-3-sonnet'), | ||
('anthropic.claude-3-haiku-20240307-v1:0', 'claude-3-haiku')], default='gpt-4o', | ||
help_text='LLM to use in chat', max_length=64), | ||
), | ||
migrations.AlterField( | ||
model_name='aisettings', | ||
name='temperature', | ||
field=models.FloatField(default=0, help_text='temperature for LLM'), | ||
), | ||
migrations.AlterField( | ||
model_name='chat', | ||
name='temperature', | ||
field=models.FloatField(default=0, help_text='temperature for LLM'), | ||
), | ||
|
||
] |
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
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
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
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
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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this will default to
None
, i.e. the frontend does not need to set this