The MasterHandler class is responsible for managing a collection of node handlers in the LangChain Expression Language. Each node handler is capable of handling a specific type of node in the expression language. The MasterHandler class uses these node handlers to process nodes in the expression language.

Hierarchy

  • NodeHandler
    • MasterHandler

Constructors

Properties

nodeHandlers: NodeHandler[] = []
parentHandler?: NodeHandler

Methods

  • Parameters

    • node: ExpressionNode

    Returns Promise<boolean | CallExpression | Program | ExpressionStatement | {
        computed: true;
        object: ({ type: "MemberExpression"; property: StringLiteral; computed: true; object: MemberExpression | IdentifierName | StringLiteral; }) | {
            computed: false;
            object: MemberExpression | IdentifierName | StringLiteral;
            property: IdentifierName;
            type: "MemberExpression";
        } | IdentifierName | StringLiteral;
        property: StringLiteral;
        type: "MemberExpression";
    } | {
        computed: false;
        object: {
            computed: true;
            object: MemberExpression | IdentifierName | StringLiteral;
            property: StringLiteral;
            type: "MemberExpression";
        } | ({ type: "MemberExpression"; property: IdentifierName; computed: false; object: MemberExpression | IdentifierName | StringLiteral; }) | IdentifierName | StringLiteral;
        property: IdentifierName;
        type: "MemberExpression";
    } | ArrayExpression | {
        type: "BooleanLiteral";
        value: true;
    } | {
        type: "BooleanLiteral";
        value: false;
    } | IdentifierName | DecimalLiteral | {
        properties: [];
        type: "ObjectExpression";
    } | {
        properties: PropertyNameAndValueList;
        type: "ObjectExpression";
    } | PropertyAssignment | NullLiteral | StringLiteral>

  • This method is responsible for handling a node. It iterates over the collection of node handlers and uses the first handler that accepts the node to handle it. If no handler accepts the node, the method throws an error.

    Parameters

    • node: CallExpression

      The node to be handled.

    Returns Promise<ParsedType>

    The result of the node handling, or throws an error if no handler can handle the node.

Generated using TypeDoc