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';
2525import { isProductionEnvironment } from '@/lib/constants' ;
2626import { NextResponse } from 'next/server' ;
2727import { myProvider } from '@/lib/ai/providers' ;
28+ import { openai } from '@ai-sdk/openai' ;
2829
2930export const maxDuration = 60 ;
3031
@@ -85,6 +86,7 @@ export async function POST(request: Request) {
8586 'createDocument' ,
8687 'updateDocument' ,
8788 'requestSuggestions' ,
89+ 'web_search_preview'
8890 ] ,
8991 experimental_transform : smoothStream ( { chunking : 'word' } ) ,
9092 experimental_generateMessageId : generateUUID ,
@@ -96,6 +98,9 @@ export async function POST(request: Request) {
9698 session,
9799 dataStream,
98100 } ) ,
101+ web_search_preview : openai . tools . webSearchPreview ( {
102+ searchContextSize : 'medium'
103+ } )
99104 } ,
100105 onFinish : async ( { response, reasoning } ) => {
101106 if ( session . user ?. id ) {
@@ -134,7 +139,7 @@ export async function POST(request: Request) {
134139 } ) ;
135140 } ,
136141 onError : ( ) => {
137- return 'Oops, an error occured !' ;
142+ return 'Oops, an error occurred !' ;
138143 } ,
139144 } ) ;
140145 } catch ( error ) {
You can’t perform that action at this time.
0 commit comments