API Reference
promptpack
Section titled “promptpack”Functions
Section titled “Functions”parse_promptpack(path: str | Path) -> PromptPack
Section titled “parse_promptpack(path: str | Path) -> PromptPack”Parse a PromptPack from a file path.
Arguments:
path- Path to the PromptPack JSON file
Returns: PromptPack instance
Raises: PromptPackError on parse failure
parse_promptpack_from_dict(data: dict) -> PromptPack
Section titled “parse_promptpack_from_dict(data: dict) -> PromptPack”Parse a PromptPack from a dictionary.
Arguments:
data- Dictionary containing PromptPack data
Returns: PromptPack instance
Classes
Section titled “Classes”PromptPack
Section titled “PromptPack”Main class representing a parsed PromptPack.
Attributes:
name: str- Pack nameversion: str- Pack versionprompts: dict[str, Prompt]- Dictionary of promptstools: list[Tool]- List of tool definitionsfragments: dict[str, str]- Reusable fragments
Prompt
Section titled “Prompt”Represents a prompt definition.
Attributes:
system_template: str | None- System message templateuser_template: str | None- User message templatevariables: dict[str, Variable]- Variable definitions
Methods:
render(variables: dict) -> str- Render template with variables
Variable
Section titled “Variable”Represents a template variable.
Attributes:
type: str- Variable type (string, number, boolean, etc.)description: str | None- Variable descriptiondefault: Any- Default valuerequired: bool- Whether variable is required
Represents a tool definition.
Attributes:
name: str- Tool namedescription: str- Tool descriptionparameters: dict- JSON Schema for parameters
promptpack-langchain
Section titled “promptpack-langchain”Functions
Section titled “Functions”convert_tools(pack: PromptPack) -> list[Tool]
Section titled “convert_tools(pack: PromptPack) -> list[Tool]”Convert PromptPack tools to LangChain tool definitions.
Arguments:
pack- PromptPack instance
Returns: List of LangChain tool definitions
Classes
Section titled “Classes”PromptPackTemplate
Section titled “PromptPackTemplate”LangChain prompt template wrapper for PromptPacks.
Class Methods:
from_promptpack(pack: PromptPack, prompt_name: str) -> PromptPackTemplate
Attributes:
chat_template: ChatPromptTemplate- Underlying LangChain templateinput_variables: list[str]- List of input variable names
Methods:
format_messages(**kwargs) -> list[BaseMessage]- Format messages with variables
Validators
Section titled “Validators”validate_variables(variables: dict[str, Variable], inputs: dict) -> list[str]
Section titled “validate_variables(variables: dict[str, Variable], inputs: dict) -> list[str]”Validate input variables against definitions.
Arguments:
variables- Variable definitions from PromptPackinputs- Input values to validate
Returns: List of validation error messages (empty if valid)
Multimodal
Section titled “Multimodal”process_multimodal_content(content: dict) -> Any
Section titled “process_multimodal_content(content: dict) -> Any”Process multimodal content for LangChain compatibility.
Arguments:
content- Content dictionary with type information
Returns: Processed content suitable for LangChain