Skip to content

Commit

Permalink
docs: simplify example
Browse files Browse the repository at this point in the history
  • Loading branch information
developer239 committed Sep 26, 2024
1 parent f186d81 commit 9c5a0fb
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions example/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,22 +22,21 @@ async function main() {
for (const question of questions) {
const tokenStream = llama.prompt(question);

process.stdout.write("Question: ");
process.stdout.write(question);
process.stdout.write("\n");
console.log("Question: ");
console.log(question);
console.log("");

process.stdout.write("Answer: ");

let streamingResponse = "";
console.log("Answer: ");

while (true) {
const token = await tokenStream.read();
if (token === null) break;
if (token === null) {
break;
}
process.stdout.write(token);
streamingResponse += token;
}

process.stdout.write("\n");
console.log("");
}
}

Expand Down

0 comments on commit 9c5a0fb

Please sign in to comment.