File tree Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Original file line number Diff line number Diff line change @@ -25,6 +25,7 @@ import { getWeather } from '@/lib/ai/tools/get-weather';
25
25
import { isProductionEnvironment } from '@/lib/constants' ;
26
26
import { NextResponse } from 'next/server' ;
27
27
import { myProvider } from '@/lib/ai/providers' ;
28
+ import { openai } from '@ai-sdk/openai' ;
28
29
29
30
export const maxDuration = 60 ;
30
31
@@ -85,6 +86,7 @@ export async function POST(request: Request) {
85
86
'createDocument' ,
86
87
'updateDocument' ,
87
88
'requestSuggestions' ,
89
+ 'web_search_preview'
88
90
] ,
89
91
experimental_transform : smoothStream ( { chunking : 'word' } ) ,
90
92
experimental_generateMessageId : generateUUID ,
@@ -96,6 +98,9 @@ export async function POST(request: Request) {
96
98
session,
97
99
dataStream,
98
100
} ) ,
101
+ web_search_preview : openai . tools . webSearchPreview ( {
102
+ searchContextSize : 'medium'
103
+ } )
99
104
} ,
100
105
onFinish : async ( { response, reasoning } ) => {
101
106
if ( session . user ?. id ) {
@@ -134,7 +139,7 @@ export async function POST(request: Request) {
134
139
} ) ;
135
140
} ,
136
141
onError : ( ) => {
137
- return 'Oops, an error occured !' ;
142
+ return 'Oops, an error occurred !' ;
138
143
} ,
139
144
} ) ;
140
145
} catch ( error ) {
You can’t perform that action at this time.
0 commit comments