Your task is to implement a zero- or few-shot intent classifier that can be used to provide inferencing service via an HTTP Service. During the classifier development, you should take into consideration the following points: new set of intents, cost, token size, latency, and parsable output.
The boiler plate for the Service is implemented in file server.py
and you'll have to implement the API function for inferencing as per the API documentation provided below. The classifier interface has been defined in intent_classifer.py
. You can modify/refactor it according to your needs.
To create a zero- or few-shot classifier you can use any kind of text generation model and include in your solution description the reasons for selecting your model.
Please also provide a Jupyter notebook(s) in which you delve into your task, data, and prompt development. Include some test results to demonstrate the functionality of your classifier.
- ATIS data can be used for developing the classifier. You'll find the data files in
data/atis
directory. Files are TSV files where the first column is the text and the second column is the intent label. - The given codebase contains one bug (that we know of). You need to find and fix this bug.
- Your classification component should be architected in a way that facilitates the addition/implementation of new intent classifier models.
- Your service needs to adopt the following API Documentation.
- Please provide a private github repository where all of your code should be. Please also provide a README.md file with all the instructions, requirements, etc. to run the solution.
API documentation for intent classification service.
Responds intent classification results for the given query utterance.
JSON request with MIME-Type of application/json
and body:
- text
string
: Input sentence intent classification
Example request
{
"text": "find me a flight that flies from memphis to tacoma"
}
JSON response with body:
- intents
[Prediction]
: An array of top 3 intent prediction results. SeePrediction
type below.
Prediction
is a JSON object with fields:
- label
string
: Intent label name
Example response
{
"intents": [{
"label": "flight"
}, {
"label": "aircraft"
}, {
"label": "capacity"}]
}
All exceptions are JSON responses with HTTP status code other than 2XX, error label and human readable error message.
Given when the request is missing a body.
{
"label": "BODY_MISSING",
"message": "Request doesn't have a body."
}
Given when the request has a body but the body is missing a text field.
{
"label": "TEXT_MISSING",
"message": "\"text\" missing from request body."
}
Given with any other exception. Human readable message includes the exception text.
{
"label": "INTERNAL_ERROR",
"message": "<ERROR_MESSAGE>"
}
- Scenario fitness: How does your solution meet the requirements?
- Modularity: Can your code easily be modified? How much effort is needed to add a new kind of ML model to your inference service?
- Code readability and comments: Is your code easily comprehensible and testable?
- Bonus: Any additional creative features: Docker files, architectural diagrams for model or service, Swagger, model performance metrics etc.
- Research:: Can your code easily adapt to a new set of intents? Is your prompt cost-effective? How do you deal with large token sizes? Does your prompt ensure parsable output? How do you handle parsing errors?
- Quality assurance:: Ensure your code is thoroughly tested to validate its correctness and functionality. Your solution should be robust and able to handle various inputs and edge cases to demonstrate its reliability.