Skip to content

Commit

Permalink
Fix an undefined assignment when using grammar
Browse files Browse the repository at this point in the history
  • Loading branch information
Thomas101 committed Nov 13, 2024
1 parent 6321768 commit c77a8c8
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/native/main/APIHandler/LlmSessionAPIHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -248,14 +248,16 @@ class LlmSessionAPIHandler {
contextSequence: context.getSequence()
})

let grammar: LlamaGrammar | undefined
if (chatOptions.grammar !== undefined) {
this.#activeSession.chat.grammar = await this.#activeSession.llama.createGrammarForJsonSchema(chatOptions.grammar)
grammar = await this.#activeSession.llama.createGrammarForJsonSchema(chatOptions.grammar)
}

this.#activeSession.chat = {
options: chatOptions,
context,
session
session,
grammar
}
}
}
Expand Down

0 comments on commit c77a8c8

Please sign in to comment.