From 1e29434dd48a8d4d06f26054d68e78b05c753bc0 Mon Sep 17 00:00:00 2001 From: gabrielburnworth Date: Fri, 10 Nov 2023 15:27:35 -0800 Subject: [PATCH] make gpt model names configurable --- app/controllers/api/ais_controller.rb | 4 +++- example.env | 4 ++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/app/controllers/api/ais_controller.rb b/app/controllers/api/ais_controller.rb index 9f11a37968..901094c2fb 100644 --- a/app/controllers/api/ais_controller.rb +++ b/app/controllers/api/ais_controller.rb @@ -111,8 +111,10 @@ def make_request(system_prompt, user_prompt, stream) url = "https://api.openai.com/v1/chat/completions" context_key = raw_json[:context_key] lua_request = context_key == "lua" + model_lua = ENV["OPENAI_MODEL_LUA"] || "gpt-3.5-turbo-16k" + model_other = ENV["OPENAI_MODEL_OTHER"] || "gpt-3.5-turbo" payload = { - "model" => lua_request ? "gpt-3.5-turbo-16k" : "gpt-3.5-turbo", + "model" => lua_request ? model_lua : model_other, "messages" => [ {role: "system", content: system_prompt}, {role: "user", content: user_prompt}, diff --git a/example.env b/example.env index 2e24465c21..a479371b3b 100644 --- a/example.env +++ b/example.env @@ -161,3 +161,7 @@ OPENAI_API_KEY= # OpenAI API sampling temperature. Optional. Float between 0 and 2. # Defaults to 1, use a lower value for less random output. OPENAI_API_TEMPERATURE= +# OpenAI model name for Lua code generation requests. +OPENAI_MODEL_LUA= +# OpenAI model name for other requests. +OPENAI_MODEL_OTHER=