cURL
curl --request POST \
--url https://api.tela.com/prompt-version \
--header 'Content-Type: application/json' \
--data '
{
"promptId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"title": "<string>",
"configuration": {
"model": "<string>",
"temperature": 123,
"structuredOutput": {
"enabled": true,
"schema": {}
}
},
"variables": [
{
"name": "<string>",
"required": true,
"description": "<string>",
"processingOptions": {
"allowMultimodal": true
}
}
],
"content": "<string>",
"markdownContent": "<string>",
"promoted": true,
"draft": true,
"messages": {
"content": "<string>",
"index": 123
}
}
'import requests
url = "https://api.tela.com/prompt-version"
payload = {
"promptId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"title": "<string>",
"configuration": {
"model": "<string>",
"temperature": 123,
"structuredOutput": {
"enabled": True,
"schema": {}
}
},
"variables": [
{
"name": "<string>",
"required": True,
"description": "<string>",
"processingOptions": { "allowMultimodal": True }
}
],
"content": "<string>",
"markdownContent": "<string>",
"promoted": True,
"draft": True,
"messages": {
"content": "<string>",
"index": 123
}
}
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({
promptId: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
title: '<string>',
configuration: {
model: '<string>',
temperature: 123,
structuredOutput: {enabled: true, schema: {}}
},
variables: [
{
name: '<string>',
required: true,
description: '<string>',
processingOptions: {allowMultimodal: true}
}
],
content: '<string>',
markdownContent: '<string>',
promoted: true,
draft: true,
messages: {content: '<string>', index: 123}
})
};
fetch('https://api.tela.com/prompt-version', 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.tela.com/prompt-version",
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([
'promptId' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'title' => '<string>',
'configuration' => [
'model' => '<string>',
'temperature' => 123,
'structuredOutput' => [
'enabled' => true,
'schema' => [
]
]
],
'variables' => [
[
'name' => '<string>',
'required' => true,
'description' => '<string>',
'processingOptions' => [
'allowMultimodal' => true
]
]
],
'content' => '<string>',
'markdownContent' => '<string>',
'promoted' => true,
'draft' => true,
'messages' => [
'content' => '<string>',
'index' => 123
]
]),
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.tela.com/prompt-version"
payload := strings.NewReader("{\n \"promptId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"title\": \"<string>\",\n \"configuration\": {\n \"model\": \"<string>\",\n \"temperature\": 123,\n \"structuredOutput\": {\n \"enabled\": true,\n \"schema\": {}\n }\n },\n \"variables\": [\n {\n \"name\": \"<string>\",\n \"required\": true,\n \"description\": \"<string>\",\n \"processingOptions\": {\n \"allowMultimodal\": true\n }\n }\n ],\n \"content\": \"<string>\",\n \"markdownContent\": \"<string>\",\n \"promoted\": true,\n \"draft\": true,\n \"messages\": {\n \"content\": \"<string>\",\n \"index\": 123\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.tela.com/prompt-version")
.header("Content-Type", "application/json")
.body("{\n \"promptId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"title\": \"<string>\",\n \"configuration\": {\n \"model\": \"<string>\",\n \"temperature\": 123,\n \"structuredOutput\": {\n \"enabled\": true,\n \"schema\": {}\n }\n },\n \"variables\": [\n {\n \"name\": \"<string>\",\n \"required\": true,\n \"description\": \"<string>\",\n \"processingOptions\": {\n \"allowMultimodal\": true\n }\n }\n ],\n \"content\": \"<string>\",\n \"markdownContent\": \"<string>\",\n \"promoted\": true,\n \"draft\": true,\n \"messages\": {\n \"content\": \"<string>\",\n \"index\": 123\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.tela.com/prompt-version")
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 \"promptId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"title\": \"<string>\",\n \"configuration\": {\n \"model\": \"<string>\",\n \"temperature\": 123,\n \"structuredOutput\": {\n \"enabled\": true,\n \"schema\": {}\n }\n },\n \"variables\": [\n {\n \"name\": \"<string>\",\n \"required\": true,\n \"description\": \"<string>\",\n \"processingOptions\": {\n \"allowMultimodal\": true\n }\n }\n ],\n \"content\": \"<string>\",\n \"markdownContent\": \"<string>\",\n \"promoted\": true,\n \"draft\": true,\n \"messages\": {\n \"content\": \"<string>\",\n \"index\": 123\n }\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"promptId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"title": "<string>",
"configuration": {
"model": "<string>",
"type": "chat",
"temperature": 123,
"structuredOutput": {
"enabled": true,
"schema": {}
}
},
"variables": [
{
"name": "<string>",
"type": "file",
"required": true,
"description": "<string>",
"processingOptions": {
"allowMultimodal": true
}
}
],
"content": "<string>",
"markdownContent": "<string>",
"promoted": true,
"draft": true,
"messages": {
"role": "user",
"content": "<string>",
"index": 123
},
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z"
}Versions
Create Prompt Version
Creates a new version of a prompt
POST
/
prompt-version
cURL
curl --request POST \
--url https://api.tela.com/prompt-version \
--header 'Content-Type: application/json' \
--data '
{
"promptId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"title": "<string>",
"configuration": {
"model": "<string>",
"temperature": 123,
"structuredOutput": {
"enabled": true,
"schema": {}
}
},
"variables": [
{
"name": "<string>",
"required": true,
"description": "<string>",
"processingOptions": {
"allowMultimodal": true
}
}
],
"content": "<string>",
"markdownContent": "<string>",
"promoted": true,
"draft": true,
"messages": {
"content": "<string>",
"index": 123
}
}
'import requests
url = "https://api.tela.com/prompt-version"
payload = {
"promptId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"title": "<string>",
"configuration": {
"model": "<string>",
"temperature": 123,
"structuredOutput": {
"enabled": True,
"schema": {}
}
},
"variables": [
{
"name": "<string>",
"required": True,
"description": "<string>",
"processingOptions": { "allowMultimodal": True }
}
],
"content": "<string>",
"markdownContent": "<string>",
"promoted": True,
"draft": True,
"messages": {
"content": "<string>",
"index": 123
}
}
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({
promptId: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
title: '<string>',
configuration: {
model: '<string>',
temperature: 123,
structuredOutput: {enabled: true, schema: {}}
},
variables: [
{
name: '<string>',
required: true,
description: '<string>',
processingOptions: {allowMultimodal: true}
}
],
content: '<string>',
markdownContent: '<string>',
promoted: true,
draft: true,
messages: {content: '<string>', index: 123}
})
};
fetch('https://api.tela.com/prompt-version', 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.tela.com/prompt-version",
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([
'promptId' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'title' => '<string>',
'configuration' => [
'model' => '<string>',
'temperature' => 123,
'structuredOutput' => [
'enabled' => true,
'schema' => [
]
]
],
'variables' => [
[
'name' => '<string>',
'required' => true,
'description' => '<string>',
'processingOptions' => [
'allowMultimodal' => true
]
]
],
'content' => '<string>',
'markdownContent' => '<string>',
'promoted' => true,
'draft' => true,
'messages' => [
'content' => '<string>',
'index' => 123
]
]),
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.tela.com/prompt-version"
payload := strings.NewReader("{\n \"promptId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"title\": \"<string>\",\n \"configuration\": {\n \"model\": \"<string>\",\n \"temperature\": 123,\n \"structuredOutput\": {\n \"enabled\": true,\n \"schema\": {}\n }\n },\n \"variables\": [\n {\n \"name\": \"<string>\",\n \"required\": true,\n \"description\": \"<string>\",\n \"processingOptions\": {\n \"allowMultimodal\": true\n }\n }\n ],\n \"content\": \"<string>\",\n \"markdownContent\": \"<string>\",\n \"promoted\": true,\n \"draft\": true,\n \"messages\": {\n \"content\": \"<string>\",\n \"index\": 123\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.tela.com/prompt-version")
.header("Content-Type", "application/json")
.body("{\n \"promptId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"title\": \"<string>\",\n \"configuration\": {\n \"model\": \"<string>\",\n \"temperature\": 123,\n \"structuredOutput\": {\n \"enabled\": true,\n \"schema\": {}\n }\n },\n \"variables\": [\n {\n \"name\": \"<string>\",\n \"required\": true,\n \"description\": \"<string>\",\n \"processingOptions\": {\n \"allowMultimodal\": true\n }\n }\n ],\n \"content\": \"<string>\",\n \"markdownContent\": \"<string>\",\n \"promoted\": true,\n \"draft\": true,\n \"messages\": {\n \"content\": \"<string>\",\n \"index\": 123\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.tela.com/prompt-version")
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 \"promptId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"title\": \"<string>\",\n \"configuration\": {\n \"model\": \"<string>\",\n \"temperature\": 123,\n \"structuredOutput\": {\n \"enabled\": true,\n \"schema\": {}\n }\n },\n \"variables\": [\n {\n \"name\": \"<string>\",\n \"required\": true,\n \"description\": \"<string>\",\n \"processingOptions\": {\n \"allowMultimodal\": true\n }\n }\n ],\n \"content\": \"<string>\",\n \"markdownContent\": \"<string>\",\n \"promoted\": true,\n \"draft\": true,\n \"messages\": {\n \"content\": \"<string>\",\n \"index\": 123\n }\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"promptId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"title": "<string>",
"configuration": {
"model": "<string>",
"type": "chat",
"temperature": 123,
"structuredOutput": {
"enabled": true,
"schema": {}
}
},
"variables": [
{
"name": "<string>",
"type": "file",
"required": true,
"description": "<string>",
"processingOptions": {
"allowMultimodal": true
}
}
],
"content": "<string>",
"markdownContent": "<string>",
"promoted": true,
"draft": true,
"messages": {
"role": "user",
"content": "<string>",
"index": 123
},
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z"
}Create a Prompt Version
This endpoint creates a new version of a prompt with the specified configuration, variables, and content.Request Body
The request body must include the following fields:| Parameter | Type | Description |
|---|---|---|
promptId | string (UUID) | The ID of the prompt to create a version for |
title | string | The title of the prompt version (max 256 characters) |
configuration | object | Configuration settings for the prompt version |
variables | array | An array of variable objects used in the prompt |
Optional Fields
| Parameter | Type | Description |
|---|---|---|
content | string | Plain text content of the prompt |
markdownContent | string | Markdown content of the prompt |
promoted | boolean | Whether this version is promoted |
draft | boolean | Whether this version is a draft |
messages | array/object | Messages for chat-type prompts |
Examples
const promptVersion = {
promptId: 'prompt_uuid',
title: 'Document Analysis v2',
configuration: {
model: 'claude-3-opus-20240229',
temperature: 0.7,
type: 'chat'
},
variables: [
{
name: 'document',
type: 'file',
required: true,
description: 'The document to analyze'
},
{
name: 'query',
type: 'text',
required: true,
description: 'The specific question about the document'
}
],
markdownContent: '# Document Analysis\n\nAnalyze the document and answer questions about it.',
draft: true
}
const response = await fetch('https://api.tela.ai/prompt-version', {
method: 'POST',
headers: {
'Authorization': `Bearer ${process.env.TELA_API_KEY}`,
'Content-Type': 'application/json'
},
body: JSON.stringify(promptVersion)
})
const result = await response.json()
console.log(result)
const promptVersion = {
promptId: 'prompt_uuid',
title: 'Document Analysis v2',
configuration: {
model: 'claude-3-opus-20240229',
temperature: 0.7,
type: 'chat'
},
variables: [
{
name: 'document',
type: 'file',
required: true,
description: 'The document to analyze'
},
{
name: 'query',
type: 'text',
required: true,
description: 'The specific question about the document'
}
],
markdownContent: '# Document Analysis\n\nAnalyze the document and answer questions about it.',
draft: true
}
const response = await fetch('https://api.tela.ai/prompt-version', {
method: 'POST',
headers: {
'Authorization': `Bearer ${process.env.TELA_API_KEY}`,
'Content-Type': 'application/json'
},
body: JSON.stringify(promptVersion)
})
const result = await response.json()
console.log(result)
import requests
import os
api_key = os.getenv("TELA_API_KEY")
prompt_version = {
"promptId": "prompt_uuid",
"title": "Document Analysis v2",
"configuration": {
"model": "claude-3-opus-20240229",
"temperature": 0.7,
"type": "chat"
},
"variables": [
{
"name": "document",
"type": "file",
"required": True,
"description": "The document to analyze"
},
{
"name": "query",
"type": "text",
"required": True,
"description": "The specific question about the document"
}
],
"markdownContent": "# Document Analysis\n\nAnalyze the document and answer questions about it.",
"draft": True
}
headers = {
"Authorization": f"Bearer {api_key}",
"Content-Type": "application/json"
}
response = requests.post("https://api.tela.ai/prompt-version", json=prompt_version, headers=headers)
result = response.json()
print(result)
Response
The response includes the created prompt version object with its assigned ID and other details.{
"id": "version_uuid",
"promptId": "prompt_uuid",
"title": "Document Analysis v2",
"markdownContent": "# Document Analysis\n\nAnalyze the document and answer questions about it.",
"configuration": {
"model": "claude-3-opus-20240229",
"temperature": 0.7,
"type": "chat"
},
"variables": [
{
"name": "document",
"type": "file",
"required": true,
"description": "The document to analyze"
},
{
"name": "query",
"type": "text",
"required": true,
"description": "The specific question about the document"
}
],
"draft": true,
"promoted": false,
"createdAt": "2024-04-15T12:00:00.000Z",
"updatedAt": "2024-04-15T12:00:00.000Z"
}
Structured Output Example
const promptVersionWithStructuredOutput = {
promptId: 'prompt_uuid',
title: 'Document Analysis with Structured Output',
configuration: {
model: 'claude-3-opus-20240229',
temperature: 0.7,
type: 'chat',
structuredOutput: {
enabled: true,
schema: {
type: "object",
title: "DocumentAnalysis",
description: "Analysis of a document",
properties: {
summary: {
type: "string",
description: "Brief summary of the document"
},
keyInsights: {
type: "array",
items: {
type: "string"
},
description: "Key insights from the document"
},
sentiment: {
type: "string",
enum: ["positive", "neutral", "negative"],
description: "Overall sentiment of the document"
}
},
required: ["summary", "keyInsights", "sentiment"]
}
}
},
variables: [
{
name: 'document',
type: 'file',
required: true,
description: 'The document to analyze'
}
]
}
const response = await fetch('https://api.tela.ai/prompt-version', {
method: 'POST',
headers: {
'Authorization': `Bearer ${process.env.TELA_API_KEY}`,
'Content-Type': 'application/json'
},
body: JSON.stringify(promptVersionWithStructuredOutput)
})
const result = await response.json()
console.log(result)
const promptVersionWithStructuredOutput = {
promptId: 'prompt_uuid',
title: 'Document Analysis with Structured Output',
configuration: {
model: 'claude-3-opus-20240229',
temperature: 0.7,
type: 'chat',
structuredOutput: {
enabled: true,
schema: {
type: "object",
title: "DocumentAnalysis",
description: "Analysis of a document",
properties: {
summary: {
type: "string",
description: "Brief summary of the document"
},
keyInsights: {
type: "array",
items: {
type: "string"
},
description: "Key insights from the document"
},
sentiment: {
type: "string",
enum: ["positive", "neutral", "negative"],
description: "Overall sentiment of the document"
}
},
required: ["summary", "keyInsights", "sentiment"]
}
}
},
variables: [
{
name: 'document',
type: 'file',
required: true,
description: 'The document to analyze'
}
]
}
const response = await fetch('https://api.tela.ai/prompt-version', {
method: 'POST',
headers: {
'Authorization': `Bearer ${process.env.TELA_API_KEY}`,
'Content-Type': 'application/json'
},
body: JSON.stringify(promptVersionWithStructuredOutput)
})
const result = await response.json()
console.log(result)
import requests
import os
api_key = os.getenv("TELA_API_KEY")
prompt_version_with_structured_output = {
"promptId": "prompt_uuid",
"title": "Document Analysis with Structured Output",
"configuration": {
"model": "claude-3-opus-20240229",
"temperature": 0.7,
"type": "chat",
"structuredOutput": {
"enabled": True,
"schema": {
"type": "object",
"title": "DocumentAnalysis",
"description": "Analysis of a document",
"properties": {
"summary": {
"type": "string",
"description": "Brief summary of the document"
},
"keyInsights": {
"type": "array",
"items": {
"type": "string"
},
"description": "Key insights from the document"
},
"sentiment": {
"type": "string",
"enum": ["positive", "neutral", "negative"],
"description": "Overall sentiment of the document"
}
},
"required": ["summary", "keyInsights", "sentiment"]
}
}
},
"variables": [
{
"name": "document",
"type": "file",
"required": True,
"description": "The document to analyze"
}
]
}
headers = {
"Authorization": f"Bearer {api_key}",
"Content-Type": "application/json"
}
response = requests.post("https://api.tela.ai/prompt-version", json=prompt_version_with_structured_output, headers=headers)
result = response.json()
print(result)
Body
application/json
Response
200 - application/json
Prompt version created successfully