Skip to content

Commit

Permalink
make gpt model names configurable
Browse files Browse the repository at this point in the history
  • Loading branch information
gabrielburnworth committed Nov 10, 2023
1 parent f9144d9 commit 1e29434
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
4 changes: 3 additions & 1 deletion app/controllers/api/ais_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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},
Expand Down
4 changes: 4 additions & 0 deletions example.env
Original file line number Diff line number Diff line change
Expand Up @@ -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=

0 comments on commit 1e29434

Please sign in to comment.