Create a text completion
Create a completion using CompletionRequest. Response is CompletionsResponse.
curl --request POST \
--url https://api.synapsai.cloud/v1/completions \
--header 'Content-Type: application/json' \
--data '
{
"prompt": "<string>",
"images": "<unknown>",
"audios": "<unknown>",
"videos": "<unknown>",
"max_completion_tokens": 123,
"temperature": 123,
"top_p": 123,
"top_k": 123,
"stream": false,
"stop": [
"<string>"
],
"seed": 123,
"presence_penalty": 123,
"frequency_penalty": 123,
"logit_bias": {},
"logprobs": false
}
'import requests
url = "https://api.synapsai.cloud/v1/completions"
payload = {
"prompt": "<string>",
"images": "<unknown>",
"audios": "<unknown>",
"videos": "<unknown>",
"max_completion_tokens": 123,
"temperature": 123,
"top_p": 123,
"top_k": 123,
"stream": False,
"stop": ["<string>"],
"seed": 123,
"presence_penalty": 123,
"frequency_penalty": 123,
"logit_bias": {},
"logprobs": False
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"id": "<string>",
"object": "completion",
"created": 123,
"model": "<string>",
"choices": [
{
"text": "<string>",
"index": 123,
"logprobs": 123,
"finish_reason": "<string>"
}
],
"usage": {
"prompt_tokens": 123,
"completion_tokens": 123,
"total_tokens": 123
}
}Body
Request body for the text completion endpoint.
The text prompt to generate completions from. Required.
Optional images referenced by the prompt (base64, array of images or descriptors).
Optional audio inputs referenced by the prompt.
Optional video inputs referenced by the prompt.
Maximum tokens to generate for the completion.
Sampling temperature to control randomness of generation.
Nucleus sampling cumulative probability threshold.
Top-k filtering size to restrict token choices.
If true, request streaming partial output as it is produced.
List of stop sequences to end generation.
Optional seed to make generation deterministic.
Penalty to reduce likelihood of new tokens based on presence.
Penalty to reduce likelihood of tokens appearing based on frequency.
Token-specific additive biases applied to logits before sampling.
Show child attributes
Show child attributes
Whether to include logprob information in the completion response.
Response
Completions response
Response returned from the text completions endpoint.
Unique identifier for this completion response.
Type of the returned object; always 'completion' for this response.
completion Unix timestamp (seconds) when the completion was created.
Name or ID of the model used to generate the completion.
List of generated choices produced by the model.
Show child attributes
Show child attributes
Optional token usage details for this request.
Show child attributes
Show child attributes
curl --request POST \
--url https://api.synapsai.cloud/v1/completions \
--header 'Content-Type: application/json' \
--data '
{
"prompt": "<string>",
"images": "<unknown>",
"audios": "<unknown>",
"videos": "<unknown>",
"max_completion_tokens": 123,
"temperature": 123,
"top_p": 123,
"top_k": 123,
"stream": false,
"stop": [
"<string>"
],
"seed": 123,
"presence_penalty": 123,
"frequency_penalty": 123,
"logit_bias": {},
"logprobs": false
}
'import requests
url = "https://api.synapsai.cloud/v1/completions"
payload = {
"prompt": "<string>",
"images": "<unknown>",
"audios": "<unknown>",
"videos": "<unknown>",
"max_completion_tokens": 123,
"temperature": 123,
"top_p": 123,
"top_k": 123,
"stream": False,
"stop": ["<string>"],
"seed": 123,
"presence_penalty": 123,
"frequency_penalty": 123,
"logit_bias": {},
"logprobs": False
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"id": "<string>",
"object": "completion",
"created": 123,
"model": "<string>",
"choices": [
{
"text": "<string>",
"index": 123,
"logprobs": 123,
"finish_reason": "<string>"
}
],
"usage": {
"prompt_tokens": 123,
"completion_tokens": 123,
"total_tokens": 123
}
}