Serverless AI Text Suggestions
AI powered text suggestions to accelerate your text input with context aware suggestions based on the previous text input. It may be used to autocomplete text in a chatbot or a text input field based on the intent of the field.
Endpoint
Text suggestions with intent
POSThttps://api.xtartapp.com/text/suggestions
*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 | 500 | The text to analyze |
intent | string | Yes | 250 | The intent to use for the suggestions |
limit | number | No | - | The limit of results to return. Minimum 1, maximum 10 |
language | string | Yes | - | The language code for the suggestions (e.g., 'en', 'es', 'fr'). Use 'auto' for automatic language detection. |
Response
Name | Type | Description |
---|---|---|
data | object | The data of the text suggestions |
data.sourceText | string | The original input text |
data.suggestions | array | Array of suggestion objects |
data.suggestions[].suggestion | string | The suggested text with completion |
data.suggestions[].score | number | The confidence score of the text suggestions (0-1) |
data.detectedLanguage | string | The detected language code of the input text |
metadata | object | Metadata about the text suggestions process |
metadata.cost | number | The cost of the text suggestions 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_SUGGESTIONS_ERROR | Ex: could not generate suggestions for the text | 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. |