Extract chunks from knowledge base
curl --request POST \
--url https://api.lighton.ai/api/v2/query \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"query": "<string>"
}
'import requests
url = "https://api.lighton.ai/api/v2/query"
payload = { "query": "<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({query: '<string>'})
};
fetch('https://api.lighton.ai/api/v2/query', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));[
{
"chunks": [
{
"uuid": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"text": "<string>",
"metadata": {},
"score": 123
}
],
"query": "<string>"
}
]Files Search
Extract chunks from knowledge base
deprecated
Deprecated — this endpoint will be removed in a future release. Use POST /api/v3/search instead.
This endpoint can be used to retrieve top n chunks per query.
The query can be a single string or a list of strings.
The collection field can be used to specify the collection to query, which defaults to base_collection.
An optional integer n can be provided in order to retrieve top n chunks, which defaults to 5 if not specified.
Response: Returns an array of results, one for each input query.
POST
/
api
/
v2
/
query
Extract chunks from knowledge base
curl --request POST \
--url https://api.lighton.ai/api/v2/query \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"query": "<string>"
}
'import requests
url = "https://api.lighton.ai/api/v2/query"
payload = { "query": "<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({query: '<string>'})
};
fetch('https://api.lighton.ai/api/v2/query', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));[
{
"chunks": [
{
"uuid": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"text": "<string>",
"metadata": {},
"score": 123
}
],
"query": "<string>"
}
]Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Body
application/jsonapplication/x-www-form-urlencodedmultipart/form-data
Request serializer for retrieving top n chunks per query.