Skip to content

Commit

Permalink
Merge pull request #26 from ijwfly/feature/gpt-4-turbo-alias-support
Browse files Browse the repository at this point in the history
gpt-4-turbo-preview alias support
  • Loading branch information
ijwfly committed Jan 27, 2024
2 parents fad0fab + 739dd37 commit fe01d9e
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 5 deletions.
2 changes: 1 addition & 1 deletion app/bot/settings_menu.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
}

GPT_MODELS_OPTIONS_PREVIEW = {
'gpt-4-1106-preview': 'GPT-4-Turbo',
'gpt-4-turbo-preview': 'GPT-4-Turbo',
'gpt-4-vision-preview': 'GPT-4-Vision',
}

Expand Down
2 changes: 1 addition & 1 deletion app/bot/user_role_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ def get_role_commands(user_role: UserRole):
# commands += [
# types.BotCommand(command="/gpt3", description="set model to gpt-3.5-turbo"),
# types.BotCommand(command="/gpt4", description="set model to gpt-4"),
# types.BotCommand(command="/gpt4turbo", description="set model to gpt-4-1106-preview"),
# types.BotCommand(command="/gpt4turbo", description="set model to gpt-4-turbo-preview"),
# types.BotCommand(command="/gpt4vision", description="set model to gpt-4-vision-preview"),
# ]

Expand Down
2 changes: 1 addition & 1 deletion app/context/context_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def get_config(model: str):
summary_length=1024,
hard_max_context_size=9*1024,
)
elif model == 'gpt-4-1106-preview':
elif model == 'gpt-4-turbo-preview':
return ContextConfiguration(
model_name=model,
long_term_memory_tokens=512,
Expand Down
2 changes: 1 addition & 1 deletion app/openai_helpers/chatgpt.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class GptModel:
GPT_35_TURBO = 'gpt-3.5-turbo'
GPT_35_TURBO_16K = 'gpt-3.5-turbo-16k'
GPT_4 = 'gpt-4'
GPT_4_TURBO_PREVIEW = 'gpt-4-1106-preview'
GPT_4_TURBO_PREVIEW = 'gpt-4-turbo-preview'
GPT_4_VISION_PREVIEW = 'gpt-4-vision-preview'


Expand Down
3 changes: 2 additions & 1 deletion app/openai_helpers/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@


COMPLETION_PRICE = {
'gpt-3.5-turbo': (Decimal('0.0015'), Decimal('0.002')),
'gpt-3.5-turbo': (Decimal('0.0005'), Decimal('0.0015')),
'gpt-3.5-turbo-16k': (Decimal('0.003'), Decimal('0.004')),
'gpt-4': (Decimal('0.03'), Decimal('0.06')),
'gpt-4-1106-preview': (Decimal('0.01'), Decimal('0.03')),
'gpt-4-vision-preview': (Decimal('0.01'), Decimal('0.03')),
'gpt-4-turbo-preview': (Decimal('0.01'), Decimal('0.03')),
}

WHISPER_PRICE = Decimal('0.006')
Expand Down
3 changes: 3 additions & 0 deletions migrations/sql/0010_gpt_4_turbo_alias.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
CREATE SCHEMA IF NOT EXISTS chatgpttg;

UPDATE chatgpttg.user SET current_model = 'gpt-4-turbo-preview' WHERE current_model = 'gpt-4-1106-preview';

0 comments on commit fe01d9e

Please sign in to comment.