🐛 fix: Update Responses search tool to web_search (#9354)

*  feat: 更新搜索工具为 web_search

* Update index.test.ts
This commit is contained in:
sxjeru
2025-09-21 19:27:39 +08:00
committed by GitHub
parent b5389e44a2
commit 58d34ff53f
2 changed files with 3 additions and 3 deletions
@@ -249,7 +249,7 @@ describe('LobeOpenAI', () => {
});
describe('responses.handlePayload', () => {
it('should add web_search_preview tool when enabledSearch is true', async () => {
it('should add web_search tool when enabledSearch is true', async () => {
const payload = {
messages: [{ content: 'Hello', role: 'user' as const }],
model: 'gpt-4o', // 使用常规模型,通过 enabledSearch 触发 responses API
@@ -263,7 +263,7 @@ describe('LobeOpenAI', () => {
const createCall = (instance['client'].responses.create as Mock).mock.calls[0][0];
expect(createCall.tools).toEqual([
{ type: 'function', name: 'test', description: 'test' },
{ type: 'web_search_preview' },
{ type: 'web_search' },
]);
});
@@ -82,7 +82,7 @@ export const LobeOpenAI = createOpenAICompatibleRuntime({
? [
...(tools || []),
{
type: 'web_search_preview',
type: 'web_search',
...(oaiSearchContextSize && {
search_context_size: oaiSearchContextSize,
}),