Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐛 fix: fix enable_search parameter intro condition in Qwen #5297

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 16 additions & 1 deletion src/libs/agent-runtime/qwen/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,16 @@ import { LobeOpenAICompatibleFactory } from '../utils/openaiCompatibleFactory';

import { QwenAIStream } from '../utils/streams';

/*
QwenEnableSearchModelSeries: An array of Qwen model series that support the enable_search parameter.
Currently, enable_search is only supported on Qwen commercial series, excluding Qwen-VL and Qwen-Long series.
*/
export const QwenEnableSearchModelSeries = [
'qwen-max',
'qwen-plus',
'qwen-turbo',
];

/*
QwenLegacyModels: A set of legacy Qwen models that do not support presence_penalty.
Currently, presence_penalty is only supported on Qwen commercial models and open-source models starting from Qwen 1.5 and later.
Expand Down Expand Up @@ -36,9 +46,14 @@ export const LobeQwenAI = LobeOpenAICompatibleFactory({
...(model.startsWith('qwen-vl') ? {
top_p: (top_p !== undefined && top_p > 0 && top_p <= 1) ? top_p : undefined,
} : {
enable_search: true,
top_p: (top_p !== undefined && top_p > 0 && top_p < 1) ? top_p : undefined,
}),
...(process.env.QWEN_ENABLE_SEARCH === '1' && QwenEnableSearchModelSeries.some(prefix => model.startsWith(prefix)) && {
enable_search: true,
search_options: {
search_strategy: process.env.QWEN_SEARCH_STRATEGY || 'standard', // standard or pro
}
}),
} as any;
},
handleStream: QwenAIStream,
Expand Down
Loading