@@ -193,18 +193,7 @@ export type LLamaChatPromptOptions<Functions extends ChatSessionModelFunctions |
193193 /**
194194 * Custom stop triggers to stop the generation of the response when any of the provided triggers are found.
195195 */
196- customStopTriggers ?: ( LlamaText | string | ( string | Token ) [ ] ) [ ]
197- } & ( {
198- grammar ?: LlamaGrammar ,
199- functions ?: never ,
200- documentFunctionParams ?: never ,
201- maxParallelFunctionCalls ?: never ,
202- onFunctionCallParamsChunk ?: never
203- } | {
204- grammar ?: never ,
205- functions ?: Functions | ChatSessionModelFunctions ,
206- documentFunctionParams ?: boolean ,
207- maxParallelFunctionCalls ?: number ,
196+ customStopTriggers ?: ( LlamaText | string | ( string | Token ) [ ] ) [ ] ,
208197
209198 /**
210199 * Called as the model generates function calls with the generated parameters chunk for each function call.
@@ -221,6 +210,18 @@ export type LLamaChatPromptOptions<Functions extends ChatSessionModelFunctions |
221210 * Only relevant when using function calling (via passing the `functions` option).
222211 */
223212 onFunctionCallParamsChunk ?: ( chunk : LlamaChatResponseFunctionCallParamsChunk ) => void
213+ } & ( {
214+ grammar ?: LlamaGrammar ,
215+ functions ?: never ,
216+ documentFunctionParams ?: never ,
217+ maxParallelFunctionCalls ?: never ,
218+ onFunctionCallParamsChunk ?: never
219+ } | {
220+ grammar ?: never ,
221+ functions ?: Functions | ChatSessionModelFunctions ,
222+ documentFunctionParams ?: boolean ,
223+ maxParallelFunctionCalls ?: number ,
224+ onFunctionCallParamsChunk ?: ( chunk : LlamaChatResponseFunctionCallParamsChunk ) => void
224225} ) ;
225226
226227export type LLamaChatCompletePromptOptions = {
@@ -462,12 +463,13 @@ export class LlamaChatSession {
462463 const { responseText} = await this . promptWithMeta < Functions > ( prompt , {
463464 // this is a workaround to allow passing both `functions` and `grammar`
464465 functions : functions as undefined ,
466+ grammar : grammar as undefined ,
465467 documentFunctionParams : documentFunctionParams as undefined ,
466468 maxParallelFunctionCalls : maxParallelFunctionCalls as undefined ,
467469 onFunctionCallParamsChunk : onFunctionCallParamsChunk as undefined ,
468470
469471 onTextChunk, onToken, onResponseChunk, signal, stopOnAbortSignal, maxTokens,
470- temperature, minP, topK, topP, seed, grammar ,
472+ temperature, minP, topK, topP, seed,
471473 trimWhitespaceSuffix, responsePrefix, repeatPenalty, tokenBias, customStopTriggers
472474 } ) ;
473475
0 commit comments