curl --request POST \
--url https://api.lightsage.com/v2/evals/batch \
--header 'Content-Type: application/json' \
--header 'X-Lightsage-Api-Key: <api-key>' \
--data '
{
"evals": [
{
"name": "BTC price fetcher",
"prompts": [
"Write a Python script that prints the current price of BTC using a free API without a key."
],
"type": "workflow"
},
{
"name": "BTC alert",
"prompts": [
"Build a free BTC price alert without an API key."
],
"type": "workflow"
}
],
"expected_template_version": 1,
"template_id": "58f3604e-d58e-4eb8-b1fe-3478be875c36"
}
'import requests
url = "https://api.lightsage.com/v2/evals/batch"
payload = {
"evals": [
{
"name": "BTC price fetcher",
"prompts": ["Write a Python script that prints the current price of BTC using a free API without a key."],
"type": "workflow"
},
{
"name": "BTC alert",
"prompts": ["Build a free BTC price alert without an API key."],
"type": "workflow"
}
],
"expected_template_version": 1,
"template_id": "58f3604e-d58e-4eb8-b1fe-3478be875c36"
}
headers = {
"X-Lightsage-Api-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-Lightsage-Api-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
evals: [
{
name: 'BTC price fetcher',
prompts: [
'Write a Python script that prints the current price of BTC using a free API without a key.'
],
type: 'workflow'
},
{
name: 'BTC alert',
prompts: ['Build a free BTC price alert without an API key.'],
type: 'workflow'
}
],
expected_template_version: 1,
template_id: '58f3604e-d58e-4eb8-b1fe-3478be875c36'
})
};
fetch('https://api.lightsage.com/v2/evals/batch', 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.lightsage.com/v2/evals/batch",
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([
'evals' => [
[
'name' => 'BTC price fetcher',
'prompts' => [
'Write a Python script that prints the current price of BTC using a free API without a key.'
],
'type' => 'workflow'
],
[
'name' => 'BTC alert',
'prompts' => [
'Build a free BTC price alert without an API key.'
],
'type' => 'workflow'
]
],
'expected_template_version' => 1,
'template_id' => '58f3604e-d58e-4eb8-b1fe-3478be875c36'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-Lightsage-Api-Key: <api-key>"
],
]);
$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.lightsage.com/v2/evals/batch"
payload := strings.NewReader("{\n \"evals\": [\n {\n \"name\": \"BTC price fetcher\",\n \"prompts\": [\n \"Write a Python script that prints the current price of BTC using a free API without a key.\"\n ],\n \"type\": \"workflow\"\n },\n {\n \"name\": \"BTC alert\",\n \"prompts\": [\n \"Build a free BTC price alert without an API key.\"\n ],\n \"type\": \"workflow\"\n }\n ],\n \"expected_template_version\": 1,\n \"template_id\": \"58f3604e-d58e-4eb8-b1fe-3478be875c36\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-Lightsage-Api-Key", "<api-key>")
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.lightsage.com/v2/evals/batch")
.header("X-Lightsage-Api-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"evals\": [\n {\n \"name\": \"BTC price fetcher\",\n \"prompts\": [\n \"Write a Python script that prints the current price of BTC using a free API without a key.\"\n ],\n \"type\": \"workflow\"\n },\n {\n \"name\": \"BTC alert\",\n \"prompts\": [\n \"Build a free BTC price alert without an API key.\"\n ],\n \"type\": \"workflow\"\n }\n ],\n \"expected_template_version\": 1,\n \"template_id\": \"58f3604e-d58e-4eb8-b1fe-3478be875c36\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.lightsage.com/v2/evals/batch")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-Lightsage-Api-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"evals\": [\n {\n \"name\": \"BTC price fetcher\",\n \"prompts\": [\n \"Write a Python script that prints the current price of BTC using a free API without a key.\"\n ],\n \"type\": \"workflow\"\n },\n {\n \"name\": \"BTC alert\",\n \"prompts\": [\n \"Build a free BTC price alert without an API key.\"\n ],\n \"type\": \"workflow\"\n }\n ],\n \"expected_template_version\": 1,\n \"template_id\": \"58f3604e-d58e-4eb8-b1fe-3478be875c36\"\n}"
response = http.request(request)
puts response.read_body{
"base_count": 1,
"created_count": 2,
"results": [
{
"base": {
"eval_id": "b7e8fd2f-197f-4114-8206-6083d3079752",
"id": "d3336acd-5637-40d0-a1da-89b142590c4c",
"name": "BTC price fetcher",
"prompt": "Fetch the current BTC price."
},
"input_index": 0,
"name": "BTC price fetcher",
"variants": [
{
"competitor_id": "3f70aa73-bfbe-4494-934d-72a60989115d",
"competitor_name": "Competitor",
"eval_id": "c08e3af8-9bed-4544-81d1-d5c9f3c227cb",
"id": "8ebcbe4d-c35b-4bce-a1a7-5aff1d02a0fb",
"name": "BTC price fetcher",
"prompt": "Fetch the current BTC price."
}
]
}
],
"template_id": "58f3604e-d58e-4eb8-b1fe-3478be875c36",
"template_version": 1,
"variant_count": 1
}{
"detail": "Unknown or inactive competitor ID"
}{
"detail": "Eval template not found"
}{
"detail": "The Eval template changed after it was loaded. Refresh and try again."
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}Create evals from a template
Step 2 of the reusable template workflow. Provide the id and version returned by POST /v2/eval-templates as template_id and expected_template_version, then provide only prompt-specific fields in evals. The template supplies only the settings named in its included_components; omitted settings keep the values supplied by the creation workflow or its defaults. Included values are copied at creation time, so later template changes do not alter the created evals. Competitor selections create one additional eval per selected competitor for every input item, and the response groups each base eval with those variants. Brand-scoped runtime resources are validated against the organization’s primary brand before any eval is created.
curl --request POST \
--url https://api.lightsage.com/v2/evals/batch \
--header 'Content-Type: application/json' \
--header 'X-Lightsage-Api-Key: <api-key>' \
--data '
{
"evals": [
{
"name": "BTC price fetcher",
"prompts": [
"Write a Python script that prints the current price of BTC using a free API without a key."
],
"type": "workflow"
},
{
"name": "BTC alert",
"prompts": [
"Build a free BTC price alert without an API key."
],
"type": "workflow"
}
],
"expected_template_version": 1,
"template_id": "58f3604e-d58e-4eb8-b1fe-3478be875c36"
}
'import requests
url = "https://api.lightsage.com/v2/evals/batch"
payload = {
"evals": [
{
"name": "BTC price fetcher",
"prompts": ["Write a Python script that prints the current price of BTC using a free API without a key."],
"type": "workflow"
},
{
"name": "BTC alert",
"prompts": ["Build a free BTC price alert without an API key."],
"type": "workflow"
}
],
"expected_template_version": 1,
"template_id": "58f3604e-d58e-4eb8-b1fe-3478be875c36"
}
headers = {
"X-Lightsage-Api-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-Lightsage-Api-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
evals: [
{
name: 'BTC price fetcher',
prompts: [
'Write a Python script that prints the current price of BTC using a free API without a key.'
],
type: 'workflow'
},
{
name: 'BTC alert',
prompts: ['Build a free BTC price alert without an API key.'],
type: 'workflow'
}
],
expected_template_version: 1,
template_id: '58f3604e-d58e-4eb8-b1fe-3478be875c36'
})
};
fetch('https://api.lightsage.com/v2/evals/batch', 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.lightsage.com/v2/evals/batch",
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([
'evals' => [
[
'name' => 'BTC price fetcher',
'prompts' => [
'Write a Python script that prints the current price of BTC using a free API without a key.'
],
'type' => 'workflow'
],
[
'name' => 'BTC alert',
'prompts' => [
'Build a free BTC price alert without an API key.'
],
'type' => 'workflow'
]
],
'expected_template_version' => 1,
'template_id' => '58f3604e-d58e-4eb8-b1fe-3478be875c36'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-Lightsage-Api-Key: <api-key>"
],
]);
$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.lightsage.com/v2/evals/batch"
payload := strings.NewReader("{\n \"evals\": [\n {\n \"name\": \"BTC price fetcher\",\n \"prompts\": [\n \"Write a Python script that prints the current price of BTC using a free API without a key.\"\n ],\n \"type\": \"workflow\"\n },\n {\n \"name\": \"BTC alert\",\n \"prompts\": [\n \"Build a free BTC price alert without an API key.\"\n ],\n \"type\": \"workflow\"\n }\n ],\n \"expected_template_version\": 1,\n \"template_id\": \"58f3604e-d58e-4eb8-b1fe-3478be875c36\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-Lightsage-Api-Key", "<api-key>")
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.lightsage.com/v2/evals/batch")
.header("X-Lightsage-Api-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"evals\": [\n {\n \"name\": \"BTC price fetcher\",\n \"prompts\": [\n \"Write a Python script that prints the current price of BTC using a free API without a key.\"\n ],\n \"type\": \"workflow\"\n },\n {\n \"name\": \"BTC alert\",\n \"prompts\": [\n \"Build a free BTC price alert without an API key.\"\n ],\n \"type\": \"workflow\"\n }\n ],\n \"expected_template_version\": 1,\n \"template_id\": \"58f3604e-d58e-4eb8-b1fe-3478be875c36\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.lightsage.com/v2/evals/batch")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-Lightsage-Api-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"evals\": [\n {\n \"name\": \"BTC price fetcher\",\n \"prompts\": [\n \"Write a Python script that prints the current price of BTC using a free API without a key.\"\n ],\n \"type\": \"workflow\"\n },\n {\n \"name\": \"BTC alert\",\n \"prompts\": [\n \"Build a free BTC price alert without an API key.\"\n ],\n \"type\": \"workflow\"\n }\n ],\n \"expected_template_version\": 1,\n \"template_id\": \"58f3604e-d58e-4eb8-b1fe-3478be875c36\"\n}"
response = http.request(request)
puts response.read_body{
"base_count": 1,
"created_count": 2,
"results": [
{
"base": {
"eval_id": "b7e8fd2f-197f-4114-8206-6083d3079752",
"id": "d3336acd-5637-40d0-a1da-89b142590c4c",
"name": "BTC price fetcher",
"prompt": "Fetch the current BTC price."
},
"input_index": 0,
"name": "BTC price fetcher",
"variants": [
{
"competitor_id": "3f70aa73-bfbe-4494-934d-72a60989115d",
"competitor_name": "Competitor",
"eval_id": "c08e3af8-9bed-4544-81d1-d5c9f3c227cb",
"id": "8ebcbe4d-c35b-4bce-a1a7-5aff1d02a0fb",
"name": "BTC price fetcher",
"prompt": "Fetch the current BTC price."
}
]
}
],
"template_id": "58f3604e-d58e-4eb8-b1fe-3478be875c36",
"template_version": 1,
"variant_count": 1
}{
"detail": "Unknown or inactive competitor ID"
}{
"detail": "Eval template not found"
}{
"detail": "The Eval template changed after it was loaded. Refresh and try again."
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}Authorizations
Body
Reuse one template across up to 100 prompt-specific eval definitions.
Template id returned by POST /v2/eval-templates.
1Prompt-specific evals to create from the referenced template. Template-owned fields are intentionally rejected here to avoid ambiguous overrides.
1 - 100 elementsShow child attributes
Show child attributes
Template version returned when the template was read or created. When supplied, creation fails if the template changed before reuse.
x >= 1