guidance-ai / guidance

A guidance language for controlling large language models.
MIT License
18.26k stars 1.01k forks source link

Feature for forbidden sentences #670

Open JunhaoWang opened 4 months ago

JunhaoWang commented 4 months ago

Is there a way to forbid generation of a set of sentences?

hudson-ai commented 4 months ago

Can you give a concrete example?

E.g. is it okay if the model generates a substring of one of your sentences? Can one of the sentences be a substring of what's generated? Etc.

JunhaoWang commented 3 months ago

Thanks @hudson-ai so I want to enforce such that the model cannot generate strings that contain a set of sentences specified, and use case is openai api

JunhaoWang commented 3 months ago

a concrete example:

forbidden_sents = ["hello world", "bye world"]
ok_result = "saturday morning"
bad_result = "I love asdasd hello world"
hudson-ai commented 3 months ago

What about

result = "hello worl"

Is that an acceptable response?