Comprehension

This is the final step of the process where one can request articles as required.


Endpoint

POST /content/comprehension/{content-model-id}/

Request Headers:

Authentication: Token <user-generated-token>

Request Payload:

{
    "article": "cards",
    "params": "json encoded string with following definition",
    "id": "Optional article id (v4 uuid) to retrieve previously generated article."
}

JSON encoded string for params is the set of parameters required for the content model and as requested by the models query.

{
    "question_type": {"fill_in_the_blank":2, "true_false":3, "sentence_completion":2},
    "difficulty": 5,
    "word_limit": 200
}

The parameters are:

  • question_type: The types of questions to be requested with comprehension. A key value pair of question type and corresponding questions. Note that total should only be limited to 8 questions. Otherwise it'll be limited to a maximum of 8 questions.
  • difficulty: The level of difficulty of the comprehension and associated questions. It ranges from 1(easy) - 10(difficult).
  • word_limit: The suggestive word limit of the comprehension from one of 100/200/300. We try to get as close to word limit as possible and an exact match is not possible.

Response:

{
    "success": true,
    "article": {
        "cards": [
            {
                "html": "Only this if requested type is cards-html else others",
                "text": "Only if requested type is cards",
                "title": "Title of the card",
                "subheading": "Subheading of the card"
            },
            {
                "html": "Only this if requested type is cards-html else others",
                "text": "Only if requested type is cards",
                "title": "Questions",
                "subheading": "",
                "questions": [
                    {
                        "question": "Yolkmedia.com is a startup that focuses on",
                        "options": [
                            "allowing users to create digital content on its website.",
                            "providing high-quality news content on its online platform.",
                            "converting popular newspapers into electronic form."
                        ],
                        "answer": 1
                    },
                    {
                        "question": "Prior to the latest fundraising round, the valuation of the startup stood at $80 million.",
                        "options": [
                            "True",
                            "False",
                            "Doesn’t say
."
                        ],
                        "answer": 1
                    }
                ]
            }
        ]
    },
    "id": "Article id (v4 uuid) to retrieve same article. Aimed to provide the article for which the preview was created.",
    "code": 123,
    "message": "some message explaining code and status"
}

Curl:

curl -X POST 'http://stage.brahmastra.tech/content/comprehension/<model_id>/' -d 'article=cards&params={"question_type":{"fill_in_the_blank":2,"true_false":3,"sentence_completion":2},"difficulty":5,"word_limit":200}' -H 'Authorization: Token <your-auth-token-generated-above>'