Files
dify/api/dify_graph/template_rendering.py
-LAN- 7b98463916 chore: save changes
Signed-off-by: -LAN- <laipz8200@outlook.com>
2026-03-20 23:18:40 +08:00

19 lines
530 B
Python

from __future__ import annotations
from abc import ABC, abstractmethod
from collections.abc import Mapping
from typing import Any
class TemplateRenderError(ValueError):
"""Raised when rendering a template fails."""
class Jinja2TemplateRenderer(ABC):
"""Nominal renderer contract for Jinja2 template rendering in graph nodes."""
@abstractmethod
def render_template(self, template: str, variables: Mapping[str, Any]) -> str:
"""Render the template into plain text."""
raise NotImplementedError