Skip to content

Commit

Permalink
Merge pull request #3914 from tgmerritt/pe/add_o3-mini
Browse files Browse the repository at this point in the history
add support for o3-mini
  • Loading branch information
sestinj authored Feb 1, 2025
2 parents 9ae37ac + e7be878 commit cd97a73
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 6 deletions.
1 change: 1 addition & 0 deletions core/llm/llms/Asksage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ class Asksage extends BaseLLM {
"gpt4-32k": "gpt4-32k",
"gpt-o1": "gpt-o1", // Works
"gpt-o1-mini": "gpt-o1-mini", // Works
"gpt-o3-mini": "gpt-o3-mini", // Stub
"gpt-3.5-turbo": "gpt35-16k", // Works
"aws-bedrock-claude-35-sonnet-gov": "aws-bedrock-claude-35-sonnet-gov", // Works
"claude-3-5-sonnet-latest": "claude-35-sonnet", // Works
Expand Down
13 changes: 7 additions & 6 deletions core/llm/llms/OpenAI.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ const CHAT_ONLY_MODELS = [
"gpt-4o-mini",
"o1-preview",
"o1-mini",
"o3-mini"
];

const formatMessageForO1 = (messages: ChatCompletionMessageParam[]) => {
Expand Down Expand Up @@ -92,8 +93,8 @@ class OpenAI extends BaseLLM {
return model;
}

private isO1Model(model?: string): boolean {
return !!model && model.startsWith("o1");
private isO3orO1Model(model?: string): boolean {
return !!model && (model.startsWith("o1") || model.startsWith("o3"));
}

protected supportsPrediction(model: string): boolean {
Expand Down Expand Up @@ -144,8 +145,8 @@ class OpenAI extends BaseLLM {

finalOptions.stop = options.stop?.slice(0, this.getMaxStopWords());

// OpenAI o1-preview and o1-mini:
if (this.isO1Model(options.model)) {
// OpenAI o1-preview and o1-mini or o3-mini:
if (this.isO3orO1Model(options.model)) {
// a) use max_completion_tokens instead of max_tokens
finalOptions.max_completion_tokens = options.maxTokens;
finalOptions.max_tokens = undefined;
Expand Down Expand Up @@ -239,8 +240,8 @@ class OpenAI extends BaseLLM {
): ChatCompletionCreateParams {
body.stop = body.stop?.slice(0, this.getMaxStopWords());

// OpenAI o1-preview and o1-mini:
if (this.isO1Model(body.model)) {
// OpenAI o1-preview and o1-mini or o3-mini:
if (this.isO3orO1Model(body.model)) {
// a) use max_completion_tokens instead of max_tokens
body.max_completion_tokens = body.max_tokens;
body.max_tokens = undefined;
Expand Down
1 change: 1 addition & 0 deletions docs/docs/customize/model-providers/more/asksage.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ The current Models available provided by Ask Sage are:
| 8 | GPT-4-32K | Yes ||
| 9 | GPT-o1 | Yes ||
| 10 | GPT-o1-mini | Yes ||
| 10 | GPT-o3-mini | Yes ||
| 11 | GPT-3.5-turbo | Yes ||
| 12 | Calude 3.5 Sonnet Gov | Yes ||
| 13 | Calude 3 Opus | Yes ||
Expand Down
15 changes: 15 additions & 0 deletions gui/src/pages/AddNewModel/configs/models.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1228,6 +1228,21 @@ export const models: { [key: string]: ModelPackage } = {
icon: "openai.png",
isOpenSource: false,
},
asksagegpto3mini: {
title: "GPT-o3-mini",
description:
"o3-mini can outperform o1 in coding and other reasoning tasks, and is 93% cheaper and has lower latency. It supports function calling, Structured Outputs, streaming, and developer messages. o3-mini comes with a larger context window of 200,000 tokens and a max output of 100,000 tokens",
params: {
model: "gpt-o3-mini",
contextLength: 200_000,
title: "GPT-o3-mini",
systemMessage:
"You are an expert software developer. You give helpful and concise responses.",
},
providerOptions: ["askSage"],
icon: "openai.png",
isOpenSource: false,
},
asksageclaude35gov: {
title: "Claude 3.5 Sonnet gov",
description:
Expand Down
7 changes: 7 additions & 0 deletions packages/llm-info/src/providers/openai.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,13 @@ export const OpenAi: ModelProvider = {
maxCompletionTokens: 65536,
recommendedFor: ["chat"],
},
{
model: "o3-mini",
displayName: "o3 Mini",
contextLength: 128000,
maxCompletionTokens: 65536,
recommendedFor: ["chat"],
},
// embed
{
model: "text-embedding-3-large",
Expand Down

0 comments on commit cd97a73

Please sign in to comment.