Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: bump ai v4 #449

Merged
merged 15 commits into from
Nov 27, 2024
5 changes: 5 additions & 0 deletions .changeset/chilly-eels-retire.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"create-llama": patch
---

chore: bump ai v4
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ export class InterpreterTool implements BaseTool<InterpreterParameter> {
for (const filePath of input.sandboxFiles) {
const fileName = path.basename(filePath);
const localFilePath = path.join(this.uploadedFilesDir, fileName);
const content = fs.readFileSync(localFilePath);
const content = fs.readFileSync(localFilePath) as ArrayBuffer;
await this.codeInterpreter?.files.write(filePath, content);
}
} catch (error) {
Expand Down
2 changes: 1 addition & 1 deletion templates/types/streaming/express/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"lint": "eslint ."
},
"dependencies": {
"ai": "3.3.42",
"ai": "4.0.3",
"cors": "^2.8.5",
"dotenv": "^16.3.1",
"duck-duck-scrape": "^2.2.5",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export const chat = async (req: Request, res: Response) => {
});
});

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

const stream = LlamaIndexAdapter.toDataStream(response, { onFinal });
const stream = LlamaIndexAdapter.toDataStream(response, { onCompletion });
return streamToResponse(stream, res, {}, vercelStreamData);
} catch (error) {
console.error("[LlamaIndex]", error);
Expand Down
4 changes: 2 additions & 2 deletions templates/types/streaming/nextjs/app/api/chat/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ export async function POST(request: NextRequest) {
});
});

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

return LlamaIndexAdapter.toDataStreamResponse(response, {
data: vercelStreamData,
callbacks: { onFinal },
callbacks: { onCompletion },
});
} catch (error) {
console.error("[LlamaIndex]", error);
Expand Down
2 changes: 1 addition & 1 deletion templates/types/streaming/nextjs/app/api/sandbox/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ export async function POST(req: Request) {
artifact.files.forEach(async (sandboxFilePath) => {
const fileName = path.basename(sandboxFilePath);
const localFilePath = path.join("output", "uploaded", fileName);
const fileContent = await fs.readFile(localFilePath);
const fileContent = (await fs.readFile(localFilePath)) as ArrayBuffer;

await sbx.files.write(sandboxFilePath, fileContent);
console.log(`Copied file to ${sandboxFilePath} in ${sbx.sandboxID}`);
Expand Down
4 changes: 2 additions & 2 deletions templates/types/streaming/nextjs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
"@radix-ui/react-select": "^2.1.1",
"@radix-ui/react-slot": "^1.0.2",
"@radix-ui/react-tabs": "^1.1.0",
"@llamaindex/chat-ui": "0.0.9",
"ai": "3.4.33",
"@llamaindex/chat-ui": "0.0.11",
"ai": "4.0.3",
"ajv": "^8.12.0",
"class-variance-authority": "^0.7.0",
"clsx": "^2.1.1",
Expand Down
Loading