Skip to content

Commit 09c18e9

Browse files
Added banned_strings parameter to the generator. (#756)
Co-authored-by: RaahimSiddiqi <[email protected]>
1 parent 1a80d38 commit 09c18e9

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

exllamav2/generator/dynamic.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -556,6 +556,7 @@ def generate(
556556
filter_prefer_eos: bool = False,
557557
return_last_results: bool = False,
558558
embeddings: list[ExLlamaV2MMEmbedding] | list[list[ExLlamaV2MMEmbedding]] | None = None,
559+
banned_strings: list | None = None,
559560
**kwargs
560561
):
561562
"""
@@ -617,6 +618,9 @@ def generate(
617618
:param embeddings:
618619
Optional list of ExLlamaV2MMEmbeddings to use for, or list of lists for batched generation
619620
621+
:param banned_strings:
622+
Optional list of strings to exclude from the output
623+
620624
:return:
621625
Completion(s): (str or list[str] depending on the type of the input prompt argument)
622626
Optionally, last results: (dict or list[dict] depending on the type of the input prompt argument)
@@ -685,7 +689,8 @@ def generate(
685689
filter_prefer_eos = filter_prefer_eos,
686690
token_healing = token_healing,
687691
decode_special_tokens = decode_special_tokens,
688-
embeddings = embeddings[idx] or []
692+
embeddings = embeddings[idx] or [],
693+
banned_strings = banned_strings
689694
)
690695

691696
if seed is not None: seed += 1

0 commit comments

Comments
 (0)