NVIDIA Morpheus (25.02.01)

morpheus_llm.llm.nodes.prompt_template_node.PromptTemplateNode

class PromptTemplateNode(template, template_format='f-string')[source]

Bases: morpheus_llm._lib.llm.LLMNodeBase

Populates a template string with the values from the upstream node.

Parameters
templatestr

The template string to populate.

template_formatstr, optional default=”f-string”

The format of the template string. Must be one of: f-string, jinja.

Methods

execute(self, context) Execute the current node with the given context instance.
get_input_names(self) Get the input names for the node.

async execute(self: morpheus_llm._lib.llm.LLMNodeBase, context: morpheus_llm._lib.llm.LLMContext)Awaitable[morpheus_llm._lib.llm.LLMContext][source]

Execute the current node with the given context instance.

All inputs for the given node should be fetched from the context, typically by calling either context.get_inputs to fetch all inputs as a dict, or context.get_input to fetch a specific input.

Similarly the output of the node is written to the context using context.set_output.

Parameters
contextmorpheus._lib.llm.LLMContext

Context instance to use for the execution

get_input_names(self: morpheus_llm._lib.llm.LLMNodeBase) → List[str][source]

Get the input names for the node.

Returns
list[str]

The input names for the node

Previous morpheus_llm.llm.nodes.prompt_template_node
Next morpheus_llm.llm.nodes.rag_node
© Copyright 2024, NVIDIA. Last updated on Mar 3, 2025.