MCPcopy
hub / github.com/RasaHQ/rasa / SchemaNode

Class SchemaNode

rasa/engine/graph.py:26–67  ·  view source on GitHub ↗

Represents one node in the schema. Args: needs: describes which parameters in `fn` (or `constructor_name` if `eager==False`) are filled by which parent nodes. uses: The class which models the behavior of this specific graph node. constructor_name: The name of

Source from the content-addressed store, hash-verified

24
25@dataclass
26class SchemaNode:
27 """Represents one node in the schema.
28
29 Args:
30 needs: describes which parameters in `fn` (or `constructor_name`
31 if `eager==False`) are filled by which parent nodes.
32 uses: The class which models the behavior of this specific graph node.
33 constructor_name: The name of the constructor which should be used to
34 instantiate the component. If `eager==False` then the `constructor` can
35 also specify parameters which are filled by parent nodes. This is e.g.
36 useful if a parent node returns a `Resource` and this node wants to
37 directly load itself from this resource.
38 fn: The name of the function which should be called on the instantiated
39 component when the graph is executed. The parameters from `needs` are
40 filled from the parent nodes.
41 config: The user's configuration for this graph node. This configuration
42 does not need to be specify all possible parameters; the default values
43 for missing parameters will be filled in later.
44 eager: If `eager` then the component is instantiated before the graph is run.
45 Otherwise it's instantiated as the graph runs (lazily). Usually we always
46 instantiated lazily during training and eagerly during inference (to
47 avoid that the first prediction takes longer).
48 is_target: If `True` then this node can't be pruned during fingerprinting
49 (it might be replaced with a cached value though). This is e.g. used for
50 all components which train as their result always needs to be added to
51 the model archive so that the data is available during inference.
52 is_input: Nodes with `is_input` are _always_ run (also during the fingerprint
53 run). This makes sure that we e.g. detect changes in file contents.
54 resource: If given, then the graph node is loaded from an existing resource
55 instead of instantiated from scratch. This is e.g. used to load a trained
56 component for predictions.
57 """
58
59 needs: Dict[Text, Text]
60 uses: Type[GraphComponent]
61 constructor_name: Text
62 fn: Text
63 config: Dict[Text, Any]
64 eager: bool = False
65 is_target: bool = False
66 is_input: bool = False
67 resource: Optional[Resource] = None
68
69
70@dataclass

Calls

no outgoing calls

Used in the wild real call sites across dependent graphs

searching dependent graphs…