Version: 3.x
rasa.engine.storage.resource
Resource Objects
@dataclass
class Resource()
Represents a persisted graph component in the graph.
Attributes:
name- The unique identifier for theResource. Used to locate the associated data from aModelStorage. Normally matches the name of the node which created it.output_fingerprint- An unique identifier for a specific instantiation of aResource. Used to distinguish a specific persistence for the sameResourcewhen saving to the cache.
from_cache
@classmethod
def from_cache(cls, node_name: Text, directory: Path,
model_storage: ModelStorage,
output_fingerprint: Text) -> Resource
Loads a Resource from the cache.
This automatically loads the persisted resource into the given ModelStorage.
Arguments:
node_name- The node name of theResource.directory- The directory with the cachedResource.model_storage- TheModelStoragewhich the cachedResourcewill be added to so that theResourceis accessible for other graph nodes.ModelStorage0 - The fingerprint of the cachedResource.
Returns:
The ready-to-use and accessible Resource.
to_cache
def to_cache(directory: Path, model_storage: ModelStorage) -> None
Persists the Resource to the cache.
Arguments:
directory- The directory which receives the persistedResource.model_storage- The model storage which currently contains the persistedResource.
fingerprint
def fingerprint() -> Text
Provides fingerprint for Resource.
A unique fingerprint is created on initialization of a Resource however we
also allow a value to be provided for when we retrieve a Resource from the
cache (see Resource.from_cache).
Returns:
Fingerprint for Resource.
