Allow either "[" or "{" prefix to support JSON grammar with top level arrays (#129)
This commit is contained in:
parent
e889fa3efe
commit
dbdcb38ad7
1 changed files with 4 additions and 1 deletions
|
|
@ -79,8 +79,11 @@ class ExLlamaV2Grammar:
|
|||
|
||||
return
|
||||
|
||||
# Allow JSON objects or JSON arrays at the top level
|
||||
json_prefixes = ["[", "{"]
|
||||
|
||||
lmfilter = ExLlamaV2TokenEnforcerFilter(schema_parser, tokenizer)
|
||||
prefix_filter = ExLlamaV2PrefixFilter(model, tokenizer, "{")
|
||||
prefix_filter = ExLlamaV2PrefixFilter(model, tokenizer, json_prefixes)
|
||||
|
||||
# Append the filters
|
||||
self.filters.extend([lmfilter, prefix_filter])
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue