Template Engine#

Template Engine Processor is a processor that renders templates using a given context. It plays a crucial role in generating dynamic content by combining a template with data provided as input.

Supported Input Port:

json: The Template Engine Processor accepts input through the “json” port. The input should be a JSON object representing the context or data that will be used to render the template.

Supported Output Port:

text: The processor produces output through the “text” port. The output is the rendered text generated by applying the input context to the specified template.

List of Implementations:#

Jinja Implementation#

The Jinja implementation of the Template Engine Processor utilizes the Jinja templating engine to render templates.

Metadata#

Field

Type

Description

template

string (optional)

The template string that will be rendered using the provided context. This field is required and supports long-form content.

JSX Implementation#

The JSX implementation of the Template Engine Processor uses JSX (JavaScript XML) syntax to define and render templates.

Metadata

Field

Type

Description

template

string (optional)

The template string that will be rendered using the provided context. This field is required and supports long-form content.

template

string (required)

The JSX template string that will be rendered using the provided context. This field is required and supports long-form content.

mime_type

string (optional)

The MIME type of the rendered output. The default value is “text”.

NOTE: Both implementations of the Template Engine Processor allow for dynamic generation of content by combining a template with the provided context. The Jinja implementation uses the Jinja templating language, while the JSX implementation uses JSX syntax. The choice of implementation depends on the specific requirements and preferences of the user.

Sample processor configuration:#

NOTE: Processor is always added to a module(Input or Output). The module is then added to the pipeline.

 {
    "processor_type": "template_engine",
    "processor_implementation_type": "llm_engine_with_jsx",
    "input_port": "json",
    "output_port": "text",
    "metadata": {},
}