Get completions
curl --request POST \
--url https://api.webless.ai/api/v1/completions \
--header 'Content-Type: application/json' \
--data '
{
"prefix": "How is",
"sessionId": "a1c2d3e4-1111-2222-3333-444455556666"
}
'const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({prefix: 'How is', sessionId: 'a1c2d3e4-1111-2222-3333-444455556666'})
};
fetch('https://api.webless.ai/api/v1/completions', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.webless.ai/api/v1/completions"
payload = {
"prefix": "How is",
"sessionId": "a1c2d3e4-1111-2222-3333-444455556666"
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"prefix": "How is",
"completions": [
{
"text": "How is pricing structured?",
"suffix": " pricing structured?",
"score": 0.91
}
],
"best": {
"text": "How is pricing structured?",
"suffix": " pricing structured?",
"score": 0.91
}
}
Search API
Get completions
Returns prefix-guaranteed inline autocomplete completions for query inputs. Use this for ghost text while a user is typing. Every returned text starts with the requested prefix case-insensitively.
POST
/
api
/
v1
/
completions
Get completions
curl --request POST \
--url https://api.webless.ai/api/v1/completions \
--header 'Content-Type: application/json' \
--data '
{
"prefix": "How is",
"sessionId": "a1c2d3e4-1111-2222-3333-444455556666"
}
'const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({prefix: 'How is', sessionId: 'a1c2d3e4-1111-2222-3333-444455556666'})
};
fetch('https://api.webless.ai/api/v1/completions', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.webless.ai/api/v1/completions"
payload = {
"prefix": "How is",
"sessionId": "a1c2d3e4-1111-2222-3333-444455556666"
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"prefix": "How is",
"completions": [
{
"text": "How is pricing structured?",
"suffix": " pricing structured?",
"score": 0.91
}
],
"best": {
"text": "How is pricing structured?",
"suffix": " pricing structured?",
"score": 0.91
}
}
Use this endpoint for inline query autocomplete while a user is typing. It is
separate from
suggestions, which
returns follow-up prompts after a query is submitted.prefix. Abort in-flight requests when the prefix changes. Use the returned
suffix to render ghost text after the user’s typed text.
Pass previous_completions when you want to avoid repeating completions already
shown to the user. When is_private_session is true, the API returns an empty
completion set.Body
application/json
User-typed prefix. Internal whitespace runs are normalized server-side.
Example:
"How is"
Example:
"a1c2d3e4-1111-2222-3333-444455556666"
Example:
"YOUR_COMPANY"
Runtime package pointer. Omit this field or use published for production traffic. Use unpublished only when testing an unpublished runtime package.
Available options:
published, unpublished Maximum number of completions to return. Capped at 10.
Required range:
0 <= x <= 10Example:
5
Exact completions to exclude from results.
Example:
["How is pricing structured?"]
Example:
"1f7c5f74-7b9e-4a0a-9b7d-4e3e2a5e3b60"
When true, returns an empty completion set.
Response
Inline autocomplete completions for the supplied prefix
Was this page helpful?