Generate an answer with a single document
curl --request POST \
--url https://api.lighton.ai/api/v2/files/{id}/ask-question \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"question": "<string>"
}
'import requests
url = "https://api.lighton.ai/api/v2/files/{id}/ask-question"
payload = { "question": "<string>" }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({question: '<string>'})
};
fetch('https://api.lighton.ai/api/v2/files/{id}/ask-question', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));{
"response": "<string>",
"chunks": [
{
"id": 123,
"uuid": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"content_id": "<string>",
"text": "<string>",
"metadata": {
"pages": "",
"total_pages": 123,
"title": "",
"source": "",
"parser": "",
"folder_name": "",
"coords": "<string>",
"previous": "",
"next": "",
"overlapping": "",
"token_length": 123
},
"document": 123,
"document_attributes": {},
"chunk_type": "text",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z"
}
]
}Files
Generate an answer with a single document
deprecated
Deprecated — this endpoint will be removed in a future release. Use POST /api/v3/ask instead.
This endpoint can be used to ask a question about a document.
The question is required and should be a string .
The id of the document is a path parameter.
POST
/
api
/
v2
/
files
/
{id}
/
ask-question
Generate an answer with a single document
curl --request POST \
--url https://api.lighton.ai/api/v2/files/{id}/ask-question \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"question": "<string>"
}
'import requests
url = "https://api.lighton.ai/api/v2/files/{id}/ask-question"
payload = { "question": "<string>" }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({question: '<string>'})
};
fetch('https://api.lighton.ai/api/v2/files/{id}/ask-question', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));{
"response": "<string>",
"chunks": [
{
"id": 123,
"uuid": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"content_id": "<string>",
"text": "<string>",
"metadata": {
"pages": "",
"total_pages": 123,
"title": "",
"source": "",
"parser": "",
"folder_name": "",
"coords": "<string>",
"previous": "",
"next": "",
"overlapping": "",
"token_length": 123
},
"document": 123,
"document_attributes": {},
"chunk_type": "text",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z"
}
]
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Path Parameters
Body
application/jsonapplication/x-www-form-urlencodedmultipart/form-data
Request serializer for asking a question about a document.
The question to ask about the document
Maximum string length:
2048