@@ -148,7 +148,10 @@ public protocol Tokenizer {
148
148
func applyChatTemplate( messages: [ Message ] ) throws -> [ Int ]
149
149
150
150
/// The appropriate chat template is selected from the tokenizer config
151
- func applyChatTemplate( messages: [ Message ] , tools: [ ToolSpec ] ) throws -> [ Int ]
151
+ func applyChatTemplate( messages: [ Message ] , tools: [ ToolSpec ] ? ) throws -> [ Int ]
152
+
153
+ /// The appropriate chat template is selected from the tokenizer config
154
+ func applyChatTemplate( messages: [ Message ] , tools: [ ToolSpec ] ? , additionalContext: [ String : Any ] ? ) throws -> [ Int ]
152
155
153
156
/// The chat template is provided as a string literal or specified by name
154
157
func applyChatTemplate( messages: [ Message ] , chatTemplate: ChatTemplateArgument ) throws -> [ Int ]
@@ -400,11 +403,11 @@ public class PreTrainedTokenizer: Tokenizer {
400
403
try applyChatTemplate ( messages: messages, addGenerationPrompt: true )
401
404
}
402
405
403
- public func applyChatTemplate( messages: [ Message ] , tools: [ ToolSpec ] ) throws -> [ Int ] {
406
+ public func applyChatTemplate( messages: [ Message ] , tools: [ ToolSpec ] ? = nil ) throws -> [ Int ] {
404
407
try applyChatTemplate ( messages: messages, addGenerationPrompt: true , tools: tools)
405
408
}
406
409
407
- public func applyChatTemplate( messages: [ Message ] , tools: [ ToolSpec ] , additionalContext: [ String : Any ] ) throws
410
+ public func applyChatTemplate( messages: [ Message ] , tools: [ ToolSpec ] ? = nil , additionalContext: [ String : Any ] ? = nil ) throws
408
411
-> [ Int ]
409
412
{
410
413
try applyChatTemplate (
0 commit comments