calpoly-csai / api

Official API for the NIMBUS Voice Assistant accessible via HTTP REST protocol.
https://nimbus.api.calpolycsai.com/
GNU General Public License v3.0
9 stars 4 forks source link

QA object for question/answer mapping #63

Closed cameron-toy closed 4 years ago

cameron-toy commented 4 years ago

Objective

Deploy REST API with an endpoint for Question/Answering pipeline

Key Result

Create a class for wrapping questions with the required functions/behavior to answer them.

Details

The QA class will accept two functions as part of the constructor: db_query() and format_answer(). db_query will take a dictionary of extracted variables and return a dictionary of relevant data from the database. format_answer will take both dictionaries and create a properly formatted answer string. The QA class will also contain an answer() method which takes an extracted variables dictionary and uses the supplied functions to return a formatted answer string.

An object-oriented model where QA functions as a base class that question/answer mapping classes are extended from was also considered. This functionally-inspired model was chosen to allow flexible reuse of both database access and answer formatting code.