File tree Expand file tree Collapse file tree 1 file changed +4
-7
lines changed Expand file tree Collapse file tree 1 file changed +4
-7
lines changed Original file line number Diff line number Diff line change @@ -44,11 +44,7 @@ const modelConfig = z.object({
44
44
datasetUrl : z . string ( ) . url ( ) . optional ( ) ,
45
45
preprompt : z . string ( ) . default ( "" ) ,
46
46
prepromptUrl : z . string ( ) . url ( ) . optional ( ) ,
47
- chatPromptTemplate : z
48
- . string ( )
49
- . default (
50
- "{{#if @root.preprompt}}<|im_start|>system\n{{@root.preprompt}}<|im_end|>\n{{/if}}{{#each messages}}{{#ifUser}}<|im_start|>user\n{{content}}<|im_end|>\n<|im_start|>assistant\n{{/ifUser}}{{#ifAssistant}}{{content}}<|im_end|>\n{{/ifAssistant}}{{/each}}"
51
- ) , // ChatML
47
+ chatPromptTemplate : z . string ( ) . optional ( ) ,
52
48
promptExamples : z
53
49
. array (
54
50
z . object ( {
@@ -86,8 +82,9 @@ async function getChatPromptRender(
86
82
let tokenizer : PreTrainedTokenizer ;
87
83
88
84
if ( ! m . tokenizer ) {
89
- throw new Error (
90
- "No tokenizer specified and no chat prompt template specified for model " + m . name
85
+ return compileTemplate < ChatTemplateInput > (
86
+ "{{#if @root.preprompt}}<|im_start|>system\n{{@root.preprompt}}<|im_end|>\n{{/if}}{{#each messages}}{{#ifUser}}<|im_start|>user\n{{content}}<|im_end|>\n<|im_start|>assistant\n{{/ifUser}}{{#ifAssistant}}{{content}}<|im_end|>\n{{/ifAssistant}}{{/each}}" ,
87
+ m
91
88
) ;
92
89
}
93
90
You can’t perform that action at this time.
0 commit comments