Upload Benchmark
curl --request POST \
--url https://api.nugen.in/api/v3/benchmarks/upload \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: multipart/form-data' \
--form file=@example-file \
--form document_id=document_01k4x9m2p7q3r5s8 \
--form 'name=Contract Clause Review' \
--form 'description=Benchmark for contract clause extraction'import requests
url = "https://api.nugen.in/api/v3/benchmarks/upload"
files = { "file": ("example-file", open("example-file", "rb")) }
payload = {
"document_id": "document_01k4x9m2p7q3r5s8",
"name": "Contract Clause Review",
"description": "Benchmark for contract clause extraction"
}
headers = {"Authorization": "Bearer <token>"}
response = requests.post(url, data=payload, files=files, headers=headers)
print(response.text)const form = new FormData();
form.append('file', 'benchmark_questions.json');
form.append('document_id', 'document_01k4x9m2p7q3r5s8');
form.append('name', 'Contract Clause Review');
form.append('description', 'Benchmark for contract clause extraction');
const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
options.body = form;
fetch('https://api.nugen.in/api/v3/benchmarks/upload', 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.nugen.in/api/v3/benchmarks/upload",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\nbenchmark_questions.json\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"document_id\"\r\n\r\ndocument_01k4x9m2p7q3r5s8\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"name\"\r\n\r\nContract Clause Review\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"description\"\r\n\r\nBenchmark for contract clause extraction\r\n-----011000010111000001101001--",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: multipart/form-data"
],
]);
$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.nugen.in/api/v3/benchmarks/upload"
payload := strings.NewReader("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\nbenchmark_questions.json\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"document_id\"\r\n\r\ndocument_01k4x9m2p7q3r5s8\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"name\"\r\n\r\nContract Clause Review\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"description\"\r\n\r\nBenchmark for contract clause extraction\r\n-----011000010111000001101001--")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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.nugen.in/api/v3/benchmarks/upload")
.header("Authorization", "Bearer <token>")
.body("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\nbenchmark_questions.json\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"document_id\"\r\n\r\ndocument_01k4x9m2p7q3r5s8\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"name\"\r\n\r\nContract Clause Review\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"description\"\r\n\r\nBenchmark for contract clause extraction\r\n-----011000010111000001101001--")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.nugen.in/api/v3/benchmarks/upload")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request.body = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\nbenchmark_questions.json\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"document_id\"\r\n\r\ndocument_01k4x9m2p7q3r5s8\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"name\"\r\n\r\nContract Clause Review\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"description\"\r\n\r\nBenchmark for contract clause extraction\r\n-----011000010111000001101001--"
response = http.request(request)
puts response.read_body{
"benchmark_id": "benchmark_01k4x9m2p7q3r6a1",
"benchmark_name": "My Benchmark",
"status": "PROCESSING",
"n_samples": 10,
"samples": [
{
"sample_num": 123,
"instruction": "<string>",
"response": "<string>",
"image_url": "<string>"
}
]
}{
"detail": "Model not found"
}{
"detail": "Model not found"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}Benchmarks
Upload Benchmark
Upload a pre-prepared benchmark file of instruction and response samples.
This endpoint allows you to upload a JSON file containing benchmark samples, associating it with a specific knowledge item for evaluation purposes.
Request Body (multipart/form-data):
file: JSON file containing benchmark samples (required)benchmark_name: Display name for the benchmark (required)document_id: Thedocument_idof the knowledge item this benchmark is based on (required)description(optional): Description of the benchmark
File Format:
The uploaded JSON file should contain an array of sample objects. Each sample should have:
[
{
"sample_num": 1,
"instruction": "What is...",
"response": "The response is..."
}
]
Returns:
benchmark_id: Unique identifier for the uploaded benchmarkbenchmark_name: Name of the benchmarkstatus: Upload status (PROCESSING,READY,FAILED)samples: List of benchmark sample objects, each containing:sample_num: Sample numberinstruction: Instruction textresponse: Expected response text
n_samples: Total number of samples in the benchmark
Raises:
400: If file format is invalid, JSON structure is incorrect, or document_id is not found413: If file size exceeds limit
Example Request:
POST /api/v3/benchmarks/upload
Headers: {"Authorization": "Bearer <api_key>"}
Content-Type: multipart/form-data
Form Data:
file: benchmark_questions.json
name: "Contract Clause Review"
document_id: "document_01k4x9m2p7q3r5s8"
description: "Benchmark for contract clause extraction"
Example Response:
{
"benchmark_id": "benchmark_01k4x9m2p7q3r6a1",
"benchmark_name": "My Benchmark",
"status": "READY",
"samples": [
{
"sample_num": 1,
"instruction": "How do I reset my password?",
"response": "You can reset your password by clicking the 'Forgot Password' link on the login page."
},
{
"sample_num": 2,
"instruction": "What are the system requirements?",
"response": "The system requires a modern web browser with JavaScript enabled."
}
],
"n_samples": 2
}
Notes:
- File must be in valid JSON format with proper sample structure
- Each sample must include
sample_num,instruction, andresponsefields - The benchmark is immediately available for use in evaluations after upload
- The
document_idprovided in the request is stored internally and will appear as a single-elementdocument_idsarray (e.g.,["document_01k4x9m2p7q3r5s8"]) when retrieving the benchmark via/benchmarks/listor/benchmarks/{id}/dataendpoints
POST
/
api
/
v3
/
benchmarks
/
upload
Upload Benchmark
curl --request POST \
--url https://api.nugen.in/api/v3/benchmarks/upload \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: multipart/form-data' \
--form file=@example-file \
--form document_id=document_01k4x9m2p7q3r5s8 \
--form 'name=Contract Clause Review' \
--form 'description=Benchmark for contract clause extraction'import requests
url = "https://api.nugen.in/api/v3/benchmarks/upload"
files = { "file": ("example-file", open("example-file", "rb")) }
payload = {
"document_id": "document_01k4x9m2p7q3r5s8",
"name": "Contract Clause Review",
"description": "Benchmark for contract clause extraction"
}
headers = {"Authorization": "Bearer <token>"}
response = requests.post(url, data=payload, files=files, headers=headers)
print(response.text)const form = new FormData();
form.append('file', 'benchmark_questions.json');
form.append('document_id', 'document_01k4x9m2p7q3r5s8');
form.append('name', 'Contract Clause Review');
form.append('description', 'Benchmark for contract clause extraction');
const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
options.body = form;
fetch('https://api.nugen.in/api/v3/benchmarks/upload', 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.nugen.in/api/v3/benchmarks/upload",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\nbenchmark_questions.json\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"document_id\"\r\n\r\ndocument_01k4x9m2p7q3r5s8\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"name\"\r\n\r\nContract Clause Review\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"description\"\r\n\r\nBenchmark for contract clause extraction\r\n-----011000010111000001101001--",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: multipart/form-data"
],
]);
$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.nugen.in/api/v3/benchmarks/upload"
payload := strings.NewReader("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\nbenchmark_questions.json\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"document_id\"\r\n\r\ndocument_01k4x9m2p7q3r5s8\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"name\"\r\n\r\nContract Clause Review\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"description\"\r\n\r\nBenchmark for contract clause extraction\r\n-----011000010111000001101001--")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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.nugen.in/api/v3/benchmarks/upload")
.header("Authorization", "Bearer <token>")
.body("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\nbenchmark_questions.json\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"document_id\"\r\n\r\ndocument_01k4x9m2p7q3r5s8\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"name\"\r\n\r\nContract Clause Review\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"description\"\r\n\r\nBenchmark for contract clause extraction\r\n-----011000010111000001101001--")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.nugen.in/api/v3/benchmarks/upload")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request.body = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\nbenchmark_questions.json\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"document_id\"\r\n\r\ndocument_01k4x9m2p7q3r5s8\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"name\"\r\n\r\nContract Clause Review\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"description\"\r\n\r\nBenchmark for contract clause extraction\r\n-----011000010111000001101001--"
response = http.request(request)
puts response.read_body{
"benchmark_id": "benchmark_01k4x9m2p7q3r6a1",
"benchmark_name": "My Benchmark",
"status": "PROCESSING",
"n_samples": 10,
"samples": [
{
"sample_num": 123,
"instruction": "<string>",
"response": "<string>",
"image_url": "<string>"
}
]
}{
"detail": "Model not found"
}{
"detail": "Model not found"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}Body
multipart/form-data
Multipart form to upload a benchmark file.
Response
Returns the details of the uploaded benchmark including its unique identifier, name, status, and the list of samples with expected responses
Acknowledgement of an uploaded benchmark.
Was this page helpful?