Skip to content

Commit

Permalink
fix(node template): bug (#342)
Browse files Browse the repository at this point in the history
  • Loading branch information
giladgd authored Sep 24, 2024
1 parent 106b171 commit 1291b97
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions templates/node-typescript/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@ console.log();
const q3 = "What are the verbs in this sentence: 'The cat sat on the mat'";
console.log(chalk.yellow("User: ") + q3);

// force the model to respond in accordance to the specified JSON schema format, so we can parse it and use it programmatically
// force the model to respond in accordance to the specified JSON schema format,
// so we can parse it and use it programmatically
const responseGrammar = await llama.createGrammarForJsonSchema({
type: "object",
properties: {
Expand All @@ -61,7 +62,7 @@ const responseGrammar = await llama.createGrammarForJsonSchema({
}
}
});
const a3 = await session.prompt(q2, {grammar: responseGrammar});
const a3 = await session.prompt(q3, {grammar: responseGrammar});
const parsedResponse = responseGrammar.parse(a3);
console.log(chalk.yellow("AI:"), parsedResponse.verbs);
console.log();
Expand Down

0 comments on commit 1291b97

Please sign in to comment.