# Helpers for LLM Interactions Class for representing a prompt entry. ## BasePrompt ```python class BasePrompt() ``` Base class for representing an LLM prompt. #### \_\_init\_\_ ```python def __init__(source: str, output_schema: Optional[str] = None, *, xml_output_schema: Optional[str] = None) ``` Initialize and substitute constants in the prompt. #### substitute\_constants ```python def substitute_constants(text: str) -> str ``` Substitute constants in the prompt. #### get\_prompt\_variables ```python def get_prompt_variables() -> List[str] ``` #### format ```python def format(**kwargs) -> "BasePrompt" ``` #### escape ```python def escape() -> str ``` Escape single curly braces into double curly braces. The LLM prompt. ## Prompt ```python class Prompt(BasePrompt) ``` Prompt class. The prompt is passed to the LLM as primary instructions. #### format ```python def format(**kwargs) -> "Prompt" ``` Format the prompt using the given keyword arguments. Instructions to the LLM, to be passed in the prompt. ## Instructions ```python class Instructions(BasePrompt) ``` Instructions class. The instructions are passed to the LLM as secondary input. Different model may use these differently. For example, chat models may receive instructions in the system-prompt. #### format ```python def format(**kwargs) -> "Instructions" ``` Format the prompt using the given keyword arguments. ## PromptCallableBase ## LLMResponse ```python class LLMResponse(ILLMResponse) ``` Standard information collection from LLM responses to feed the validation loop. **Attributes**: - `output` _str_ - The output from the LLM. - `stream_output` _Optional[Iterator]_ - A stream of output from the LLM. Default None. - `async_stream_output` _Optional[AsyncIterator]_ - An async stream of output from the LLM. Default None. - `prompt_token_count` _Optional[int]_ - The number of tokens in the prompt. Default None. - `response_token_count` _Optional[int]_ - The number of tokens in the response. Default None.