Skip to content

Commit

Permalink
Set gpt-4o as default for OpenAI (#1391)
Browse files Browse the repository at this point in the history
  • Loading branch information
timothycarambat committed May 13, 2024
1 parent 2fabc84 commit 64b6229
Show file tree
Hide file tree
Showing 11 changed files with 24 additions and 12 deletions.
2 changes: 1 addition & 1 deletion docker/.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ GID='1000'
###########################################
# LLM_PROVIDER='openai'
# OPEN_AI_KEY=
# OPEN_MODEL_PREF='gpt-3.5-turbo'
# OPEN_MODEL_PREF='gpt-4o'

# LLM_PROVIDER='gemini'
# GEMINI_API_KEY=
Expand Down
2 changes: 1 addition & 1 deletion server/.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ JWT_SECRET="my-random-string-for-seeding" # Please generate random string at lea
###########################################
# LLM_PROVIDER='openai'
# OPEN_AI_KEY=
# OPEN_MODEL_PREF='gpt-3.5-turbo'
# OPEN_MODEL_PREF='gpt-4o'

# LLM_PROVIDER='gemini'
# GEMINI_API_KEY=
Expand Down
2 changes: 1 addition & 1 deletion server/models/systemSettings.js
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ const SystemSettings = {
return {
// OpenAI Keys
OpenAiKey: !!process.env.OPEN_AI_KEY,
OpenAiModelPref: process.env.OPEN_MODEL_PREF || "gpt-3.5-turbo",
OpenAiModelPref: process.env.OPEN_MODEL_PREF || "gpt-4o",

// Azure + OpenAI Keys
AzureOpenAiEndpoint: process.env.AZURE_OPENAI_ENDPOINT,
Expand Down
4 changes: 2 additions & 2 deletions server/utils/AiProviders/openAi/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@ class OpenAiLLM {
this.openai = new OpenAIApi({
apiKey: process.env.OPEN_AI_KEY,
});
this.model =
modelPreference || process.env.OPEN_MODEL_PREF || "gpt-3.5-turbo";
this.model = modelPreference || process.env.OPEN_MODEL_PREF || "gpt-4o";
this.limits = {
history: this.promptWindowLimit() * 0.15,
system: this.promptWindowLimit() * 0.15,
Expand Down Expand Up @@ -48,6 +47,7 @@ class OpenAiLLM {
case "gpt-3.5-turbo":
case "gpt-3.5-turbo-1106":
return 16_385;
case "gpt-4o":
case "gpt-4-turbo":
case "gpt-4-1106-preview":
case "gpt-4-turbo-preview":
Expand Down
2 changes: 1 addition & 1 deletion server/utils/agents/aibitat/example/beginner-chat.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const Agent = {

const aibitat = new AIbitat({
provider: "openai",
model: "gpt-3.5-turbo",
model: "gpt-4o",
})
.use(cli.plugin())
.function({
Expand Down
2 changes: 1 addition & 1 deletion server/utils/agents/aibitat/example/blog-post-coding.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const {
require("dotenv").config({ path: `../../../../.env.development` });

const aibitat = new AIbitat({
model: "gpt-3.5-turbo",
model: "gpt-4o",
})
.use(cli.plugin())
.use(fileHistory.plugin())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ async function runAIbitat(socket) {
console.log(chalk.blue("Booting AIbitat class & starting agent(s)"));
const aibitat = new AIbitat({
provider: "openai",
model: "gpt-3.5-turbo",
model: "gpt-4o",
})
.use(websocket.plugin({ socket }))
.use(webBrowsing.plugin())
Expand Down
6 changes: 5 additions & 1 deletion server/utils/agents/aibitat/providers/openai.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ class OpenAIProvider extends Provider {
input: 0.03,
output: 0.06,
},
"gpt-4o": {
input: 0.005,
output: 0.015,
},
"gpt-4-32k": {
input: 0.06,
output: 0.12,
Expand All @@ -33,7 +37,7 @@ class OpenAIProvider extends Provider {
apiKey: process.env.OPEN_AI_KEY,
maxRetries: 3,
},
model = "gpt-3.5-turbo",
model = "gpt-4o",
} = config;

const client = new OpenAI(options);
Expand Down
2 changes: 1 addition & 1 deletion server/utils/agents/aibitat/utils/summarize.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const Provider = require("../providers/ai-provider");

const SUMMARY_MODEL = {
anthropic: "claude-3-opus-20240229", // 200,000 tokens
openai: "gpt-3.5-turbo-1106", // 16,385 tokens
openai: "gpt-4o", // 128,000 tokens
};

async function summarizeContent(
Expand Down
4 changes: 2 additions & 2 deletions server/utils/agents/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ class AgentHandler {
#providerDefault() {
switch (this.provider) {
case "openai":
return "gpt-3.5-turbo";
return "gpt-4o";
case "anthropic":
return "claude-3-sonnet-20240229";
case "lmstudio":
Expand Down Expand Up @@ -258,7 +258,7 @@ class AgentHandler {
) {
this.aibitat = new AIbitat({
provider: this.provider ?? "openai",
model: this.model ?? "gpt-3.5-turbo",
model: this.model ?? "gpt-4o",
chats: await this.#chatHistory(20),
handlerProps: {
invocation: this.invocation,
Expand Down
8 changes: 8 additions & 0 deletions server/utils/helpers/customModels.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,14 @@ async function openAiModels(apiKey = null) {
owned_by: "openai",
organization: "OpenAi",
},
{
name: "gpt-4o",
id: "gpt-4o",
object: "model",
created: 1677610602,
owned_by: "openai",
organization: "OpenAi",
},
{
name: "gpt-4",
id: "gpt-4",
Expand Down

0 comments on commit 64b6229

Please sign in to comment.