Documents
Autocomplete
Get suggestions as the user types from any text database. There's nothing to set up. Vecstore learns words and phrases from the documents already in the database.
Note: autocomplete works with text databases only. It isn't available for image databases.
Path Parameters
Request Body
Send what the user has typed so far.
{
"query": "wireless hea",
"limit": 5
}Response
ready, or building while the index is being created Suggestion object
{
"suggestions": [
{ "text": "wireless headphones" },
{ "text": "wireless headset" }
],
"status": "ready",
"search_time": "0.42ms"
}How Suggestions Work
- It completes the word being typed and uses the word before it for context.
wireless heasuggestswireless headphonesandwireless headset. - After a space, it suggests the next word.
wirelesssuggestswireless headphones. - It allows one wrong letter in words of 4 to 20 characters.
headphnesstill findsheadphones. - Suggestions are ranked by how often they appear in your documents.
- Suggestions come from your content, not from what users have searched for.
To show results when a user picks a suggestion, send it to Search Documents.
Index Building
The first time you call autocomplete on a database, Vecstore builds a word and phrase index from its documents. Until it's ready, the response has status: "building" and no suggestions.
{
"suggestions": [],
"status": "building",
"search_time": "0.05ms"
}After that, the index refreshes on its own as you add or delete documents. New documents show up in suggestions after the next refresh, not instantly.
Credits
Autocomplete costs 1 credit per 25 requests. Suggestions are served from memory without an embedding call, so you can call it on every keystroke. The dashboard's Autocomplete tab is billed the same way.