Skip to content

Commit 013bce9

Browse files
bugfix of runtime error in the filesCreatePdf function in samples (#418)
* bugfix of runtime error in the filesCreatePdf function in samples * bugfix camel case issue for filesCreatePDF function causing errors in check_samples.js and insert-import-comments.js
1 parent 27ffede commit 013bce9

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

samples/files.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ async function filesCreateVideo() {
210210
// [END files_create_video]
211211
}
212212

213-
async function filesCreatePDF() {
213+
async function filesCreatePdf() {
214214
// [START files_create_pdf]
215215
// Make sure to include these imports:
216216
// import { GoogleGenerativeAI } from "@google/generative-ai";
@@ -241,13 +241,13 @@ async function filesCreatePDF() {
241241
);
242242

243243
// Polling getFile to check processing complete
244-
let file = await fileManager.getFile(uploadResult.file.name);
244+
let file = await fileManager.getFile(uploadResponse.file.name);
245245
while (file.state === FileState.PROCESSING) {
246246
process.stdout.write(".");
247247
// Sleep for 10 seconds
248248
await new Promise((resolve) => setTimeout(resolve, 10_000));
249249
// Fetch the file from the API again
250-
file = await fileManager.getFile(uploadResult.file.name);
250+
file = await fileManager.getFile(uploadResponse.file.name);
251251
}
252252
if (file.state === FileState.FAILED) {
253253
throw new Error("Audio processing failed.");
@@ -334,7 +334,7 @@ async function runAll() {
334334
await filesCreateAudio();
335335
await filesCreateText();
336336
await filesCreateVideo();
337-
await filesCreatePDF();
337+
await filesCreatePdf();
338338
await filesList();
339339
await filesGet();
340340
await filesDelete();

0 commit comments

Comments
 (0)