{{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).
guidance.library.strip(string)
Strip whitespace from the beginning and end of the given string.
guidance.library.subtract(minuend,subtrahend)
Subtract the second variable from the first.
guidance.library.system([hidden,…])
A chat role block for the ‘system’ role.
guidance.library.unless(value[,_parser_context])
[blank in the documentation]
guidance.library.user([hidden,_parser_context])
A chat role block for the ‘user’ role.
guidance.llms.OpenAI([model,caching,…])
[blank in the documentation]
guidance.llms.Transformers([model,…])
A HuggingFace transformers language model with Guidance support.
guidance.llms.transformers.LLaMA([model,…])
A HuggingFace transformers version of the LLaMA language model with Guidance support.
guidance.llms.transformers.MPT([model,…])
A HuggingFace transformers version of the MosaicML MPT language model with Guidance support.
guidance.llms.transformers.Vicuna([model,…])
A HuggingFace transformers version of the Vicuna language model with Guidance support.
guidance.llms.transformers.Koala([model,…])
A HuggingFace transformers version of the Koala language model with Guidance support.