curl --request GET \
--url https://app.langtrace.ai/api/promptset?promptsetid=clw123ay10001v55p02lo1lmp&variables.name=langtrace&variables.org=chatbot \
--header 'x-api-key: 5b4077b5068e79e9b2742fc65afa03327210c4c6f54d213b09f25b516d07ee9f'
import requests
url = "https://app.langtrace.ai/api/promptset"
params = {
"promptsetid": "clw123ay10001v55p02lo1lmp",
"variables.name": "langtrace",
"variables.org": "chatbot"
}
headers = {
"x-api-key": "5b4077b5068e79e9b2742fc65afa03327210c4c6f54d213b09f25b516d07ee9f"
}
response = requests.get(url, headers=headers, params=params)
print(response.text)
const url = "https://app.langtrace.ai/api/promptset";
const params = new URLSearchParams({
promptsetid: "clw123ay10001v55p02lo1lmp",
"variables.name": "langtrace",
"variables.org": "chatbot"
});
const headers = {
"x-api-key": "5b4077b5068e79e9b2742fc65afa03327210c4c6f54d213b09f25b516d07ee9f"
};
fetch(`${url}?${params}`, {
method: 'GET',
headers: headers
})
.then(response => response.json())
.then(data => console.log(data))
.catch(error => console.error('Error:', error));
<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://app.langtrace.ai/api/promptset?promptsetid=clw123ay10001v55p02lo1lmp&variables.name=langtrace&variables.org=chatbot",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"x-api-key: 5b4077b5068e79e9b2742fc65afa03327210c4c6f54d213b09f25b516d07ee9f"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
?>
package main
import (
"fmt"
"io/ioutil"
"net/http"
)
func main() {
url := "https://app.langtrace.ai/api/promptset?promptsetid=clw123ay10001v55p02lo1lmp&variables.name=langtrace&variables.org=chatbot"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("x-api-key", "5b4077b5068e79e9b2742fc65afa03327210c4c6f54d213b09f25b516d07ee9f")
client := &http.Client{}
resp, err := client.Do(req)
if err != nil {
fmt.Println("Error:", err)
return
}
defer resp.Body.Close()
body, err := ioutil.ReadAll(resp.Body)
if err != nil {
fmt.Println("Error reading response body:", err)
return
}
fmt.Println(string(body))
}
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.io.IOException;
public class Main {
public static void main(String[] args) {
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://app.langtrace.ai/api/promptset?promptsetid=clw123ay10001v55p02lo1lmp&variables.name=langtrace&variables.org=chatbot"))
.header("x-api-key", "5b4077b5068e79e9b2742fc65afa03327210c4c6f54d213b09f25b516d07ee9f")
.build();
try {
HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
} catch (IOException | InterruptedException e) {
e.printStackTrace();
}
}
}
{
"id": "clw123ay10001v55p02lo1lmp",
"name": "Slack Chatbot ",
"description": "slack chatbot",
"projectId": "clw12223e0001eapng5a66f2u",
"createdAt": "2024-05-10T19:14:20.324Z",
"updatedAt": "2024-05-10T19:14:20.324Z",
"prompts": [
{
"id": "clw129y460001o8cgv2uksm3p",
"value": "You are a slack chatbot for company langtrace and org chatbot",
"variables": [
"name",
"org"
],
"model": "gpt-3.5-turbo",
"modelSettings": {},
"version": 2,
"live": true,
"tags": [],
"spanId": null,
"note": "Slack chatbot prompt testing",
"promptsetId": "clw123ay10001v55p02lo1lmp",
"createdAt": "2024-05-10T19:19:30.293Z",
"updatedAt": "2024-05-10T19:19:30.293Z"
}
]
}
{
"message": "Invalid api key unauthorized",
}
Prompt Registry APIs
GET Prompt from Registry
This endpoint enables queries on the prompt registry. You can query for a specific prompt version or get the currently live prompt. Optionally also pass in variables to fill the prompt value variables with data
curl --request GET \
--url https://app.langtrace.ai/api/promptset?promptsetid=clw123ay10001v55p02lo1lmp&variables.name=langtrace&variables.org=chatbot \
--header 'x-api-key: 5b4077b5068e79e9b2742fc65afa03327210c4c6f54d213b09f25b516d07ee9f'
import requests
url = "https://app.langtrace.ai/api/promptset"
params = {
"promptsetid": "clw123ay10001v55p02lo1lmp",
"variables.name": "langtrace",
"variables.org": "chatbot"
}
headers = {
"x-api-key": "5b4077b5068e79e9b2742fc65afa03327210c4c6f54d213b09f25b516d07ee9f"
}
response = requests.get(url, headers=headers, params=params)
print(response.text)
const url = "https://app.langtrace.ai/api/promptset";
const params = new URLSearchParams({
promptsetid: "clw123ay10001v55p02lo1lmp",
"variables.name": "langtrace",
"variables.org": "chatbot"
});
const headers = {
"x-api-key": "5b4077b5068e79e9b2742fc65afa03327210c4c6f54d213b09f25b516d07ee9f"
};
fetch(`${url}?${params}`, {
method: 'GET',
headers: headers
})
.then(response => response.json())
.then(data => console.log(data))
.catch(error => console.error('Error:', error));
<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://app.langtrace.ai/api/promptset?promptsetid=clw123ay10001v55p02lo1lmp&variables.name=langtrace&variables.org=chatbot",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"x-api-key: 5b4077b5068e79e9b2742fc65afa03327210c4c6f54d213b09f25b516d07ee9f"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
?>
package main
import (
"fmt"
"io/ioutil"
"net/http"
)
func main() {
url := "https://app.langtrace.ai/api/promptset?promptsetid=clw123ay10001v55p02lo1lmp&variables.name=langtrace&variables.org=chatbot"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("x-api-key", "5b4077b5068e79e9b2742fc65afa03327210c4c6f54d213b09f25b516d07ee9f")
client := &http.Client{}
resp, err := client.Do(req)
if err != nil {
fmt.Println("Error:", err)
return
}
defer resp.Body.Close()
body, err := ioutil.ReadAll(resp.Body)
if err != nil {
fmt.Println("Error reading response body:", err)
return
}
fmt.Println(string(body))
}
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.io.IOException;
public class Main {
public static void main(String[] args) {
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://app.langtrace.ai/api/promptset?promptsetid=clw123ay10001v55p02lo1lmp&variables.name=langtrace&variables.org=chatbot"))
.header("x-api-key", "5b4077b5068e79e9b2742fc65afa03327210c4c6f54d213b09f25b516d07ee9f")
.build();
try {
HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
} catch (IOException | InterruptedException e) {
e.printStackTrace();
}
}
}
{
"id": "clw123ay10001v55p02lo1lmp",
"name": "Slack Chatbot ",
"description": "slack chatbot",
"projectId": "clw12223e0001eapng5a66f2u",
"createdAt": "2024-05-10T19:14:20.324Z",
"updatedAt": "2024-05-10T19:14:20.324Z",
"prompts": [
{
"id": "clw129y460001o8cgv2uksm3p",
"value": "You are a slack chatbot for company langtrace and org chatbot",
"variables": [
"name",
"org"
],
"model": "gpt-3.5-turbo",
"modelSettings": {},
"version": 2,
"live": true,
"tags": [],
"spanId": null,
"note": "Slack chatbot prompt testing",
"promptsetId": "clw123ay10001v55p02lo1lmp",
"createdAt": "2024-05-10T19:19:30.293Z",
"updatedAt": "2024-05-10T19:19:30.293Z"
}
]
}
{
"message": "Invalid api key unauthorized",
}
You can find the
promptset_id when you click on Prompts -> <Your_Prompt_Registry> -> Prompt Registry ID If no
version is provided the live prompt in the registry is fetched. If there are no live prompts an error is thrown GET promptset endpoint is provided below.
Variables to replace in the prompt string. Usage is as follows:
variables.<variable_name>=<variable_value>&variables.<variable_name>=<variable_value>…200 (OK) Response Object Schema
200 (OK) Response Object Schema
Show Prompt Object Properties
Show Prompt Object Properties
If this prompt was traced using the langtrace sdk this will contain the id of the span otherwise it will be null
curl --request GET \
--url https://app.langtrace.ai/api/promptset?promptsetid=clw123ay10001v55p02lo1lmp&variables.name=langtrace&variables.org=chatbot \
--header 'x-api-key: 5b4077b5068e79e9b2742fc65afa03327210c4c6f54d213b09f25b516d07ee9f'
import requests
url = "https://app.langtrace.ai/api/promptset"
params = {
"promptsetid": "clw123ay10001v55p02lo1lmp",
"variables.name": "langtrace",
"variables.org": "chatbot"
}
headers = {
"x-api-key": "5b4077b5068e79e9b2742fc65afa03327210c4c6f54d213b09f25b516d07ee9f"
}
response = requests.get(url, headers=headers, params=params)
print(response.text)
const url = "https://app.langtrace.ai/api/promptset";
const params = new URLSearchParams({
promptsetid: "clw123ay10001v55p02lo1lmp",
"variables.name": "langtrace",
"variables.org": "chatbot"
});
const headers = {
"x-api-key": "5b4077b5068e79e9b2742fc65afa03327210c4c6f54d213b09f25b516d07ee9f"
};
fetch(`${url}?${params}`, {
method: 'GET',
headers: headers
})
.then(response => response.json())
.then(data => console.log(data))
.catch(error => console.error('Error:', error));
<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://app.langtrace.ai/api/promptset?promptsetid=clw123ay10001v55p02lo1lmp&variables.name=langtrace&variables.org=chatbot",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"x-api-key: 5b4077b5068e79e9b2742fc65afa03327210c4c6f54d213b09f25b516d07ee9f"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
?>
package main
import (
"fmt"
"io/ioutil"
"net/http"
)
func main() {
url := "https://app.langtrace.ai/api/promptset?promptsetid=clw123ay10001v55p02lo1lmp&variables.name=langtrace&variables.org=chatbot"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("x-api-key", "5b4077b5068e79e9b2742fc65afa03327210c4c6f54d213b09f25b516d07ee9f")
client := &http.Client{}
resp, err := client.Do(req)
if err != nil {
fmt.Println("Error:", err)
return
}
defer resp.Body.Close()
body, err := ioutil.ReadAll(resp.Body)
if err != nil {
fmt.Println("Error reading response body:", err)
return
}
fmt.Println(string(body))
}
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.io.IOException;
public class Main {
public static void main(String[] args) {
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://app.langtrace.ai/api/promptset?promptsetid=clw123ay10001v55p02lo1lmp&variables.name=langtrace&variables.org=chatbot"))
.header("x-api-key", "5b4077b5068e79e9b2742fc65afa03327210c4c6f54d213b09f25b516d07ee9f")
.build();
try {
HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
} catch (IOException | InterruptedException e) {
e.printStackTrace();
}
}
}
{
"id": "clw123ay10001v55p02lo1lmp",
"name": "Slack Chatbot ",
"description": "slack chatbot",
"projectId": "clw12223e0001eapng5a66f2u",
"createdAt": "2024-05-10T19:14:20.324Z",
"updatedAt": "2024-05-10T19:14:20.324Z",
"prompts": [
{
"id": "clw129y460001o8cgv2uksm3p",
"value": "You are a slack chatbot for company langtrace and org chatbot",
"variables": [
"name",
"org"
],
"model": "gpt-3.5-turbo",
"modelSettings": {},
"version": 2,
"live": true,
"tags": [],
"spanId": null,
"note": "Slack chatbot prompt testing",
"promptsetId": "clw123ay10001v55p02lo1lmp",
"createdAt": "2024-05-10T19:19:30.293Z",
"updatedAt": "2024-05-10T19:19:30.293Z"
}
]
}
{
"message": "Invalid api key unauthorized",
}