curl --request POST \
--url https://api.egp.scale.com/v4/models/{model_deployment_id}/completions \
--header 'Content-Type: application/json' \
--data '
{
"prompt": "<string>",
"model_request_parameters": {
"bindings": {}
},
"temperature": 0.2,
"stop_sequences": [
"<string>"
],
"max_tokens": 123,
"top_p": 123,
"top_k": 123,
"frequency_penalty": 123,
"presence_penalty": 123,
"stream": false,
"logprobs": true,
"top_logprobs": 123,
"chat_template": "<string>",
"chat_template_kwargs": {}
}
'import requests
url = "https://api.egp.scale.com/v4/models/{model_deployment_id}/completions"
payload = {
"prompt": "<string>",
"model_request_parameters": { "bindings": {} },
"temperature": 0.2,
"stop_sequences": ["<string>"],
"max_tokens": 123,
"top_p": 123,
"top_k": 123,
"frequency_penalty": 123,
"presence_penalty": 123,
"stream": False,
"logprobs": True,
"top_logprobs": 123,
"chat_template": "<string>",
"chat_template_kwargs": {}
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
prompt: '<string>',
model_request_parameters: {bindings: {}},
temperature: 0.2,
stop_sequences: ['<string>'],
max_tokens: 123,
top_p: 123,
top_k: 123,
frequency_penalty: 123,
presence_penalty: 123,
stream: false,
logprobs: true,
top_logprobs: 123,
chat_template: '<string>',
chat_template_kwargs: {}
})
};
fetch('https://api.egp.scale.com/v4/models/{model_deployment_id}/completions', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.egp.scale.com/v4/models/{model_deployment_id}/completions",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'prompt' => '<string>',
'model_request_parameters' => [
'bindings' => [
]
],
'temperature' => 0.2,
'stop_sequences' => [
'<string>'
],
'max_tokens' => 123,
'top_p' => 123,
'top_k' => 123,
'frequency_penalty' => 123,
'presence_penalty' => 123,
'stream' => false,
'logprobs' => true,
'top_logprobs' => 123,
'chat_template' => '<string>',
'chat_template_kwargs' => [
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.egp.scale.com/v4/models/{model_deployment_id}/completions"
payload := strings.NewReader("{\n \"prompt\": \"<string>\",\n \"model_request_parameters\": {\n \"bindings\": {}\n },\n \"temperature\": 0.2,\n \"stop_sequences\": [\n \"<string>\"\n ],\n \"max_tokens\": 123,\n \"top_p\": 123,\n \"top_k\": 123,\n \"frequency_penalty\": 123,\n \"presence_penalty\": 123,\n \"stream\": false,\n \"logprobs\": true,\n \"top_logprobs\": 123,\n \"chat_template\": \"<string>\",\n \"chat_template_kwargs\": {}\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.egp.scale.com/v4/models/{model_deployment_id}/completions")
.header("Content-Type", "application/json")
.body("{\n \"prompt\": \"<string>\",\n \"model_request_parameters\": {\n \"bindings\": {}\n },\n \"temperature\": 0.2,\n \"stop_sequences\": [\n \"<string>\"\n ],\n \"max_tokens\": 123,\n \"top_p\": 123,\n \"top_k\": 123,\n \"frequency_penalty\": 123,\n \"presence_penalty\": 123,\n \"stream\": false,\n \"logprobs\": true,\n \"top_logprobs\": 123,\n \"chat_template\": \"<string>\",\n \"chat_template_kwargs\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.egp.scale.com/v4/models/{model_deployment_id}/completions")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"prompt\": \"<string>\",\n \"model_request_parameters\": {\n \"bindings\": {}\n },\n \"temperature\": 0.2,\n \"stop_sequences\": [\n \"<string>\"\n ],\n \"max_tokens\": 123,\n \"top_p\": 123,\n \"top_k\": 123,\n \"frequency_penalty\": 123,\n \"presence_penalty\": 123,\n \"stream\": false,\n \"logprobs\": true,\n \"top_logprobs\": 123,\n \"chat_template\": \"<string>\",\n \"chat_template_kwargs\": {}\n}"
response = http.request(request)
puts response.read_body{
"completions": [
[
"<string>",
[
"<string>"
]
]
],
"finish_reason": "<string>",
"prompt_tokens": 0,
"response_tokens": 0,
"choices": [
{
"index": 123,
"logprobs": {
"content": [
{
"token": "<string>",
"logprob": 123,
"top_logprobs": [
{
"token": "<string>",
"logprob": 123,
"bytes": [
123
]
}
],
"bytes": [
123
]
}
]
}
}
]
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}Generate completion
Description
Interact with the LLM model using the specified model_deployment_id. The LLM model will generate a text completion based on the provided prompt.
{
"prompt": "What is the capital of France?"
}
curl --request POST \
--url https://api.egp.scale.com/v4/models/{model_deployment_id}/completions \
--header 'Content-Type: application/json' \
--data '
{
"prompt": "<string>",
"model_request_parameters": {
"bindings": {}
},
"temperature": 0.2,
"stop_sequences": [
"<string>"
],
"max_tokens": 123,
"top_p": 123,
"top_k": 123,
"frequency_penalty": 123,
"presence_penalty": 123,
"stream": false,
"logprobs": true,
"top_logprobs": 123,
"chat_template": "<string>",
"chat_template_kwargs": {}
}
'import requests
url = "https://api.egp.scale.com/v4/models/{model_deployment_id}/completions"
payload = {
"prompt": "<string>",
"model_request_parameters": { "bindings": {} },
"temperature": 0.2,
"stop_sequences": ["<string>"],
"max_tokens": 123,
"top_p": 123,
"top_k": 123,
"frequency_penalty": 123,
"presence_penalty": 123,
"stream": False,
"logprobs": True,
"top_logprobs": 123,
"chat_template": "<string>",
"chat_template_kwargs": {}
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
prompt: '<string>',
model_request_parameters: {bindings: {}},
temperature: 0.2,
stop_sequences: ['<string>'],
max_tokens: 123,
top_p: 123,
top_k: 123,
frequency_penalty: 123,
presence_penalty: 123,
stream: false,
logprobs: true,
top_logprobs: 123,
chat_template: '<string>',
chat_template_kwargs: {}
})
};
fetch('https://api.egp.scale.com/v4/models/{model_deployment_id}/completions', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.egp.scale.com/v4/models/{model_deployment_id}/completions",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'prompt' => '<string>',
'model_request_parameters' => [
'bindings' => [
]
],
'temperature' => 0.2,
'stop_sequences' => [
'<string>'
],
'max_tokens' => 123,
'top_p' => 123,
'top_k' => 123,
'frequency_penalty' => 123,
'presence_penalty' => 123,
'stream' => false,
'logprobs' => true,
'top_logprobs' => 123,
'chat_template' => '<string>',
'chat_template_kwargs' => [
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.egp.scale.com/v4/models/{model_deployment_id}/completions"
payload := strings.NewReader("{\n \"prompt\": \"<string>\",\n \"model_request_parameters\": {\n \"bindings\": {}\n },\n \"temperature\": 0.2,\n \"stop_sequences\": [\n \"<string>\"\n ],\n \"max_tokens\": 123,\n \"top_p\": 123,\n \"top_k\": 123,\n \"frequency_penalty\": 123,\n \"presence_penalty\": 123,\n \"stream\": false,\n \"logprobs\": true,\n \"top_logprobs\": 123,\n \"chat_template\": \"<string>\",\n \"chat_template_kwargs\": {}\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.egp.scale.com/v4/models/{model_deployment_id}/completions")
.header("Content-Type", "application/json")
.body("{\n \"prompt\": \"<string>\",\n \"model_request_parameters\": {\n \"bindings\": {}\n },\n \"temperature\": 0.2,\n \"stop_sequences\": [\n \"<string>\"\n ],\n \"max_tokens\": 123,\n \"top_p\": 123,\n \"top_k\": 123,\n \"frequency_penalty\": 123,\n \"presence_penalty\": 123,\n \"stream\": false,\n \"logprobs\": true,\n \"top_logprobs\": 123,\n \"chat_template\": \"<string>\",\n \"chat_template_kwargs\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.egp.scale.com/v4/models/{model_deployment_id}/completions")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"prompt\": \"<string>\",\n \"model_request_parameters\": {\n \"bindings\": {}\n },\n \"temperature\": 0.2,\n \"stop_sequences\": [\n \"<string>\"\n ],\n \"max_tokens\": 123,\n \"top_p\": 123,\n \"top_k\": 123,\n \"frequency_penalty\": 123,\n \"presence_penalty\": 123,\n \"stream\": false,\n \"logprobs\": true,\n \"top_logprobs\": 123,\n \"chat_template\": \"<string>\",\n \"chat_template_kwargs\": {}\n}"
response = http.request(request)
puts response.read_body{
"completions": [
[
"<string>",
[
"<string>"
]
]
],
"finish_reason": "<string>",
"prompt_tokens": 0,
"response_tokens": 0,
"choices": [
{
"index": 123,
"logprobs": {
"content": [
{
"token": "<string>",
"logprob": 123,
"top_logprobs": [
{
"token": "<string>",
"logprob": 123,
"bytes": [
123
]
}
],
"bytes": [
123
]
}
]
}
}
]
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}Body
What sampling temperature to use, between [0, 2]. Higher values like 1.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. Setting temperature=0.0 will enable fully deterministic (greedy) sampling.NOTE: The temperature parameter range for some model is limited to [0, 1] if the given value is above the available range, it defaults to the max value. Temperature is ignored for OpenAI reasoning models.
0 <= x <= 2The maximum number of tokens to generate in the completion. The token count of your prompt plus max_tokens cannot exceed the model's context length. If not, specified, max_tokens will be determined based on the model used:
| Model API family | Model API default | EGP applied default |
|---|---|---|
| OpenAI Completions | 16 | context window - prompt size |
| OpenAI Chat Completions | context window - prompt size | context window - prompt size |
| LLM Engine | max_new_tokens parameter is required | 100 |
| Anthropic Claude 2 | max_tokens_to_sample parameter is required | 10000 |