> Scroll down for code samples, example requests and responses. Select a language for code samples from the tabs above or the mobile navigation menu.
Base URLs:
> Code samples
const headers = {
'Accept':'application/json'
};
fetch('/document/',
{
method: 'GET',
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
import requests
headers = {
'Accept': 'application/json'
}
r = requests.get('/document/', headers = headers)
print(r.json())
GET /
Desc
Get application description.
Returns a simple response containing the description of the application.
Returns:
Example Response:
{
"data": {
"desc": "Document processing app"
}
}
> Example responses
> 200 Response
{
"error": "string",
"data": null
}
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | Successful Response | ApiResponse |
> Code samples
const inputBody = '{
"payload": "string",
"questions": "string"
}';
const headers = {
'Content-Type':'multipart/form-data',
'Accept':'application/json'
};
fetch('/document/answer-questions',
{
method: 'POST',
body: inputBody,
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
import requests
headers = {
'Content-Type': 'multipart/form-data',
'Accept': 'application/json'
}
r = requests.post('/document/answer-questions', headers = headers)
print(r.json())
POST /answer-questions
Answer Questions
Answer questions based on an uploaded document.
This endpoint takes an uploaded document file and a list of questions. It processes the document
to find answers to the questions.
Parameters:
Returns:
Example Request:
POST /answer-questions
Content-Type: multipart/form-data
Body: <Upload a PDF or image file>
Form Data: questions=Question1,Question2,Question3
Example Response:
{
"data": [
{
"question": "Question1",
"answer": "Answer1",
"score": 0.85,
"start": 10,
"end": 20
},
{
"question": "Question2",
"answer": "Answer2",
"score": 0.75,
"start": 30,
"end": 40
},
{
"question": "Question3",
"answer": "Answer3",
"score": 0.92,
"start": 50,
"end": 60
}
]
}
> Body parameter
payload: string
questions: string
Name | In | Type | Required | Description |
---|---|---|---|---|
body | body | Body_answer_questions_answer_questions_post | true | none |
> Example responses
> 200 Response
{
"error": "string",
"data": [
{
"question": "string",
"answer": "string",
"score": 0,
"start": 0,
"end": 0
}
]
}
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | Successful Response | DocumentQuestionAnswerResponse |
422 | Unprocessable Entity | Validation Error | HTTPValidationError |
{
"error": "string",
"data": null
}
ApiResponse
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
error | any | true | none | none |
anyOf
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
» anonymous | string | false | none | none |
or
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
» anonymous | null | false | none | none |
continued
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
data | any | true | none | none |
{
"payload": "string",
"questions": "string"
}
Body_answer_questions_answer_questions_post
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
payload | string(binary) | true | none | none |
questions | string | true | none | none |
{
"question": "string",
"answer": "string",
"score": 0,
"start": 0,
"end": 0
}
DocumentQuestionAnswer
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
question | string | true | none | none |
answer | string | true | none | none |
score | number | true | none | none |
start | integer | true | none | none |
end | integer | true | none | none |
{
"error": "string",
"data": [
{
"question": "string",
"answer": "string",
"score": 0,
"start": 0,
"end": 0
}
]
}
DocumentQuestionAnswerResponse
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
error | any | true | none | none |
anyOf
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
» anonymous | string | false | none | none |
or
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
» anonymous | null | false | none | none |
continued
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
data | [DocumentQuestionAnswer] | true | none | none |
{
"detail": [
{
"loc": [
"string"
],
"msg": "string",
"type": "string"
}
]
}
HTTPValidationError
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
detail | [ValidationError] | false | none | none |
{
"loc": [
"string"
],
"msg": "string",
"type": "string"
}
ValidationError
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
loc | [anyOf] | true | none | none |
anyOf
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
» anonymous | string | false | none | none |
or
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
» anonymous | integer | false | none | none |
continued
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
msg | string | true | none | none |
type | string | true | none | none |