Ask APIs
Miso's new Ask API is the next generation of question answering APIs. It is designed to provide accurate and concise answers to your questions based on your existing product documents.
The Ask API answers complex questions in near real time.
Miso preprocesses your product documents, breaking them into segments. When a question is received, Miso finds the most related product and segments, then summarize to a concise and informative answer based on the identified segments, including products related to the question.
Possible use case includes: knowledge base, documentation search, customer support, and more.
To use the Ask API, you first submit a "question" you want to ask. Question can be any human-readable text. Then a question ID will returned, and the question will be processed in the background.
After receving question ID, you can then use the question ID to get latest answer to the question as it is being compiled.
For example:
If you want to know about the inner workings of nginx:
{
"question":"How nginx works internally?"
}
The API responds with a question id.
{
"data": {
"question_id": "ff4775fa-345e-4d28-91b0-8fb8bf09…"
},
"message": "success"
}
Then you can send a GET request to /v1/ask/questions/{question_id}/answer
to get the latest answer while Miso compiles it.
Use answer_stage and finished to check the current status.
While Miso verifies the sources, the answer endpoint returns:
{
"message": "success",
"data": {
"question": "How nginx works internally?",
"question_id": "ff4775fa-345e-4d28-91b0-8fb8bf0…",
"parent_question_id": null,
"answer_stage": "Verifying possible answers",
"finished": false,
"answer": "Verifying possible answers ...",
"sources": [],
"related_resources": [],
"followup_questions": []
}
}
When the answer is complete:
{
"message": "success",
"data": {
"question": "How nginx works internally?",
"question_id": "ff4775fa-345e-4d28-91b0-8fb8bf095e6a",
"parent_question_id": null,
"answer_stage": "Generating summary",
"finished": true,
"answer": "# How does Nginx work internally?\n\n##…",
"sources": [
{
"title": "Internal requests",
"product_id": "9781788623551",
"child_title": "Internal requests",
"child_id": "203",
"snippet": "<mark>Internal requests\nNginx diffe…"
},
{
"title": "5. Nginx Core Architecture",
"product_id": "9781484216569",
"child_title": "5. Nginx Core Architecture",
"child_id": "5",
"snippet": "Checks if the client can access of t…"
},
{
"title": "2. Managing Nginx",
"product_id": "9781785289538",
"child_title": "2. Managing Nginx",
"child_id": "14",
"snippet": "<mark>The Nginx connection processin…"
},
{
"title": "3. Nginx Core Directives",
"product_id": "9781484216569",
"child_title": "3. Nginx Core Directives",
"child_id": "3",
"snippet": "<mark>Understanding the Default Conf…"
},
{
"title": "4. Nginx Modules",
"product_id": "9781484216569",
"child_title": "4. Nginx Modules",
"child_id": "4",
"snippet": "<mark>Based on the context like HTTP…"
}
],
"related_resources": [],
"followup_questions": [
"What are the steps involved in processing a requ…",
"How do Nginx modules contribute to the internal w…"
]
}
}
Related product IDs will be returned along with human-readable answer. Related text section in the product will also be quoted.
If a product has any children, they will also be matched, child_id and child_title will be included for sources belonging to the product's children.
You can use fq to limit the search scope, for example, to a specific product type or other condition.
If you only want to search for books (no articles of videos), you can use fq=type:book like this:
{
"question":"How nginx works internally?"
"fq": "type:book"
}
If you want the answer to contain any other fields, set source_fl when submitting the question.
