morpheus_llm.llm.nodes.langchain_agent_node.LangChainAgentNode#

class LangChainAgentNode(
agent_executor,
replace_exceptions=False,
replace_exceptions_value=None,
)[source]#

Bases: LLMNodeBase

Executes a LangChain agent in an LLMEngine

Parameters:
agent_executorAgentExecutor

The agent executor to use to execute.

replace_exceptionsbool, optional

When True, replaces exceptions with replace_exceptions_value from the output.

replace_exceptions_valuestr, optional

The value to replace exceptions with when replace_exceptions is True, ignored otherwise.

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