Skip to main content
POST
/
api
/
v1
/
evals
/
reward
Reward
curl --request POST \
  --url https://platform.composo.ai/api/v1/evals/reward \
  --header 'API-Key: <api-key>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "messages": [
    {}
  ],
  "evaluation_criteria": "<string>",
  "evaluator_name": "<string>",
  "model_core": "align-20251111",
  "tags": {},
  "trace_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
  "system": "<string>",
  "tools": [
    {}
  ],
  "evaluate_latest": true,
  "explanation_cleaning": "<string>"
}
'
import requests

url = "https://platform.composo.ai/api/v1/evals/reward"

payload = {
"messages": [{}],
"evaluation_criteria": "<string>",
"evaluator_name": "<string>",
"model_core": "align-20251111",
"tags": {},
"trace_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"system": "<string>",
"tools": [{}],
"evaluate_latest": True,
"explanation_cleaning": "<string>"
}
headers = {
"API-Key": "<api-key>",
"Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
const options = {
method: 'POST',
headers: {'API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
messages: [{}],
evaluation_criteria: '<string>',
evaluator_name: '<string>',
model_core: 'align-20251111',
tags: {},
trace_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
system: '<string>',
tools: [{}],
evaluate_latest: true,
explanation_cleaning: '<string>'
})
};

fetch('https://platform.composo.ai/api/v1/evals/reward', 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://platform.composo.ai/api/v1/evals/reward",
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([
'messages' => [
[

]
],
'evaluation_criteria' => '<string>',
'evaluator_name' => '<string>',
'model_core' => 'align-20251111',
'tags' => [

],
'trace_id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'system' => '<string>',
'tools' => [
[

]
],
'evaluate_latest' => true,
'explanation_cleaning' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"API-Key: <api-key>",
"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://platform.composo.ai/api/v1/evals/reward"

payload := strings.NewReader("{\n \"messages\": [\n {}\n ],\n \"evaluation_criteria\": \"<string>\",\n \"evaluator_name\": \"<string>\",\n \"model_core\": \"align-20251111\",\n \"tags\": {},\n \"trace_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"system\": \"<string>\",\n \"tools\": [\n {}\n ],\n \"evaluate_latest\": true,\n \"explanation_cleaning\": \"<string>\"\n}")

req, _ := http.NewRequest("POST", url, payload)

req.Header.Add("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://platform.composo.ai/api/v1/evals/reward")
.header("API-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"messages\": [\n {}\n ],\n \"evaluation_criteria\": \"<string>\",\n \"evaluator_name\": \"<string>\",\n \"model_core\": \"align-20251111\",\n \"tags\": {},\n \"trace_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"system\": \"<string>\",\n \"tools\": [\n {}\n ],\n \"evaluate_latest\": true,\n \"explanation_cleaning\": \"<string>\"\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://platform.composo.ai/api/v1/evals/reward")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["API-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"messages\": [\n {}\n ],\n \"evaluation_criteria\": \"<string>\",\n \"evaluator_name\": \"<string>\",\n \"model_core\": \"align-20251111\",\n \"tags\": {},\n \"trace_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"system\": \"<string>\",\n \"tools\": [\n {}\n ],\n \"evaluate_latest\": true,\n \"explanation_cleaning\": \"<string>\"\n}"

response = http.request(request)
puts response.read_body
{
  "explanation": "<string>",
  "score": 123,
  "cleaned_explanation": "<string>",
  "sources": [
    {
      "id": "<string>",
      "type": "<string>"
    }
  ]
}
{
"detail": "<string>"
}
{
"detail": "<string>"
}
{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}
{
"detail": "<string>"
}
{
"detail": "<string>"
}
{
"detail": "<string>"
}

Authorizations

API-Key
string
header
required

Body

application/json

Request model for reward score evaluation of LLM responses against specified criteria.

messages
Messages · object[]
required

A list of chat messages in OpenAI or Anthropic messages format

Minimum array length: 2
evaluation_criteria
string | null

Criteria used for evaluation. Begins with one of the following: Reward, Penalize, Passes if, Fails ifNote, align-lightning-20251127 only supports Passes/Fails criteria. Mutually exclusive with evaluator_name.

Minimum string length: 1
evaluator_name
string | null

Name of an existing evaluator (group_id) to use for evaluation. Mutually exclusive with evaluation_criteria.

Required string length: 1 - 255
model_core
enum<string>
default:align-20251111

The model core for reward evaluation. Defaults to align-20251111 if not specified.

Available options:
align-20251111,
align-20250529,
align-20260109,
align-lightning-20251127,
align-lightning-20250731
tags
Tags · object | null

Optional key-value pairs to tag and categorize the request. All tag values must be strings.

trace_id
string<uuid> | null

Optional trace ID to associate this evaluation with an existing trace.

system
string | null

System message is separate for Anthropic-style LLM calls. Optional.

tools
Tools · object[] | null

List of tools available for the assistant to call in OpenAI or Anthropic format. Optional.

evaluate_latest
boolean
default:true

Whether to evaluate only the latest response or all responses. Only True is supported for align-lightning model cores.

explanation_cleaning
string | null

When set to "end_user", the response will include a cleaned_explanation field that rewrites the explanation to only reference content visible in user and assistant messages.

Allowed value: "end_user"

Response

Successful Response

Response model for evaluation scores.

explanation
string
required

Explanation of the evaluation score

score
number | null

Evaluation score between 0 and 1. If null, the criteria was deemed not applicable.

cleaned_explanation
string | null

A rewrite of explanation that only references content visible in user and assistant messages. Only present when explanation_cleaning is set to "end_user" in the request.

sources
Source · object[] | null

Sources referenced in the evaluation, e.g. memories, annotations, or documents.