Skip to content

Commit af63792

Browse files
committed
feat: Add gpt-oss chat format support through strftime_now in chat format by @iamlemec
1 parent 68e89e8 commit af63792

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

llama_cpp/llama_chat_format.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import random
99
import string
1010

11+
from datetime import datetime
1112
from contextlib import ExitStack
1213
from typing import (
1314
Any,
@@ -214,6 +215,10 @@ def __init__(
214215
lstrip_blocks=True,
215216
).from_string(self.template)
216217

218+
@staticmethod
219+
def strftime_now(f: str) -> str:
220+
return datetime.now().strftime(f)
221+
217222
def __call__(
218223
self,
219224
*,
@@ -237,6 +242,7 @@ def raise_exception(message: str):
237242
function_call=function_call,
238243
tools=tools,
239244
tool_choice=tool_choice,
245+
strftime_now=self.strftime_now,
240246
)
241247

242248
stopping_criteria = None

0 commit comments

Comments
 (0)