Hi, this is probably a straightforward question, but I can’t seem to find it in the docs – how would we separate the templates out of the domain.yml file? I’m building a bot that’s going to have a lot of content, and would like to try and have a /templates folder somwhere, but I’m not sure how that would link up with the rest of the app.
I’m not looking for NLG from a CMS, unfortunately, I’m trying to cut down on the amount of servers we have to set up, which is why I was trying to see if there was a way to keep it local and just point to something like /templates/[some template]
Replace the way the templates are loaded. At this moment, if i am not wrong, you cannot extend the template generation class and put them in the config like the tracker store. Perhaps a feature request. Either extend to another application, or update this file as how/where to load the templates from
def create(
obj: Union['NaturalLanguageGenerator', EndpointConfig, None],
domain: Optional[Domain]
) -> 'NaturalLanguageGenerator':
"""Factory to create a generator."""
if isinstance(obj, NaturalLanguageGenerator):
return obj
elif isinstance(obj, EndpointConfig):
from rasa_core.nlg import CallbackNaturalLanguageGenerator
return CallbackNaturalLanguageGenerator(obj)
elif obj is None:
> from rasa_core.nlg import TemplatedNaturalLanguageGenerator
> templates = domain.templates if domain else []
> return TemplatedNaturalLanguageGenerator(templates)
else:
raise Exception("Cannot create a NaturalLanguageGenerator "
"based on the passed object. Type: `{}`"
"".format(type(obj)))
Not sure if this is still an issue or not, but you could automate creating your domain files instead. I made a simple way to generate domain.yml files for Rasa projects called rasa_denerator