cisco / mindmeld

An Open Source Conversational AI Platform for Deep-Domain Voice Interfaces and Chatbots.
http://mindmeld.com
Apache License 2.0
674 stars 185 forks source link

QuestionAnswerer interface could be tightened up #219

Closed davidmfrey closed 3 years ago

davidmfrey commented 4 years ago

I was trying out the QuestionAnswerer class and noticed that the interface can be difficult to use. For example

from mindmeld.components import QuestionAnswerer
qa = QuestionAnswerer('.')
qa.load_kb('my_app', 'stores', './data/stores.json')
qa.get(index='stores')

The call to load_kb() allows the app_namespace parameter to be different than the app_path parameter for the construction of a QuestionAnswerer. However, the get() function does not have a corresponding app_namespace parameter and instead relies on resolved namespace from the app_path used in the constructor. This requires the user to have internal knowledge of how the app_path parameter is resolved in order to use the QuestionAnswerer functionality.

Harirupa commented 3 years ago

I am one of those people who intend to use the Mindmeld blueprint app as a baseline and attempting to customise by adding data and logic specific to our use case. As mentioned by @davidmfrey, do not have internal knowledge of how the app_path parameter is resolved. Local blueprint data was modified as a test but the elesticsearch index still points to the stored elesticsearch index (in spite of using the option clean = True).

murali1996 commented 3 years ago

Hi @Harirupa, this issue will be resolved as part of PR #297 . For the time being, you can assume that the app_namespace is nothing but the app's name in its absolute directory path. Meaning, if your app path is something like /Users/<username>/Projects/mindmeld_blueprints/food_ordering, the app_namespace is nothing but food_ordering. You can pass-in this name as qa.load_kb(app_namespace='food_ordering', index_name='stores', data_file='./data/stores.json') while loading a KB.

In case you wish to delete an Elasticsearch index and not just do a clean fit, you can use commands like curl -X DELETE 'http://localhost:9200/_all' or curl -XDELETE localhost:9200/food_ordering*.