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.
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.