guider
A module to guide the output of an LLM using conditions and constraints
Guider
Guider (llm, **kwargs)
*Guider Constructor. Note that the callback
andcallback_manager
parameters to onprem.LLM
are not currently utilized by the Guider
.
Args:
- llm: An
onprem.LLM
object*
Guider.prompt
Guider.prompt (guidance_program:str, echo=True)
*A guided prompt. Input is a Guidance program (guidance>=0.1.0
) that specifies constraints and conditions on the output for the prompt.
Args:
- guidance_program: A Guidance program (
>=0.1.0
) in the form a string or aguidance._grammar.Join
object - echo: If True, echo highlighted output in Jupyter notebook. Set
echo=False
if running stand-alone script.
Returns:
- A dictionary with keys specified in the Guidance program and values containing the model outputs*