Skip to content

Commit ea52ae8

Browse files
authored
add separators and sort_keys plus import fix
1 parent 102e3d3 commit ea52ae8

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

llama_cpp/llama_chat_format.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
)
2525

2626
import jinja2
27+
import jinja2.ext as jinja2_ext
2728
from jinja2.sandbox import ImmutableSandboxedEnvironment
2829

2930
import numpy as np
@@ -211,9 +212,9 @@ def __init__(
211212
environment = ImmutableSandboxedEnvironment(
212213
trim_blocks=True,
213214
lstrip_blocks=True,
214-
extensions=[jinja2.ext.loopcontrols],
215+
extensions=[jinja2_ext.loopcontrols],
215216
)
216-
environment.filters["tojson"] = lambda x, indent=None: json.dumps(x, indent=indent, ensure_ascii=False)
217+
environment.filters["tojson"] = lambda x, indent=None, separators=None, sort_keys=False: json.dumps(x, indent=indent, separators=separators, sort_keys=sort_keys, ensure_ascii=False)
217218
environment.globals["strftime_now"] = lambda format: datetime.now().strftime(format)
218219
self._environment = environment.from_string(self.template)
219220

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy