{{Guidance-ai}} API Flashcards
{{Guidance}}
Guidance enables you to control modern language models more effectively and efficiently than traditional prompting or chaining. Guidance programs allow you to interleave generation, prompting, and logical control into a single continuous flow matching how the language model actually processes the text.
guidance.library.add(*args)
Add the given variables together.
guidance.library.assistant([hidden,…])
A chat role block for the ‘assistant’ role.
guidance.library.await_(name[,consume,…])
Awaits a variable by returning its value and then deleting it.
guidance.library.block([name,hidden,…])
Generic block-level element.
guidance.library.break_()
Breaks out of the current loop.
guidance.library.each(list[,hidden,…])
Iterate over a list and execute a block for each item.
guidance.library.equal(*args)
Check that all arguments are equal.
guidance.library.gen([name,stop,…])
Use the LLM to generate a completion.
guidance.library.geneach(list_name[,stop,…])
Generate a potentially variable length list of items using the LLM.
guidance.library.if_(value,*[,invert,…])
Standard if/else statement.
guidance.library.role(role_name[,hidden,…])
A chat role block.
guidance.library.select([variable_name,…])
Select a value from a list of choices.
guidance.library.set(name[,value,hidden,…])
Set the value of a variable or set of variables.
guidance.library.shell(command[,safe,…])
Execute a shell command on the local machine (with user confirmation by default).