File tree Expand file tree Collapse file tree 1 file changed +13
-0
lines changed
Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Original file line number Diff line number Diff line change 55import json
66import ctypes
77import dataclasses
8+ import datetime
89import random
910import string
1011
6061LLAMA4_INSTRUCT_BOS_TOKEN = "<|begin_of_text|>"
6162LLAMA4_INSTRUCT_EOS_TOKEN = "<|eot|>"
6263
64+ # Source: https://huggingface.co/openai/gpt-oss-20b/blob/main/tokenizer_config.json
65+ GPT_OSS_BOS_TOKEN = "<|startoftext|>"
66+ GPT_OSS_EOS_TOKEN = "<|return|>"
67+ GPT_OSS_PAD_TOKEN = "<|endoftext|>"
68+
6369### Chat Completion Handler ###
6470
6571
@@ -240,11 +246,18 @@ def __call__(
240246 def raise_exception (message : str ):
241247 raise ValueError (message )
242248
249+ def strftime_now (format_string = "%Y-%m-%d %H:%M:%S" ):
250+ """
251+ Returns the current time formatted as a string.
252+ """
253+ return datetime .datetime .now ().strftime (format_string )
254+
243255 prompt = self ._environment .render (
244256 messages = messages ,
245257 eos_token = self .eos_token ,
246258 bos_token = self .bos_token ,
247259 raise_exception = raise_exception ,
260+ strftime_now = strftime_now ,
248261 add_generation_prompt = self .add_generation_prompt ,
249262 functions = functions ,
250263 function_call = function_call ,
You can’t perform that action at this time.
0 commit comments