Skip to content

Commit 70b0786

Browse files
committed
chore: bump ai v4
1 parent f17449b commit 70b0786

File tree

4 files changed

+6
-6
lines changed

4 files changed

+6
-6
lines changed

templates/types/streaming/express/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
"lint": "eslint ."
1717
},
1818
"dependencies": {
19-
"ai": "3.3.42",
19+
"ai": "4.0.3",
2020
"cors": "^2.8.5",
2121
"dotenv": "^16.3.1",
2222
"duck-duck-scrape": "^2.2.5",

templates/types/streaming/express/src/controllers/chat.controller.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ export const chat = async (req: Request, res: Response) => {
4343
});
4444
});
4545

46-
const onFinal = (content: string) => {
46+
const onCompletion = (content: string) => {
4747
chatHistory.push({ role: "assistant", content: content });
4848
generateNextQuestions(chatHistory)
4949
.then((questions: string[]) => {
@@ -59,7 +59,7 @@ export const chat = async (req: Request, res: Response) => {
5959
});
6060
};
6161

62-
const stream = LlamaIndexAdapter.toDataStream(response, { onFinal });
62+
const stream = LlamaIndexAdapter.toDataStream(response, { onCompletion });
6363
return streamToResponse(stream, res, {}, vercelStreamData);
6464
} catch (error) {
6565
console.error("[LlamaIndex]", error);

templates/types/streaming/nextjs/app/api/chat/route.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ export async function POST(request: NextRequest) {
5656
});
5757
});
5858

59-
const onFinal = (content: string) => {
59+
const onCompletion = (content: string) => {
6060
chatHistory.push({ role: "assistant", content: content });
6161
generateNextQuestions(chatHistory)
6262
.then((questions: string[]) => {
@@ -74,7 +74,7 @@ export async function POST(request: NextRequest) {
7474

7575
return LlamaIndexAdapter.toDataStreamResponse(response, {
7676
data: vercelStreamData,
77-
callbacks: { onFinal },
77+
callbacks: { onCompletion },
7878
});
7979
} catch (error) {
8080
console.error("[LlamaIndex]", error);

templates/types/streaming/nextjs/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
"@radix-ui/react-slot": "^1.0.2",
1818
"@radix-ui/react-tabs": "^1.1.0",
1919
"@llamaindex/chat-ui": "0.0.9",
20-
"ai": "3.4.33",
20+
"ai": "4.0.3",
2121
"ajv": "^8.12.0",
2222
"class-variance-authority": "^0.7.0",
2323
"clsx": "^2.1.1",

0 commit comments

Comments
 (0)