adds chatgpt-4o-latest
This commit is contained in:
parent
f7fd5f00f2
commit
5e1fffe07d
|
@ -415,18 +415,18 @@ export const config: Config = {
|
||||||
firebaseKey: getEnvWithDefault("FIREBASE_KEY", undefined),
|
firebaseKey: getEnvWithDefault("FIREBASE_KEY", undefined),
|
||||||
textModelRateLimit: getEnvWithDefault("TEXT_MODEL_RATE_LIMIT", 4),
|
textModelRateLimit: getEnvWithDefault("TEXT_MODEL_RATE_LIMIT", 4),
|
||||||
imageModelRateLimit: getEnvWithDefault("IMAGE_MODEL_RATE_LIMIT", 4),
|
imageModelRateLimit: getEnvWithDefault("IMAGE_MODEL_RATE_LIMIT", 4),
|
||||||
maxContextTokensOpenAI: getEnvWithDefault("MAX_CONTEXT_TOKENS_OPENAI", 16384),
|
maxContextTokensOpenAI: getEnvWithDefault("MAX_CONTEXT_TOKENS_OPENAI", 32768),
|
||||||
maxContextTokensAnthropic: getEnvWithDefault(
|
maxContextTokensAnthropic: getEnvWithDefault(
|
||||||
"MAX_CONTEXT_TOKENS_ANTHROPIC",
|
"MAX_CONTEXT_TOKENS_ANTHROPIC",
|
||||||
0
|
32768
|
||||||
),
|
),
|
||||||
maxOutputTokensOpenAI: getEnvWithDefault(
|
maxOutputTokensOpenAI: getEnvWithDefault(
|
||||||
["MAX_OUTPUT_TOKENS_OPENAI", "MAX_OUTPUT_TOKENS"],
|
["MAX_OUTPUT_TOKENS_OPENAI", "MAX_OUTPUT_TOKENS"],
|
||||||
400
|
1024
|
||||||
),
|
),
|
||||||
maxOutputTokensAnthropic: getEnvWithDefault(
|
maxOutputTokensAnthropic: getEnvWithDefault(
|
||||||
["MAX_OUTPUT_TOKENS_ANTHROPIC", "MAX_OUTPUT_TOKENS"],
|
["MAX_OUTPUT_TOKENS_ANTHROPIC", "MAX_OUTPUT_TOKENS"],
|
||||||
400
|
1024
|
||||||
),
|
),
|
||||||
allowedModelFamilies: getEnvWithDefault(
|
allowedModelFamilies: getEnvWithDefault(
|
||||||
"ALLOWED_MODEL_FAMILIES",
|
"ALLOWED_MODEL_FAMILIES",
|
||||||
|
|
|
@ -58,6 +58,8 @@ export const validateContextSize: RequestPreprocessor = async (req) => {
|
||||||
modelMax = 16384;
|
modelMax = 16384;
|
||||||
} else if (model.match(/^gpt-4o/)) {
|
} else if (model.match(/^gpt-4o/)) {
|
||||||
modelMax = 128000;
|
modelMax = 128000;
|
||||||
|
} else if (model.match(/^chatgpt-4o/)) {
|
||||||
|
modelMax = 128000;
|
||||||
} else if (model.match(/gpt-4-turbo(-\d{4}-\d{2}-\d{2})?$/)) {
|
} else if (model.match(/gpt-4-turbo(-\d{4}-\d{2}-\d{2})?$/)) {
|
||||||
modelMax = 131072;
|
modelMax = 131072;
|
||||||
} else if (model.match(/gpt-4-turbo(-preview)?$/)) {
|
} else if (model.match(/gpt-4-turbo(-preview)?$/)) {
|
||||||
|
|
|
@ -35,6 +35,8 @@ export const KNOWN_OPENAI_MODELS = [
|
||||||
// GPT4o Mini
|
// GPT4o Mini
|
||||||
"gpt-4o-mini",
|
"gpt-4o-mini",
|
||||||
"gpt-4o-mini-2024-07-18",
|
"gpt-4o-mini-2024-07-18",
|
||||||
|
// GPT4o (ChatGPT)
|
||||||
|
"chatgpt-4o-latest",
|
||||||
// GPT4 Turbo (superceded by GPT4o)
|
// GPT4 Turbo (superceded by GPT4o)
|
||||||
"gpt-4-turbo",
|
"gpt-4-turbo",
|
||||||
"gpt-4-turbo-2024-04-09", // gpt4-turbo stable, with vision
|
"gpt-4-turbo-2024-04-09", // gpt4-turbo stable, with vision
|
||||||
|
|
|
@ -52,7 +52,7 @@ export const OpenAIV1ChatCompletionSchema = z
|
||||||
.number()
|
.number()
|
||||||
.int()
|
.int()
|
||||||
.nullish()
|
.nullish()
|
||||||
.default(Math.min(OPENAI_OUTPUT_MAX, 4096))
|
.default(Math.min(OPENAI_OUTPUT_MAX, 16384))
|
||||||
.transform((v) => Math.min(v ?? OPENAI_OUTPUT_MAX, OPENAI_OUTPUT_MAX)),
|
.transform((v) => Math.min(v ?? OPENAI_OUTPUT_MAX, OPENAI_OUTPUT_MAX)),
|
||||||
frequency_penalty: z.number().optional().default(0),
|
frequency_penalty: z.number().optional().default(0),
|
||||||
presence_penalty: z.number().optional().default(0),
|
presence_penalty: z.number().optional().default(0),
|
||||||
|
|
|
@ -130,6 +130,7 @@ export const IMAGE_GEN_MODELS: ModelFamily[] = ["dall-e", "azure-dall-e"];
|
||||||
|
|
||||||
export const OPENAI_MODEL_FAMILY_MAP: { [regex: string]: OpenAIModelFamily } = {
|
export const OPENAI_MODEL_FAMILY_MAP: { [regex: string]: OpenAIModelFamily } = {
|
||||||
"^gpt-4o(-\\d{4}-\\d{2}-\\d{2})?$": "gpt4o",
|
"^gpt-4o(-\\d{4}-\\d{2}-\\d{2})?$": "gpt4o",
|
||||||
|
"^chatgpt-4o": "gpt4o",
|
||||||
"^gpt-4o-mini(-\\d{4}-\\d{2}-\\d{2})?$": "turbo", // closest match
|
"^gpt-4o-mini(-\\d{4}-\\d{2}-\\d{2})?$": "turbo", // closest match
|
||||||
"^gpt-4-turbo(-\\d{4}-\\d{2}-\\d{2})?$": "gpt4-turbo",
|
"^gpt-4-turbo(-\\d{4}-\\d{2}-\\d{2})?$": "gpt4-turbo",
|
||||||
"^gpt-4-turbo(-preview)?$": "gpt4-turbo",
|
"^gpt-4-turbo(-preview)?$": "gpt4-turbo",
|
||||||
|
|
Loading…
Reference in New Issue