def instantiate_agent_prompt(sentence=None): # pragma: no cover interpreter = instantiate_and_fit_interpreter() Prompt(Agent(interpreter, transitions_graph_path=settings.getpath( settings.SETTING_GRAPH_FILE), **os.environ), parse_message=sentence).cmdloop()
def test_it_should_returns_an_absolute_path_when_asked_to(self): r = getpath('a key', section='paths') expect(r).to.be.none r = getpath('a key', 'default/path', section='paths') expect(r).to.equal(os.path.abspath('default/path')) set_setting('a key', 'something', section='paths') r = getpath('a key', section='paths') expect(r).to.equal(os.path.abspath('something')) expect( getpath('a key', section='paths', additional_lookup={ 'PATHS_A_KEY': 'var/data', })).to.equal(os.path.abspath('var/data'))
def list_skills(): # pragma: no cover """List installed skills for this instance. """ import_skills(settings.getpath(settings.SETTING_SKILLS)) for skill_data in get_loaded_skills( settings.getlist(settings.SETTING_LANG)[0]): click.echo(skill_data)
def instantiate_and_fit_interpreter(): # pragma: no cover import_skills(settings.getpath(settings.SETTING_SKILLS), settings.getbool(settings.SETTING_WATCH)) try: from pytlas.interpreters.snips import SnipsInterpreter interpreter = SnipsInterpreter( settings.get(settings.SETTING_LANG), settings.getpath(settings.SETTING_CACHE)) training_file = settings.getpath(settings.SETTING_TRAINING_FILE) if training_file: interpreter.fit_from_file(training_file) else: interpreter.fit_from_skill_data() return interpreter except ImportError: logging.critical( 'Could not import the "snips" interpreter, is "snips-nlu" installed?' )
def remove_skills(skills): # pragma: no cover """Remove given skills from your instance. """ uninstall_skills(settings.getpath(settings.SETTING_SKILLS), click.echo, *skills)
def update_skills_command(skills): # pragma: no cover """Update given skills for this instance. If no skills are defined, they will be all updated. """ update_skills(settings.getpath(settings.SETTING_SKILLS), click.echo, *skills)
def add_skills(skills): # pragma: no cover """Add given skills to your instance. """ install_skills(settings.getpath(settings.SETTING_SKILLS), click.echo, *skills)