Search…
Question answering
Given a question and a set of documents, the API generates an answer to the question based on the information in the set of documents.

Answer question

post
https://example.forefront.link
/answer
Answer question

Example request

Python
cURL
1
import requests
2
3
headers = {"Authorization": "Bearer <INSERT_YOUR_TOKEN>"}
4
5
body = {
6
"documents": ["the cat ate the catnip", "the rabbit ate the carrot", "the horse ate the hay"],
7
"query": "What did the rabbit eat?"
8
}
9
10
res = requests.post(
11
"https://search-qa.forefront.link/answer",
12
json=body,
13
headers=headers
14
)
Copied!
1
curl https://search-qa.forefront.link/answer \
2
-H 'Content-Type: application/json' \
3
-H 'Authorization: Bearer YOUR_API_KEY' \
4
-d '{
5
"documents": ["the cat ate the catnip", "the rabbit ate the carrot", "the horse ate the hay"],
6
"query": "What did the rabbit eat?"
7
}'
Copied!