chore: Update GPT Model (#10111)

Update the open AI model, as 3.5 is being deprecated. Provide as option to swap out models via environment variables.
This commit is contained in:
Sojan Jose
2024-09-15 21:11:20 -07:00
committed by GitHub
parent aaab2ac788
commit ab86f62fcc
2 changed files with 14 additions and 13 deletions

View File

@@ -1,10 +1,11 @@
class Integrations::OpenaiBaseService
# 3.5 support 16,385 tokens
# gpt-4o-mini supports 128,000 tokens
# 1 token is approx 4 characters
# 16385 * 4 = 65540 characters, sticking to 50,000 to be safe
TOKEN_LIMIT = 50_000
# sticking with 120000 to be safe
# 120000 * 4 = 480,000 characters (rounding off downwards to 400,000 to be safe)
TOKEN_LIMIT = 400_000
API_URL = 'https://api.openai.com/v1/chat/completions'.freeze
GPT_MODEL = 'gpt-3.5-turbo'.freeze
GPT_MODEL = ENV.fetch('OPENAI_GPT_MODEL', 'gpt-4o-mini').freeze
ALLOWED_EVENT_NAMES = %w[rephrase summarize reply_suggestion fix_spelling_grammar shorten expand make_friendly make_formal simplify].freeze
CACHEABLE_EVENTS = %w[].freeze