What can I help you with?
NVIDIA Morpheus (25.02.01)

morpheus_llm.llm.nodes.rag_node.RAGNode

class RAGNode(*, prompt, template_format='jinja', vdb_service, embedding=None, llm_client)[source]

Bases: morpheus_llm._lib.llm.LLMNode

Performs Retrieval Augmented Generation (RAG).

Parameters
promptstr

The prompt template string to populate with input values.

template_formatstr, optional default=”jinja”

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

vdb_serviceVectorDBResourceService

The VectorDB service to use for retrieval.

embeddingCallable[[list[str]], Coroutine[Any, Any, list[list[float]]]], optional

An asynchronous function to use to determine the embeddings to search the vdb_service for. If None, upstream nodes must provide the embeddings.

llm_clientLLMClient

The LLM client to use for generation.

Methods

add_node(self, name, *[, inputs, is_output]) Add an LLMNode to the current node.
execute(self, context) Execute the current node with the given context instance.
get_input_names(self) Get the input names for the node.

add_node(self: morpheus_llm._lib.llm.LLMNode, name: str, *, inputs: object = None, node: morpheus_llm._lib.llm.LLMNodeBase, is_output: bool = False)morpheus_llm._lib.llm.LLMNodeRunner

Add an LLMNode to the current node.

Parameters
namestr

The name of the node to add

inputslist[tuple[str, str]], optional

List of input mappings to use for the node, in the form of [(external_name, internal_name), ...] If unspecified the node’s input_names will be used.

nodeLLMNodeBase

The node to add

is_outputbool, optional

Indicates if the node is an output node, by default False

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

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]

Get the input names for the node.

Returns
list[str]

The input names for the node

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