Serverless AI Question Answering
AI powered question answering based on provided context. Extract precise answers from text passages, documents, or any context. Ideal for building virtual assistants, knowledge bases, FAQ systems, and information extraction applications.
Endpoint
Answer questions based on provided context with AI precision.
POSThttps://api.xtartapp.com/text/question-answering
*Authentication
You must use a Bearer token provided by the dashboard to use for authentication. Add the token to the Authorization header.
Request body
Name | Type | Required | Max | Description |
---|---|---|---|---|
text | string | Yes | 300 | The question to be answered based on the context |
context | string | Yes | 5000 | The text context from which to answer the question |
Response
Name | Type | Description |
---|---|---|
data | object | The result of the question answering |
data.answer | string | The answer to the question based on the provided context |
data.confidence | number | Confidence score (0.0 to 1.0) indicating the certainty of the answer |
metadata | object | Metadata about the question answering process |
metadata.cost | number | The cost of the question answering request |
Errors
{
"error": "string",
"code": "string"
}
HTTP Status | Error Code | Message |
---|---|---|
400 | INVALID_PAYLOAD | Occurs when the payload is invalid. |
400 | INVALID_REQUEST | Ex.: The request is invalid. |
400 | TEXT_QUESTION_ANSWERING_ERROR | Ex: could not answer the question based on context | parsing error |
400 | HARM_CONTENT | Ex.: The content is harmful and cannot be processed. |
400 | INSUFFICIENT_BALANCE | The user has insufficient balance |
401 | UNAUTHORIZED | Ex.: The token is invalid. |
429 | TOO_MANY_REQUESTS | Ex.: The request limit has been reached. |