mirror of
https://github.com/lobehub/lobe-chat.git
synced 2026-06-14 03:30:19 +00:00
🐛 fix: 'top_p' is not supported with o4-mini (#7747)
* Update index.ts * Update index.ts * Update index.ts * Update index.test.ts.snap * Update openai.ts * ✨ feat: update snap * Update index.ts * Update novita.ts * Update siliconcloud.ts --------- Co-authored-by: Arvin Xu <arvinx@foxmail.com>
This commit is contained in:
@@ -256,6 +256,16 @@ const novitaChatModels: AIChatModelCard[] = [
|
||||
},
|
||||
type: 'chat',
|
||||
},
|
||||
{
|
||||
contextWindowTokens: 160_000,
|
||||
displayName: 'Deepseek Prover V2 671B',
|
||||
id: 'deepseek/deepseek-prover-v2-671b',
|
||||
pricing: {
|
||||
input: 0.7,
|
||||
output: 2.5,
|
||||
},
|
||||
type: 'chat',
|
||||
},
|
||||
{
|
||||
contextWindowTokens: 64_000,
|
||||
displayName: 'Deepseek V3 Turbo',
|
||||
@@ -299,7 +309,7 @@ const novitaChatModels: AIChatModelCard[] = [
|
||||
enabled: true,
|
||||
id: 'deepseek/deepseek-v3-0324',
|
||||
pricing: {
|
||||
input: 0.37,
|
||||
input: 0.33,
|
||||
output: 1.3,
|
||||
},
|
||||
type: 'chat',
|
||||
|
||||
@@ -479,7 +479,7 @@ export const openaiChatModels: AIChatModelCard[] = [
|
||||
{
|
||||
contextWindowTokens: 4096,
|
||||
description:
|
||||
'GPT 3.5 Turbo,适用于各种文本生成和理解任务,Currently points to gpt-3.5-turbo-0125',
|
||||
'GPT 3.5 Turbo,适用于各种文本生成和理解任务,对指令遵循的优化',
|
||||
displayName: 'GPT-3.5 Turbo Instruct',
|
||||
id: 'gpt-3.5-turbo-instruct',
|
||||
pricing: {
|
||||
|
||||
@@ -16,8 +16,8 @@ const siliconcloudChatModels: AIChatModelCard[] = [
|
||||
organization: 'Qwen',
|
||||
pricing: {
|
||||
currency: 'CNY',
|
||||
input: 1.25,
|
||||
output: 5,
|
||||
input: 2.5,
|
||||
output: 10,
|
||||
},
|
||||
releasedAt: '2025-04-28',
|
||||
settings: {
|
||||
@@ -38,8 +38,8 @@ const siliconcloudChatModels: AIChatModelCard[] = [
|
||||
organization: 'Qwen',
|
||||
pricing: {
|
||||
currency: 'CNY',
|
||||
input: 0.5,
|
||||
output: 2,
|
||||
input: 1,
|
||||
output: 4,
|
||||
},
|
||||
releasedAt: '2025-04-28',
|
||||
settings: {
|
||||
@@ -60,8 +60,8 @@ const siliconcloudChatModels: AIChatModelCard[] = [
|
||||
organization: 'Qwen',
|
||||
pricing: {
|
||||
currency: 'CNY',
|
||||
input: 0.35,
|
||||
output: 1.4,
|
||||
input: 0.7,
|
||||
output: 2.8,
|
||||
},
|
||||
releasedAt: '2025-04-28',
|
||||
settings: {
|
||||
@@ -82,8 +82,8 @@ const siliconcloudChatModels: AIChatModelCard[] = [
|
||||
organization: 'Qwen',
|
||||
pricing: {
|
||||
currency: 'CNY',
|
||||
input: 0.25,
|
||||
output: 1,
|
||||
input: 0.5,
|
||||
output: 2,
|
||||
},
|
||||
releasedAt: '2025-04-28',
|
||||
settings: {
|
||||
|
||||
@@ -56,9 +56,9 @@ export class LobeAzureAI implements LobeRuntimeAI {
|
||||
model,
|
||||
...params,
|
||||
stream: enableStreaming,
|
||||
temperature: model.includes('o3') ? undefined : temperature,
|
||||
temperature: (model.includes('o3') || model.includes('o4')) ? undefined : temperature,
|
||||
tool_choice: params.tools ? 'auto' : undefined,
|
||||
top_p: model.includes('o3') ? undefined : top_p,
|
||||
top_p: (model.includes('o3') || model.includes('o4')) ? undefined : top_p,
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
@@ -42,7 +42,7 @@ exports[`LobeOpenAI > models > should get models 1`] = `
|
||||
"contextWindowTokens": undefined,
|
||||
"displayName": undefined,
|
||||
"enabled": false,
|
||||
"functionCall": true,
|
||||
"functionCall": false,
|
||||
"id": "gpt-3.5-turbo-16k",
|
||||
"reasoning": false,
|
||||
"vision": false,
|
||||
@@ -69,7 +69,7 @@ exports[`LobeOpenAI > models > should get models 1`] = `
|
||||
"contextWindowTokens": undefined,
|
||||
"displayName": undefined,
|
||||
"enabled": false,
|
||||
"functionCall": true,
|
||||
"functionCall": false,
|
||||
"id": "gpt-3.5-turbo-16k-0613",
|
||||
"reasoning": false,
|
||||
"vision": false,
|
||||
@@ -87,16 +87,16 @@ exports[`LobeOpenAI > models > should get models 1`] = `
|
||||
"contextWindowTokens": undefined,
|
||||
"displayName": undefined,
|
||||
"enabled": false,
|
||||
"functionCall": true,
|
||||
"functionCall": false,
|
||||
"id": "gpt-4-1106-vision-preview",
|
||||
"reasoning": false,
|
||||
"vision": true,
|
||||
"vision": false,
|
||||
},
|
||||
{
|
||||
"contextWindowTokens": undefined,
|
||||
"displayName": undefined,
|
||||
"enabled": false,
|
||||
"functionCall": true,
|
||||
"functionCall": false,
|
||||
"id": "gpt-3.5-turbo-instruct-0914",
|
||||
"reasoning": false,
|
||||
"vision": false,
|
||||
@@ -123,7 +123,7 @@ exports[`LobeOpenAI > models > should get models 1`] = `
|
||||
"contextWindowTokens": 4096,
|
||||
"displayName": "GPT-3.5 Turbo Instruct",
|
||||
"enabled": false,
|
||||
"functionCall": true,
|
||||
"functionCall": false,
|
||||
"id": "gpt-3.5-turbo-instruct",
|
||||
"reasoning": false,
|
||||
"vision": false,
|
||||
@@ -132,7 +132,7 @@ exports[`LobeOpenAI > models > should get models 1`] = `
|
||||
"contextWindowTokens": undefined,
|
||||
"displayName": undefined,
|
||||
"enabled": false,
|
||||
"functionCall": true,
|
||||
"functionCall": false,
|
||||
"id": "gpt-3.5-turbo-0301",
|
||||
"reasoning": false,
|
||||
"vision": false,
|
||||
@@ -141,7 +141,7 @@ exports[`LobeOpenAI > models > should get models 1`] = `
|
||||
"contextWindowTokens": undefined,
|
||||
"displayName": undefined,
|
||||
"enabled": false,
|
||||
"functionCall": true,
|
||||
"functionCall": false,
|
||||
"id": "gpt-3.5-turbo-0613",
|
||||
"reasoning": false,
|
||||
"vision": false,
|
||||
@@ -204,7 +204,7 @@ exports[`LobeOpenAI > models > should get models 1`] = `
|
||||
"contextWindowTokens": 128000,
|
||||
"displayName": "GPT 4 Turbo with Vision Preview",
|
||||
"enabled": false,
|
||||
"functionCall": true,
|
||||
"functionCall": false,
|
||||
"id": "gpt-4-vision-preview",
|
||||
"reasoning": false,
|
||||
"vision": true,
|
||||
|
||||
@@ -8,13 +8,15 @@ export interface OpenAIModelCard {
|
||||
id: string;
|
||||
}
|
||||
|
||||
const prunePrefixes = ['o1', 'o3', 'o4'];
|
||||
|
||||
export const LobeOpenAI = LobeOpenAICompatibleFactory({
|
||||
baseURL: 'https://api.openai.com/v1',
|
||||
chatCompletion: {
|
||||
handlePayload: (payload) => {
|
||||
const { model } = payload;
|
||||
|
||||
if (model.startsWith('o1') || model.startsWith('o3')) {
|
||||
if (prunePrefixes.some(prefix => model.startsWith(prefix))) {
|
||||
return pruneReasoningPayload(payload) as any;
|
||||
}
|
||||
|
||||
@@ -38,11 +40,11 @@ export const LobeOpenAI = LobeOpenAICompatibleFactory({
|
||||
models: async ({ client }) => {
|
||||
const { LOBE_DEFAULT_MODEL_LIST } = await import('@/config/aiModels');
|
||||
|
||||
const functionCallKeywords = ['gpt-4', 'gpt-3.5', 'o3-mini'];
|
||||
const functionCallKeywords = ['4o', '4.1', 'o3', 'o4'];
|
||||
|
||||
const visionKeywords = ['gpt-4o', 'vision'];
|
||||
const visionKeywords = ['4o', '4.1', 'o4'];
|
||||
|
||||
const reasoningKeywords = ['o1', 'o3'];
|
||||
const reasoningKeywords = ['o1', 'o3', 'o4'];
|
||||
|
||||
const modelsPage = (await client.models.list()) as any;
|
||||
const modelList: OpenAIModelCard[] = modelsPage.data;
|
||||
|
||||
Reference in New Issue
Block a user