Prompts API
This module provides tools for templates.
Base Prompt Template
maticlib.prompts.base.BasePromptTemplate
Bases: BaseModel
A simple, Pydantic-backed prompt template with auto-detected input variables.
Attributes:
| Name | Type | Description |
|---|---|---|
template |
str
|
The string template with |
input_variables |
List[str]
|
List of expected variable names. Auto-detected from the template if not provided. |
Initializes the BasePromptTemplate.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
**data
|
Any
|
Pydantic field values. Accepts |
{}
|
Source code in maticlib/prompts/base.py
format
Renders the template by filling all named variables.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
**kwargs
|
Any
|
Keyword arguments matching the template's input_variables. |
{}
|
Returns:
| Type | Description |
|---|---|
str
|
The fully rendered prompt string. |
Raises:
| Type | Description |
|---|---|
TemplateRenderError
|
If a required variable is missing. |