Skip to content

An AI-powered search engine with a generative UI

changed deprecated imports(experimental_generateObject and experimental_streamText)

Dhrish Parekh8a7361ad3f94
diff --git a/bun.lockb b/bun.lockb
index 719e888d..6bfc8468 100755
Binary files a/bun.lockb and b/bun.lockb differ
diff --git a/lib/actions/chat.ts b/lib/actions/chat.ts
index ecfe2d9c..d0cce474 100644
--- a/lib/actions/chat.ts
+++ b/lib/actions/chat.ts
@@ -71,4 +71,4 @@ export async function saveChat(chat: Chat, userId: string = 'anonymous') {
member: `chat:${chat.id}`
})
await pipeline.exec()
-}
+}
\ No newline at end of file
diff --git a/lib/agents/researcher.tsx b/lib/agents/researcher.tsx
index c42edf60..fc18adb1 100644
--- a/lib/agents/researcher.tsx
+++ b/lib/agents/researcher.tsx
@@ -3,7 +3,7 @@ import {
CoreMessage,
ToolCallPart,
ToolResultPart,
- experimental_streamText
+ streamText as nonexperimental_streamText
} from 'ai'
import { searchSchema } from '@/lib/schema/search'
import { Section } from '@/components/section'
@@ -36,7 +36,7 @@ export async function researcher(
)
let isFirstToolResponse = true
- const result = await experimental_streamText({
+ const result = await nonexperimental_streamText({
model: openai.chat(process.env.OPENAI_API_MODEL || 'gpt-4-turbo'),
maxTokens: 2500,
system: `As a professional search expert, you possess the ability to search for any information on the web.
diff --git a/lib/agents/task-manager.tsx b/lib/agents/task-manager.tsx
index 4d8c4c6f..ad434e84 100644
--- a/lib/agents/task-manager.tsx
+++ b/lib/agents/task-manager.tsx
@@ -1,4 +1,4 @@
-import { CoreMessage, experimental_generateObject } from 'ai'
+import { CoreMessage, generateObject } from 'ai'
import { OpenAI } from '@ai-sdk/openai'
import { nextActionSchema } from '../schema/next-action'
@@ -11,7 +11,7 @@ export async function taskManager(messages: CoreMessage[]) {
})
try {
- const result = await experimental_generateObject({
+ const result = await generateObject({
model: openai.chat(process.env.OPENAI_API_MODEL || 'gpt-4-turbo'),
system: `As a professional web researcher, your primary objective is to fully comprehend the user's query, conduct thorough web searches to gather the necessary information, and provide an appropriate response.
To achieve this, you must first analyze the user's input and determine the optimal course of action. You have two options at your disposal:
diff --git a/lib/agents/writer.tsx b/lib/agents/writer.tsx
index e56ef757..095b3ed1 100644
--- a/lib/agents/writer.tsx
+++ b/lib/agents/writer.tsx
@@ -1,6 +1,6 @@
import { OpenAI } from '@ai-sdk/openai'
import { createStreamableUI, createStreamableValue } from 'ai/rsc'
-import { CoreMessage, experimental_streamText } from 'ai'
+import { CoreMessage, streamText as nonexperimental_streamText } from 'ai'
import { Section } from '@/components/section'
import { BotMessage } from '@/components/message'
import { createAnthropic } from '@ai-sdk/anthropic'
@@ -30,7 +30,7 @@ export async function writer(
)
uiStream.append(answerSection)
- await experimental_streamText({
+ await nonexperimental_streamText({
model:
process.env.SPECIFIC_PROVIDER === 'anthropic'
? anthropic!(