Create a new prompt
curl --request POST \
--url https://api.example.com/v1/prompts \
--header 'Content-Type: application/json' \
--data '
{
"prompt": {
"name": "<string>",
"description": "<string>",
"source_prompt_id": "<string>",
"metadata": {}
},
"version": {
"model_name": "<string>",
"template": {
"type": "<string>",
"messages": [
{
"content": "<string>"
}
]
},
"invocation_parameters": {
"type": "<string>",
"openai": {
"temperature": 123,
"max_tokens": 123,
"max_completion_tokens": 123,
"frequency_penalty": 123,
"presence_penalty": 123,
"top_p": 123,
"seed": 123,
"stop": [
"<string>"
],
"extra_body": {}
}
},
"description": "<string>",
"tools": {
"type": "<string>",
"tools": [
{
"type": "<string>",
"function": {
"name": "<string>",
"description": "<string>",
"parameters": {},
"strict": true
}
}
],
"tool_choice": {
"type": "<string>"
},
"disable_parallel_tool_calls": true
},
"response_format": {
"type": "<string>",
"json_schema": {
"name": "<string>",
"description": "<string>",
"schema": {},
"strict": true
}
}
}
}
'import requests
url = "https://api.example.com/v1/prompts"
payload = {
"prompt": {
"name": "<string>",
"description": "<string>",
"source_prompt_id": "<string>",
"metadata": {}
},
"version": {
"model_name": "<string>",
"template": {
"type": "<string>",
"messages": [{ "content": "<string>" }]
},
"invocation_parameters": {
"type": "<string>",
"openai": {
"temperature": 123,
"max_tokens": 123,
"max_completion_tokens": 123,
"frequency_penalty": 123,
"presence_penalty": 123,
"top_p": 123,
"seed": 123,
"stop": ["<string>"],
"extra_body": {}
}
},
"description": "<string>",
"tools": {
"type": "<string>",
"tools": [
{
"type": "<string>",
"function": {
"name": "<string>",
"description": "<string>",
"parameters": {},
"strict": True
}
}
],
"tool_choice": { "type": "<string>" },
"disable_parallel_tool_calls": True
},
"response_format": {
"type": "<string>",
"json_schema": {
"name": "<string>",
"description": "<string>",
"schema": {},
"strict": True
}
}
}
}
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: {
name: '<string>',
description: '<string>',
source_prompt_id: '<string>',
metadata: {}
},
version: {
model_name: '<string>',
template: {type: '<string>', messages: [{content: '<string>'}]},
invocation_parameters: {
type: '<string>',
openai: {
temperature: 123,
max_tokens: 123,
max_completion_tokens: 123,
frequency_penalty: 123,
presence_penalty: 123,
top_p: 123,
seed: 123,
stop: ['<string>'],
extra_body: {}
}
},
description: '<string>',
tools: {
type: '<string>',
tools: [
{
type: '<string>',
function: {name: '<string>', description: '<string>', parameters: {}, strict: true}
}
],
tool_choice: {type: '<string>'},
disable_parallel_tool_calls: true
},
response_format: {
type: '<string>',
json_schema: {name: '<string>', description: '<string>', schema: {}, strict: true}
}
}
})
};
fetch('https://api.example.com/v1/prompts', 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.example.com/v1/prompts",
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' => [
'name' => '<string>',
'description' => '<string>',
'source_prompt_id' => '<string>',
'metadata' => [
]
],
'version' => [
'model_name' => '<string>',
'template' => [
'type' => '<string>',
'messages' => [
[
'content' => '<string>'
]
]
],
'invocation_parameters' => [
'type' => '<string>',
'openai' => [
'temperature' => 123,
'max_tokens' => 123,
'max_completion_tokens' => 123,
'frequency_penalty' => 123,
'presence_penalty' => 123,
'top_p' => 123,
'seed' => 123,
'stop' => [
'<string>'
],
'extra_body' => [
]
]
],
'description' => '<string>',
'tools' => [
'type' => '<string>',
'tools' => [
[
'type' => '<string>',
'function' => [
'name' => '<string>',
'description' => '<string>',
'parameters' => [
],
'strict' => true
]
]
],
'tool_choice' => [
'type' => '<string>'
],
'disable_parallel_tool_calls' => true
],
'response_format' => [
'type' => '<string>',
'json_schema' => [
'name' => '<string>',
'description' => '<string>',
'schema' => [
],
'strict' => true
]
]
]
]),
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.example.com/v1/prompts"
payload := strings.NewReader("{\n \"prompt\": {\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"source_prompt_id\": \"<string>\",\n \"metadata\": {}\n },\n \"version\": {\n \"model_name\": \"<string>\",\n \"template\": {\n \"type\": \"<string>\",\n \"messages\": [\n {\n \"content\": \"<string>\"\n }\n ]\n },\n \"invocation_parameters\": {\n \"type\": \"<string>\",\n \"openai\": {\n \"temperature\": 123,\n \"max_tokens\": 123,\n \"max_completion_tokens\": 123,\n \"frequency_penalty\": 123,\n \"presence_penalty\": 123,\n \"top_p\": 123,\n \"seed\": 123,\n \"stop\": [\n \"<string>\"\n ],\n \"extra_body\": {}\n }\n },\n \"description\": \"<string>\",\n \"tools\": {\n \"type\": \"<string>\",\n \"tools\": [\n {\n \"type\": \"<string>\",\n \"function\": {\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"parameters\": {},\n \"strict\": true\n }\n }\n ],\n \"tool_choice\": {\n \"type\": \"<string>\"\n },\n \"disable_parallel_tool_calls\": true\n },\n \"response_format\": {\n \"type\": \"<string>\",\n \"json_schema\": {\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"schema\": {},\n \"strict\": true\n }\n }\n }\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.example.com/v1/prompts")
.header("Content-Type", "application/json")
.body("{\n \"prompt\": {\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"source_prompt_id\": \"<string>\",\n \"metadata\": {}\n },\n \"version\": {\n \"model_name\": \"<string>\",\n \"template\": {\n \"type\": \"<string>\",\n \"messages\": [\n {\n \"content\": \"<string>\"\n }\n ]\n },\n \"invocation_parameters\": {\n \"type\": \"<string>\",\n \"openai\": {\n \"temperature\": 123,\n \"max_tokens\": 123,\n \"max_completion_tokens\": 123,\n \"frequency_penalty\": 123,\n \"presence_penalty\": 123,\n \"top_p\": 123,\n \"seed\": 123,\n \"stop\": [\n \"<string>\"\n ],\n \"extra_body\": {}\n }\n },\n \"description\": \"<string>\",\n \"tools\": {\n \"type\": \"<string>\",\n \"tools\": [\n {\n \"type\": \"<string>\",\n \"function\": {\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"parameters\": {},\n \"strict\": true\n }\n }\n ],\n \"tool_choice\": {\n \"type\": \"<string>\"\n },\n \"disable_parallel_tool_calls\": true\n },\n \"response_format\": {\n \"type\": \"<string>\",\n \"json_schema\": {\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"schema\": {},\n \"strict\": true\n }\n }\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/v1/prompts")
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\": {\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"source_prompt_id\": \"<string>\",\n \"metadata\": {}\n },\n \"version\": {\n \"model_name\": \"<string>\",\n \"template\": {\n \"type\": \"<string>\",\n \"messages\": [\n {\n \"content\": \"<string>\"\n }\n ]\n },\n \"invocation_parameters\": {\n \"type\": \"<string>\",\n \"openai\": {\n \"temperature\": 123,\n \"max_tokens\": 123,\n \"max_completion_tokens\": 123,\n \"frequency_penalty\": 123,\n \"presence_penalty\": 123,\n \"top_p\": 123,\n \"seed\": 123,\n \"stop\": [\n \"<string>\"\n ],\n \"extra_body\": {}\n }\n },\n \"description\": \"<string>\",\n \"tools\": {\n \"type\": \"<string>\",\n \"tools\": [\n {\n \"type\": \"<string>\",\n \"function\": {\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"parameters\": {},\n \"strict\": true\n }\n }\n ],\n \"tool_choice\": {\n \"type\": \"<string>\"\n },\n \"disable_parallel_tool_calls\": true\n },\n \"response_format\": {\n \"type\": \"<string>\",\n \"json_schema\": {\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"schema\": {},\n \"strict\": true\n }\n }\n }\n}"
response = http.request(request)
puts response.read_body{
"data": {
"model_name": "<string>",
"template": {
"type": "<string>",
"messages": [
{
"content": "<string>"
}
]
},
"invocation_parameters": {
"type": "<string>",
"openai": {
"temperature": 123,
"max_tokens": 123,
"max_completion_tokens": 123,
"frequency_penalty": 123,
"presence_penalty": 123,
"top_p": 123,
"seed": 123,
"stop": [
"<string>"
],
"extra_body": {}
}
},
"id": "<string>",
"description": "<string>",
"tools": {
"type": "<string>",
"tools": [
{
"type": "<string>",
"function": {
"name": "<string>",
"description": "<string>",
"parameters": {},
"strict": true
}
}
],
"tool_choice": {
"type": "<string>"
},
"disable_parallel_tool_calls": true
},
"response_format": {
"type": "<string>",
"json_schema": {
"name": "<string>",
"description": "<string>",
"schema": {},
"strict": true
}
}
}
}"<string>""<string>"Prompts
Create a new prompt
Create a new prompt and its initial version. A prompt can have multiple versions.
POST
/
v1
/
prompts
Create a new prompt
curl --request POST \
--url https://api.example.com/v1/prompts \
--header 'Content-Type: application/json' \
--data '
{
"prompt": {
"name": "<string>",
"description": "<string>",
"source_prompt_id": "<string>",
"metadata": {}
},
"version": {
"model_name": "<string>",
"template": {
"type": "<string>",
"messages": [
{
"content": "<string>"
}
]
},
"invocation_parameters": {
"type": "<string>",
"openai": {
"temperature": 123,
"max_tokens": 123,
"max_completion_tokens": 123,
"frequency_penalty": 123,
"presence_penalty": 123,
"top_p": 123,
"seed": 123,
"stop": [
"<string>"
],
"extra_body": {}
}
},
"description": "<string>",
"tools": {
"type": "<string>",
"tools": [
{
"type": "<string>",
"function": {
"name": "<string>",
"description": "<string>",
"parameters": {},
"strict": true
}
}
],
"tool_choice": {
"type": "<string>"
},
"disable_parallel_tool_calls": true
},
"response_format": {
"type": "<string>",
"json_schema": {
"name": "<string>",
"description": "<string>",
"schema": {},
"strict": true
}
}
}
}
'import requests
url = "https://api.example.com/v1/prompts"
payload = {
"prompt": {
"name": "<string>",
"description": "<string>",
"source_prompt_id": "<string>",
"metadata": {}
},
"version": {
"model_name": "<string>",
"template": {
"type": "<string>",
"messages": [{ "content": "<string>" }]
},
"invocation_parameters": {
"type": "<string>",
"openai": {
"temperature": 123,
"max_tokens": 123,
"max_completion_tokens": 123,
"frequency_penalty": 123,
"presence_penalty": 123,
"top_p": 123,
"seed": 123,
"stop": ["<string>"],
"extra_body": {}
}
},
"description": "<string>",
"tools": {
"type": "<string>",
"tools": [
{
"type": "<string>",
"function": {
"name": "<string>",
"description": "<string>",
"parameters": {},
"strict": True
}
}
],
"tool_choice": { "type": "<string>" },
"disable_parallel_tool_calls": True
},
"response_format": {
"type": "<string>",
"json_schema": {
"name": "<string>",
"description": "<string>",
"schema": {},
"strict": True
}
}
}
}
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: {
name: '<string>',
description: '<string>',
source_prompt_id: '<string>',
metadata: {}
},
version: {
model_name: '<string>',
template: {type: '<string>', messages: [{content: '<string>'}]},
invocation_parameters: {
type: '<string>',
openai: {
temperature: 123,
max_tokens: 123,
max_completion_tokens: 123,
frequency_penalty: 123,
presence_penalty: 123,
top_p: 123,
seed: 123,
stop: ['<string>'],
extra_body: {}
}
},
description: '<string>',
tools: {
type: '<string>',
tools: [
{
type: '<string>',
function: {name: '<string>', description: '<string>', parameters: {}, strict: true}
}
],
tool_choice: {type: '<string>'},
disable_parallel_tool_calls: true
},
response_format: {
type: '<string>',
json_schema: {name: '<string>', description: '<string>', schema: {}, strict: true}
}
}
})
};
fetch('https://api.example.com/v1/prompts', 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.example.com/v1/prompts",
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' => [
'name' => '<string>',
'description' => '<string>',
'source_prompt_id' => '<string>',
'metadata' => [
]
],
'version' => [
'model_name' => '<string>',
'template' => [
'type' => '<string>',
'messages' => [
[
'content' => '<string>'
]
]
],
'invocation_parameters' => [
'type' => '<string>',
'openai' => [
'temperature' => 123,
'max_tokens' => 123,
'max_completion_tokens' => 123,
'frequency_penalty' => 123,
'presence_penalty' => 123,
'top_p' => 123,
'seed' => 123,
'stop' => [
'<string>'
],
'extra_body' => [
]
]
],
'description' => '<string>',
'tools' => [
'type' => '<string>',
'tools' => [
[
'type' => '<string>',
'function' => [
'name' => '<string>',
'description' => '<string>',
'parameters' => [
],
'strict' => true
]
]
],
'tool_choice' => [
'type' => '<string>'
],
'disable_parallel_tool_calls' => true
],
'response_format' => [
'type' => '<string>',
'json_schema' => [
'name' => '<string>',
'description' => '<string>',
'schema' => [
],
'strict' => true
]
]
]
]),
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.example.com/v1/prompts"
payload := strings.NewReader("{\n \"prompt\": {\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"source_prompt_id\": \"<string>\",\n \"metadata\": {}\n },\n \"version\": {\n \"model_name\": \"<string>\",\n \"template\": {\n \"type\": \"<string>\",\n \"messages\": [\n {\n \"content\": \"<string>\"\n }\n ]\n },\n \"invocation_parameters\": {\n \"type\": \"<string>\",\n \"openai\": {\n \"temperature\": 123,\n \"max_tokens\": 123,\n \"max_completion_tokens\": 123,\n \"frequency_penalty\": 123,\n \"presence_penalty\": 123,\n \"top_p\": 123,\n \"seed\": 123,\n \"stop\": [\n \"<string>\"\n ],\n \"extra_body\": {}\n }\n },\n \"description\": \"<string>\",\n \"tools\": {\n \"type\": \"<string>\",\n \"tools\": [\n {\n \"type\": \"<string>\",\n \"function\": {\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"parameters\": {},\n \"strict\": true\n }\n }\n ],\n \"tool_choice\": {\n \"type\": \"<string>\"\n },\n \"disable_parallel_tool_calls\": true\n },\n \"response_format\": {\n \"type\": \"<string>\",\n \"json_schema\": {\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"schema\": {},\n \"strict\": true\n }\n }\n }\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.example.com/v1/prompts")
.header("Content-Type", "application/json")
.body("{\n \"prompt\": {\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"source_prompt_id\": \"<string>\",\n \"metadata\": {}\n },\n \"version\": {\n \"model_name\": \"<string>\",\n \"template\": {\n \"type\": \"<string>\",\n \"messages\": [\n {\n \"content\": \"<string>\"\n }\n ]\n },\n \"invocation_parameters\": {\n \"type\": \"<string>\",\n \"openai\": {\n \"temperature\": 123,\n \"max_tokens\": 123,\n \"max_completion_tokens\": 123,\n \"frequency_penalty\": 123,\n \"presence_penalty\": 123,\n \"top_p\": 123,\n \"seed\": 123,\n \"stop\": [\n \"<string>\"\n ],\n \"extra_body\": {}\n }\n },\n \"description\": \"<string>\",\n \"tools\": {\n \"type\": \"<string>\",\n \"tools\": [\n {\n \"type\": \"<string>\",\n \"function\": {\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"parameters\": {},\n \"strict\": true\n }\n }\n ],\n \"tool_choice\": {\n \"type\": \"<string>\"\n },\n \"disable_parallel_tool_calls\": true\n },\n \"response_format\": {\n \"type\": \"<string>\",\n \"json_schema\": {\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"schema\": {},\n \"strict\": true\n }\n }\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/v1/prompts")
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\": {\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"source_prompt_id\": \"<string>\",\n \"metadata\": {}\n },\n \"version\": {\n \"model_name\": \"<string>\",\n \"template\": {\n \"type\": \"<string>\",\n \"messages\": [\n {\n \"content\": \"<string>\"\n }\n ]\n },\n \"invocation_parameters\": {\n \"type\": \"<string>\",\n \"openai\": {\n \"temperature\": 123,\n \"max_tokens\": 123,\n \"max_completion_tokens\": 123,\n \"frequency_penalty\": 123,\n \"presence_penalty\": 123,\n \"top_p\": 123,\n \"seed\": 123,\n \"stop\": [\n \"<string>\"\n ],\n \"extra_body\": {}\n }\n },\n \"description\": \"<string>\",\n \"tools\": {\n \"type\": \"<string>\",\n \"tools\": [\n {\n \"type\": \"<string>\",\n \"function\": {\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"parameters\": {},\n \"strict\": true\n }\n }\n ],\n \"tool_choice\": {\n \"type\": \"<string>\"\n },\n \"disable_parallel_tool_calls\": true\n },\n \"response_format\": {\n \"type\": \"<string>\",\n \"json_schema\": {\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"schema\": {},\n \"strict\": true\n }\n }\n }\n}"
response = http.request(request)
puts response.read_body{
"data": {
"model_name": "<string>",
"template": {
"type": "<string>",
"messages": [
{
"content": "<string>"
}
]
},
"invocation_parameters": {
"type": "<string>",
"openai": {
"temperature": 123,
"max_tokens": 123,
"max_completion_tokens": 123,
"frequency_penalty": 123,
"presence_penalty": 123,
"top_p": 123,
"seed": 123,
"stop": [
"<string>"
],
"extra_body": {}
}
},
"id": "<string>",
"description": "<string>",
"tools": {
"type": "<string>",
"tools": [
{
"type": "<string>",
"function": {
"name": "<string>",
"description": "<string>",
"parameters": {},
"strict": true
}
}
],
"tool_choice": {
"type": "<string>"
},
"disable_parallel_tool_calls": true
},
"response_format": {
"type": "<string>",
"json_schema": {
"name": "<string>",
"description": "<string>",
"schema": {},
"strict": true
}
}
}
}"<string>""<string>"Was this page helpful?
⌘I

