Create Evaluator
curl --request POST \
--url https://api.fireworks.ai/v1/accounts/{account_id}/evaluatorsV2 \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"evaluator": {
"displayName": "<string>",
"description": "<string>",
"criteria": [
{
"type": "TYPE_UNSPECIFIED",
"name": "<string>",
"description": "<string>",
"codeSnippets": {
"language": "<string>",
"fileContents": {},
"entryFile": "<string>",
"entryFunc": "<string>"
}
}
],
"requirements": "<string>",
"entryPoint": "<string>",
"commitHash": "<string>",
"source": {
"type": "TYPE_UNSPECIFIED",
"githubRepositoryName": "<string>"
},
"defaultDataset": "<string>"
},
"evaluatorId": "<string>"
}
'import requests
url = "https://api.fireworks.ai/v1/accounts/{account_id}/evaluatorsV2"
payload = {
"evaluator": {
"displayName": "<string>",
"description": "<string>",
"criteria": [
{
"type": "TYPE_UNSPECIFIED",
"name": "<string>",
"description": "<string>",
"codeSnippets": {
"language": "<string>",
"fileContents": {},
"entryFile": "<string>",
"entryFunc": "<string>"
}
}
],
"requirements": "<string>",
"entryPoint": "<string>",
"commitHash": "<string>",
"source": {
"type": "TYPE_UNSPECIFIED",
"githubRepositoryName": "<string>"
},
"defaultDataset": "<string>"
},
"evaluatorId": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
evaluator: {
displayName: '<string>',
description: '<string>',
criteria: [
{
type: 'TYPE_UNSPECIFIED',
name: '<string>',
description: '<string>',
codeSnippets: {
language: '<string>',
fileContents: {},
entryFile: '<string>',
entryFunc: '<string>'
}
}
],
requirements: '<string>',
entryPoint: '<string>',
commitHash: '<string>',
source: {type: 'TYPE_UNSPECIFIED', githubRepositoryName: '<string>'},
defaultDataset: '<string>'
},
evaluatorId: '<string>'
})
};
fetch('https://api.fireworks.ai/v1/accounts/{account_id}/evaluatorsV2', 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.fireworks.ai/v1/accounts/{account_id}/evaluatorsV2",
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([
'evaluator' => [
'displayName' => '<string>',
'description' => '<string>',
'criteria' => [
[
'type' => 'TYPE_UNSPECIFIED',
'name' => '<string>',
'description' => '<string>',
'codeSnippets' => [
'language' => '<string>',
'fileContents' => [
],
'entryFile' => '<string>',
'entryFunc' => '<string>'
]
]
],
'requirements' => '<string>',
'entryPoint' => '<string>',
'commitHash' => '<string>',
'source' => [
'type' => 'TYPE_UNSPECIFIED',
'githubRepositoryName' => '<string>'
],
'defaultDataset' => '<string>'
],
'evaluatorId' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"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.fireworks.ai/v1/accounts/{account_id}/evaluatorsV2"
payload := strings.NewReader("{\n \"evaluator\": {\n \"displayName\": \"<string>\",\n \"description\": \"<string>\",\n \"criteria\": [\n {\n \"type\": \"TYPE_UNSPECIFIED\",\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"codeSnippets\": {\n \"language\": \"<string>\",\n \"fileContents\": {},\n \"entryFile\": \"<string>\",\n \"entryFunc\": \"<string>\"\n }\n }\n ],\n \"requirements\": \"<string>\",\n \"entryPoint\": \"<string>\",\n \"commitHash\": \"<string>\",\n \"source\": {\n \"type\": \"TYPE_UNSPECIFIED\",\n \"githubRepositoryName\": \"<string>\"\n },\n \"defaultDataset\": \"<string>\"\n },\n \"evaluatorId\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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.fireworks.ai/v1/accounts/{account_id}/evaluatorsV2")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"evaluator\": {\n \"displayName\": \"<string>\",\n \"description\": \"<string>\",\n \"criteria\": [\n {\n \"type\": \"TYPE_UNSPECIFIED\",\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"codeSnippets\": {\n \"language\": \"<string>\",\n \"fileContents\": {},\n \"entryFile\": \"<string>\",\n \"entryFunc\": \"<string>\"\n }\n }\n ],\n \"requirements\": \"<string>\",\n \"entryPoint\": \"<string>\",\n \"commitHash\": \"<string>\",\n \"source\": {\n \"type\": \"TYPE_UNSPECIFIED\",\n \"githubRepositoryName\": \"<string>\"\n },\n \"defaultDataset\": \"<string>\"\n },\n \"evaluatorId\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.fireworks.ai/v1/accounts/{account_id}/evaluatorsV2")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"evaluator\": {\n \"displayName\": \"<string>\",\n \"description\": \"<string>\",\n \"criteria\": [\n {\n \"type\": \"TYPE_UNSPECIFIED\",\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"codeSnippets\": {\n \"language\": \"<string>\",\n \"fileContents\": {},\n \"entryFile\": \"<string>\",\n \"entryFunc\": \"<string>\"\n }\n }\n ],\n \"requirements\": \"<string>\",\n \"entryPoint\": \"<string>\",\n \"commitHash\": \"<string>\",\n \"source\": {\n \"type\": \"TYPE_UNSPECIFIED\",\n \"githubRepositoryName\": \"<string>\"\n },\n \"defaultDataset\": \"<string>\"\n },\n \"evaluatorId\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"name": "<string>",
"displayName": "<string>",
"description": "<string>",
"createTime": "2023-11-07T05:31:56Z",
"createdBy": "<string>",
"updateTime": "2023-11-07T05:31:56Z",
"state": "STATE_UNSPECIFIED",
"criteria": [
{
"type": "TYPE_UNSPECIFIED",
"name": "<string>",
"description": "<string>",
"codeSnippets": {
"language": "<string>",
"fileContents": {},
"entryFile": "<string>",
"entryFunc": "<string>"
}
}
],
"requirements": "<string>",
"entryPoint": "<string>",
"status": {
"code": "OK",
"message": "<string>"
},
"commitHash": "<string>",
"source": {
"type": "TYPE_UNSPECIFIED",
"githubRepositoryName": "<string>"
},
"defaultDataset": "<string>"
}Evaluators
Create Evaluator
Creates a custom evaluator for scoring model outputs. Evaluators use the Eval Protocol to define test cases, run model inference, and score responses. They are used with evaluation jobs and Reinforcement Fine-Tuning (RFT).
Source Code Requirements
Your project should contain:
requirements.txt- Python dependencies for your evaluatortest_*.py- Pytest test file(s) with@evaluation_testdecorated functions- Any additional code/modules your evaluator needs
Workflow
Recommended: Use the ep upload
CLI command to handle all these steps automatically.
If using the API directly:
- Call this endpoint to create the evaluator resource
- Package your source directory as a
.tar.gz(respecting.gitignore) - Call Get Evaluator Upload Endpoint to get a signed upload URL
PUTthe tar.gz file to the signed URL- Call Validate Evaluator Upload to trigger server-side validation
- Poll Get Evaluator until ready
Once active, reference the evaluator in Create Evaluation Job or Create Reinforcement Fine-tuning Job.
POST
/
v1
/
accounts
/
{account_id}
/
evaluatorsV2
Create Evaluator
curl --request POST \
--url https://api.fireworks.ai/v1/accounts/{account_id}/evaluatorsV2 \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"evaluator": {
"displayName": "<string>",
"description": "<string>",
"criteria": [
{
"type": "TYPE_UNSPECIFIED",
"name": "<string>",
"description": "<string>",
"codeSnippets": {
"language": "<string>",
"fileContents": {},
"entryFile": "<string>",
"entryFunc": "<string>"
}
}
],
"requirements": "<string>",
"entryPoint": "<string>",
"commitHash": "<string>",
"source": {
"type": "TYPE_UNSPECIFIED",
"githubRepositoryName": "<string>"
},
"defaultDataset": "<string>"
},
"evaluatorId": "<string>"
}
'import requests
url = "https://api.fireworks.ai/v1/accounts/{account_id}/evaluatorsV2"
payload = {
"evaluator": {
"displayName": "<string>",
"description": "<string>",
"criteria": [
{
"type": "TYPE_UNSPECIFIED",
"name": "<string>",
"description": "<string>",
"codeSnippets": {
"language": "<string>",
"fileContents": {},
"entryFile": "<string>",
"entryFunc": "<string>"
}
}
],
"requirements": "<string>",
"entryPoint": "<string>",
"commitHash": "<string>",
"source": {
"type": "TYPE_UNSPECIFIED",
"githubRepositoryName": "<string>"
},
"defaultDataset": "<string>"
},
"evaluatorId": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
evaluator: {
displayName: '<string>',
description: '<string>',
criteria: [
{
type: 'TYPE_UNSPECIFIED',
name: '<string>',
description: '<string>',
codeSnippets: {
language: '<string>',
fileContents: {},
entryFile: '<string>',
entryFunc: '<string>'
}
}
],
requirements: '<string>',
entryPoint: '<string>',
commitHash: '<string>',
source: {type: 'TYPE_UNSPECIFIED', githubRepositoryName: '<string>'},
defaultDataset: '<string>'
},
evaluatorId: '<string>'
})
};
fetch('https://api.fireworks.ai/v1/accounts/{account_id}/evaluatorsV2', 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.fireworks.ai/v1/accounts/{account_id}/evaluatorsV2",
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([
'evaluator' => [
'displayName' => '<string>',
'description' => '<string>',
'criteria' => [
[
'type' => 'TYPE_UNSPECIFIED',
'name' => '<string>',
'description' => '<string>',
'codeSnippets' => [
'language' => '<string>',
'fileContents' => [
],
'entryFile' => '<string>',
'entryFunc' => '<string>'
]
]
],
'requirements' => '<string>',
'entryPoint' => '<string>',
'commitHash' => '<string>',
'source' => [
'type' => 'TYPE_UNSPECIFIED',
'githubRepositoryName' => '<string>'
],
'defaultDataset' => '<string>'
],
'evaluatorId' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"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.fireworks.ai/v1/accounts/{account_id}/evaluatorsV2"
payload := strings.NewReader("{\n \"evaluator\": {\n \"displayName\": \"<string>\",\n \"description\": \"<string>\",\n \"criteria\": [\n {\n \"type\": \"TYPE_UNSPECIFIED\",\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"codeSnippets\": {\n \"language\": \"<string>\",\n \"fileContents\": {},\n \"entryFile\": \"<string>\",\n \"entryFunc\": \"<string>\"\n }\n }\n ],\n \"requirements\": \"<string>\",\n \"entryPoint\": \"<string>\",\n \"commitHash\": \"<string>\",\n \"source\": {\n \"type\": \"TYPE_UNSPECIFIED\",\n \"githubRepositoryName\": \"<string>\"\n },\n \"defaultDataset\": \"<string>\"\n },\n \"evaluatorId\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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.fireworks.ai/v1/accounts/{account_id}/evaluatorsV2")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"evaluator\": {\n \"displayName\": \"<string>\",\n \"description\": \"<string>\",\n \"criteria\": [\n {\n \"type\": \"TYPE_UNSPECIFIED\",\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"codeSnippets\": {\n \"language\": \"<string>\",\n \"fileContents\": {},\n \"entryFile\": \"<string>\",\n \"entryFunc\": \"<string>\"\n }\n }\n ],\n \"requirements\": \"<string>\",\n \"entryPoint\": \"<string>\",\n \"commitHash\": \"<string>\",\n \"source\": {\n \"type\": \"TYPE_UNSPECIFIED\",\n \"githubRepositoryName\": \"<string>\"\n },\n \"defaultDataset\": \"<string>\"\n },\n \"evaluatorId\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.fireworks.ai/v1/accounts/{account_id}/evaluatorsV2")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"evaluator\": {\n \"displayName\": \"<string>\",\n \"description\": \"<string>\",\n \"criteria\": [\n {\n \"type\": \"TYPE_UNSPECIFIED\",\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"codeSnippets\": {\n \"language\": \"<string>\",\n \"fileContents\": {},\n \"entryFile\": \"<string>\",\n \"entryFunc\": \"<string>\"\n }\n }\n ],\n \"requirements\": \"<string>\",\n \"entryPoint\": \"<string>\",\n \"commitHash\": \"<string>\",\n \"source\": {\n \"type\": \"TYPE_UNSPECIFIED\",\n \"githubRepositoryName\": \"<string>\"\n },\n \"defaultDataset\": \"<string>\"\n },\n \"evaluatorId\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"name": "<string>",
"displayName": "<string>",
"description": "<string>",
"createTime": "2023-11-07T05:31:56Z",
"createdBy": "<string>",
"updateTime": "2023-11-07T05:31:56Z",
"state": "STATE_UNSPECIFIED",
"criteria": [
{
"type": "TYPE_UNSPECIFIED",
"name": "<string>",
"description": "<string>",
"codeSnippets": {
"language": "<string>",
"fileContents": {},
"entryFile": "<string>",
"entryFunc": "<string>"
}
}
],
"requirements": "<string>",
"entryPoint": "<string>",
"status": {
"code": "OK",
"message": "<string>"
},
"commitHash": "<string>",
"source": {
"type": "TYPE_UNSPECIFIED",
"githubRepositoryName": "<string>"
},
"defaultDataset": "<string>"
}Authorizations
Bearer authentication using your Fireworks API key. Format: Bearer <API_KEY>
Path Parameters
The Account Id
Response
200 - application/json
A successful response.
Available options:
STATE_UNSPECIFIED, ACTIVE, BUILDING, BUILD_FAILED criteria
Criteria for the evaluator, it should produce a score for the metric (name of criteria)
Used for eval3 with UI upload path · object[]
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Source information for the evaluator codebase.
Show child attributes
Show child attributes
Was this page helpful?
⌘I