leondz / garak

LLM vulnerability scanner
https://discord.gg/uVch4puUCs
Apache License 2.0
1.32k stars 151 forks source link

fix initialization bug for kwargs in function #826

Closed soumilinandi closed 1 month ago

soumilinandi commented 1 month ago

Generator.function does not define self.kwargs when we don't pass that argument progamatically in functions.Single.

To reproduce this error, invoke garak's cli like below

from garak.cli import main as garak_main
from typing import List

def generate_text(
) -> List[str]:
    return "empty str"

def main():
    args = [
        "-m",
        "function.Single",
        "-n",
        f"{__name__}#generate_text",
        "-p",
        "test.Blank"
    ]
    garak_main(args)

if __name__ == "__main__":
    main()

Offered fix resolves this issue.

I have read the DCO Document and I hereby sign the DCO

github-actions[bot] commented 1 month ago

DCO Assistant Lite bot:
Thank you for your submission, we really appreciate it. Like many open-source projects, we ask that you sign our Developer Certificate of Origin before we can accept your contribution. You can sign the DCO by just posting a Pull Request Comment same as the below format.


I have read the DCO Document and I hereby sign the DCO


Soumili Nandi seems not to be a GitHub user. You need a GitHub account to be able to sign the DCO. If you have already a GitHub account, please add the email address used for this commit to your account.
You can retrigger this bot by commenting recheck in this Pull Request