Create Dataset from History
curl --request POST \
--url https://api.promptlayer.com/dataset-from-filter-params \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"workspace_id": 123,
"q": "<string>",
"start_time": "<string>",
"end_time": "<string>",
"tags": [
{}
],
"metadata": [
{}
],
"scores": [
{}
],
"starred": true,
"prompt_template": {},
"limit": 123
}
'import requests
url = "https://api.promptlayer.com/dataset-from-filter-params"
payload = {
"name": "<string>",
"workspace_id": 123,
"q": "<string>",
"start_time": "<string>",
"end_time": "<string>",
"tags": [{}],
"metadata": [{}],
"scores": [{}],
"starred": True,
"prompt_template": {},
"limit": 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({
name: '<string>',
workspace_id: 123,
q: '<string>',
start_time: '<string>',
end_time: '<string>',
tags: [{}],
metadata: [{}],
scores: [{}],
starred: true,
prompt_template: {},
limit: 123
})
};
fetch('https://api.promptlayer.com/dataset-from-filter-params', 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.promptlayer.com/dataset-from-filter-params",
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([
'name' => '<string>',
'workspace_id' => 123,
'q' => '<string>',
'start_time' => '<string>',
'end_time' => '<string>',
'tags' => [
[
]
],
'metadata' => [
[
]
],
'scores' => [
[
]
],
'starred' => true,
'prompt_template' => [
],
'limit' => 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.promptlayer.com/dataset-from-filter-params"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"workspace_id\": 123,\n \"q\": \"<string>\",\n \"start_time\": \"<string>\",\n \"end_time\": \"<string>\",\n \"tags\": [\n {}\n ],\n \"metadata\": [\n {}\n ],\n \"scores\": [\n {}\n ],\n \"starred\": true,\n \"prompt_template\": {},\n \"limit\": 123\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.promptlayer.com/dataset-from-filter-params")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"workspace_id\": 123,\n \"q\": \"<string>\",\n \"start_time\": \"<string>\",\n \"end_time\": \"<string>\",\n \"tags\": [\n {}\n ],\n \"metadata\": [\n {}\n ],\n \"scores\": [\n {}\n ],\n \"starred\": true,\n \"prompt_template\": {},\n \"limit\": 123\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.promptlayer.com/dataset-from-filter-params")
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 \"name\": \"<string>\",\n \"workspace_id\": 123,\n \"q\": \"<string>\",\n \"start_time\": \"<string>\",\n \"end_time\": \"<string>\",\n \"tags\": [\n {}\n ],\n \"metadata\": [\n {}\n ],\n \"scores\": [\n {}\n ],\n \"starred\": true,\n \"prompt_template\": {},\n \"limit\": 123\n}"
response = http.request(request)
puts response.read_bodyReference
Create Dataset from History
POST
/
dataset-from-filter-params
Create Dataset from History
curl --request POST \
--url https://api.promptlayer.com/dataset-from-filter-params \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"workspace_id": 123,
"q": "<string>",
"start_time": "<string>",
"end_time": "<string>",
"tags": [
{}
],
"metadata": [
{}
],
"scores": [
{}
],
"starred": true,
"prompt_template": {},
"limit": 123
}
'import requests
url = "https://api.promptlayer.com/dataset-from-filter-params"
payload = {
"name": "<string>",
"workspace_id": 123,
"q": "<string>",
"start_time": "<string>",
"end_time": "<string>",
"tags": [{}],
"metadata": [{}],
"scores": [{}],
"starred": True,
"prompt_template": {},
"limit": 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({
name: '<string>',
workspace_id: 123,
q: '<string>',
start_time: '<string>',
end_time: '<string>',
tags: [{}],
metadata: [{}],
scores: [{}],
starred: true,
prompt_template: {},
limit: 123
})
};
fetch('https://api.promptlayer.com/dataset-from-filter-params', 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.promptlayer.com/dataset-from-filter-params",
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([
'name' => '<string>',
'workspace_id' => 123,
'q' => '<string>',
'start_time' => '<string>',
'end_time' => '<string>',
'tags' => [
[
]
],
'metadata' => [
[
]
],
'scores' => [
[
]
],
'starred' => true,
'prompt_template' => [
],
'limit' => 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.promptlayer.com/dataset-from-filter-params"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"workspace_id\": 123,\n \"q\": \"<string>\",\n \"start_time\": \"<string>\",\n \"end_time\": \"<string>\",\n \"tags\": [\n {}\n ],\n \"metadata\": [\n {}\n ],\n \"scores\": [\n {}\n ],\n \"starred\": true,\n \"prompt_template\": {},\n \"limit\": 123\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.promptlayer.com/dataset-from-filter-params")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"workspace_id\": 123,\n \"q\": \"<string>\",\n \"start_time\": \"<string>\",\n \"end_time\": \"<string>\",\n \"tags\": [\n {}\n ],\n \"metadata\": [\n {}\n ],\n \"scores\": [\n {}\n ],\n \"starred\": true,\n \"prompt_template\": {},\n \"limit\": 123\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.promptlayer.com/dataset-from-filter-params")
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 \"name\": \"<string>\",\n \"workspace_id\": 123,\n \"q\": \"<string>\",\n \"start_time\": \"<string>\",\n \"end_time\": \"<string>\",\n \"tags\": [\n {}\n ],\n \"metadata\": [\n {}\n ],\n \"scores\": [\n {}\n ],\n \"starred\": true,\n \"prompt_template\": {},\n \"limit\": 123\n}"
response = http.request(request)
puts response.read_bodyThis endpoint allows you to create a dataset based on a historical search query. Search filters can include tags, metadata, and other criteria such as time range and scores. This dataset is then stored in a given workspace.
Example Code
import requests
response = requests.post(
"https://api.promptlayer.com/dataset-from-filter-params",
json={
"name": "Dataset Name",
"workspace_id": 1,
"q": "javascript",
"start_time": "2023-11-17 20:14:31.874642",
"end_time": "2024-11-18 20:14:31.874642",
"tags": ["prod", "dev"],
"metadata": [
{"key": "user_id", "value": "abc123"},
{"key": "success", "value": "true"}
],
"scores": [
{"name": "default", "operator": ">", "value": 90}
],
"starred": True,
"prompt_template": {
"name": "recipe_template",
"version_numbers": [50, 51]
},
"limit": 500,
}
)
Request Parameters
string
required
The name of the dataset to be created.
integer
required
The ID of the workspace under which the dataset will be stored.
string
The search query for filtering the data.
string
The start time for the dataset’s time range filter.
string
The end time for the dataset’s time range filter.
array
A list of tags to filter by.
array
A list of metadata key-value pairs to filter by.
array
Score thresholds and conditions for filtering request logs.
boolean
Only include favorited requests.
object
Filters requests by the specified prompt template, defaulting to its latest version if no versions are specified.
integer
The maximum number of rows that will be included in the dataset.
Was this page helpful?
⌘I

