Evaluation
Compare
Pairwise comparison for preference-based training (DPO). Compare two responses and determine which is better.
POST
/
api
/
v1
/
compare
cURL
curl --request POST \
--url https://labs.tacitintelligence.co/api/v1/compare \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data @- <<EOF
{
"collection_slug": "case-management",
"scenario_slug": "back-injury-claim",
"response_a": {
"messages": [
{
"role": "user",
"content": "I want a refund"
},
{
"role": "assistant",
"content": "Sure, here is your refund."
}
]
},
"response_b": {
"messages": [
{
"role": "user",
"content": "I want a refund"
},
{
"role": "assistant",
"content": "I'd be happy to help with that. Can you tell me more about why you'd like a refund?"
}
]
}
}
EOFimport requests
url = "https://labs.tacitintelligence.co/api/v1/compare"
payload = {
"collection_slug": "case-management",
"scenario_slug": "back-injury-claim",
"response_a": { "messages": [
{
"role": "user",
"content": "I want a refund"
},
{
"role": "assistant",
"content": "Sure, here is your refund."
}
] },
"response_b": { "messages": [
{
"role": "user",
"content": "I want a refund"
},
{
"role": "assistant",
"content": "I'd be happy to help with that. Can you tell me more about why you'd like a refund?"
}
] }
}
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({
collection_slug: 'case-management',
scenario_slug: 'back-injury-claim',
response_a: {
messages: [
{role: 'user', content: 'I want a refund'},
{role: 'assistant', content: 'Sure, here is your refund.'}
]
},
response_b: {
messages: [
{role: 'user', content: 'I want a refund'},
{
role: 'assistant',
content: 'I\'d be happy to help with that. Can you tell me more about why you\'d like a refund?'
}
]
}
})
};
fetch('https://labs.tacitintelligence.co/api/v1/compare', 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://labs.tacitintelligence.co/api/v1/compare",
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([
'collection_slug' => 'case-management',
'scenario_slug' => 'back-injury-claim',
'response_a' => [
'messages' => [
[
'role' => 'user',
'content' => 'I want a refund'
],
[
'role' => 'assistant',
'content' => 'Sure, here is your refund.'
]
]
],
'response_b' => [
'messages' => [
[
'role' => 'user',
'content' => 'I want a refund'
],
[
'role' => 'assistant',
'content' => 'I\'d be happy to help with that. Can you tell me more about why you\'d like a refund?'
]
]
]
]),
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://labs.tacitintelligence.co/api/v1/compare"
payload := strings.NewReader("{\n \"collection_slug\": \"case-management\",\n \"scenario_slug\": \"back-injury-claim\",\n \"response_a\": {\n \"messages\": [\n {\n \"role\": \"user\",\n \"content\": \"I want a refund\"\n },\n {\n \"role\": \"assistant\",\n \"content\": \"Sure, here is your refund.\"\n }\n ]\n },\n \"response_b\": {\n \"messages\": [\n {\n \"role\": \"user\",\n \"content\": \"I want a refund\"\n },\n {\n \"role\": \"assistant\",\n \"content\": \"I'd be happy to help with that. Can you tell me more about why you'd like a refund?\"\n }\n ]\n }\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://labs.tacitintelligence.co/api/v1/compare")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"collection_slug\": \"case-management\",\n \"scenario_slug\": \"back-injury-claim\",\n \"response_a\": {\n \"messages\": [\n {\n \"role\": \"user\",\n \"content\": \"I want a refund\"\n },\n {\n \"role\": \"assistant\",\n \"content\": \"Sure, here is your refund.\"\n }\n ]\n },\n \"response_b\": {\n \"messages\": [\n {\n \"role\": \"user\",\n \"content\": \"I want a refund\"\n },\n {\n \"role\": \"assistant\",\n \"content\": \"I'd be happy to help with that. Can you tell me more about why you'd like a refund?\"\n }\n ]\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://labs.tacitintelligence.co/api/v1/compare")
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 \"collection_slug\": \"case-management\",\n \"scenario_slug\": \"back-injury-claim\",\n \"response_a\": {\n \"messages\": [\n {\n \"role\": \"user\",\n \"content\": \"I want a refund\"\n },\n {\n \"role\": \"assistant\",\n \"content\": \"Sure, here is your refund.\"\n }\n ]\n },\n \"response_b\": {\n \"messages\": [\n {\n \"role\": \"user\",\n \"content\": \"I want a refund\"\n },\n {\n \"role\": \"assistant\",\n \"content\": \"I'd be happy to help with that. Can you tell me more about why you'd like a refund?\"\n }\n ]\n }\n}"
response = http.request(request)
puts response.read_body{
"winner": "b",
"reward_a": 0.3,
"reward_b": 0.85,
"margin": 0.55,
"scoring_version": "2.0.0"
}{
"error": "<string>",
"details": {}
}Authorizations
API key obtained from Labs Portal
Body
application/json
Response
Success
Which response won: a, b, or tie
Available options:
a, b, tie Reward score for response_a from 0 to 1
Required range:
0 <= x <= 1Reward score for response_b from 0 to 1
Required range:
0 <= x <= 1Absolute difference between reward_a and reward_b
Version of the scoring algorithm used
⌘I
cURL
curl --request POST \
--url https://labs.tacitintelligence.co/api/v1/compare \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data @- <<EOF
{
"collection_slug": "case-management",
"scenario_slug": "back-injury-claim",
"response_a": {
"messages": [
{
"role": "user",
"content": "I want a refund"
},
{
"role": "assistant",
"content": "Sure, here is your refund."
}
]
},
"response_b": {
"messages": [
{
"role": "user",
"content": "I want a refund"
},
{
"role": "assistant",
"content": "I'd be happy to help with that. Can you tell me more about why you'd like a refund?"
}
]
}
}
EOFimport requests
url = "https://labs.tacitintelligence.co/api/v1/compare"
payload = {
"collection_slug": "case-management",
"scenario_slug": "back-injury-claim",
"response_a": { "messages": [
{
"role": "user",
"content": "I want a refund"
},
{
"role": "assistant",
"content": "Sure, here is your refund."
}
] },
"response_b": { "messages": [
{
"role": "user",
"content": "I want a refund"
},
{
"role": "assistant",
"content": "I'd be happy to help with that. Can you tell me more about why you'd like a refund?"
}
] }
}
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({
collection_slug: 'case-management',
scenario_slug: 'back-injury-claim',
response_a: {
messages: [
{role: 'user', content: 'I want a refund'},
{role: 'assistant', content: 'Sure, here is your refund.'}
]
},
response_b: {
messages: [
{role: 'user', content: 'I want a refund'},
{
role: 'assistant',
content: 'I\'d be happy to help with that. Can you tell me more about why you\'d like a refund?'
}
]
}
})
};
fetch('https://labs.tacitintelligence.co/api/v1/compare', 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://labs.tacitintelligence.co/api/v1/compare",
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([
'collection_slug' => 'case-management',
'scenario_slug' => 'back-injury-claim',
'response_a' => [
'messages' => [
[
'role' => 'user',
'content' => 'I want a refund'
],
[
'role' => 'assistant',
'content' => 'Sure, here is your refund.'
]
]
],
'response_b' => [
'messages' => [
[
'role' => 'user',
'content' => 'I want a refund'
],
[
'role' => 'assistant',
'content' => 'I\'d be happy to help with that. Can you tell me more about why you\'d like a refund?'
]
]
]
]),
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://labs.tacitintelligence.co/api/v1/compare"
payload := strings.NewReader("{\n \"collection_slug\": \"case-management\",\n \"scenario_slug\": \"back-injury-claim\",\n \"response_a\": {\n \"messages\": [\n {\n \"role\": \"user\",\n \"content\": \"I want a refund\"\n },\n {\n \"role\": \"assistant\",\n \"content\": \"Sure, here is your refund.\"\n }\n ]\n },\n \"response_b\": {\n \"messages\": [\n {\n \"role\": \"user\",\n \"content\": \"I want a refund\"\n },\n {\n \"role\": \"assistant\",\n \"content\": \"I'd be happy to help with that. Can you tell me more about why you'd like a refund?\"\n }\n ]\n }\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://labs.tacitintelligence.co/api/v1/compare")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"collection_slug\": \"case-management\",\n \"scenario_slug\": \"back-injury-claim\",\n \"response_a\": {\n \"messages\": [\n {\n \"role\": \"user\",\n \"content\": \"I want a refund\"\n },\n {\n \"role\": \"assistant\",\n \"content\": \"Sure, here is your refund.\"\n }\n ]\n },\n \"response_b\": {\n \"messages\": [\n {\n \"role\": \"user\",\n \"content\": \"I want a refund\"\n },\n {\n \"role\": \"assistant\",\n \"content\": \"I'd be happy to help with that. Can you tell me more about why you'd like a refund?\"\n }\n ]\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://labs.tacitintelligence.co/api/v1/compare")
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 \"collection_slug\": \"case-management\",\n \"scenario_slug\": \"back-injury-claim\",\n \"response_a\": {\n \"messages\": [\n {\n \"role\": \"user\",\n \"content\": \"I want a refund\"\n },\n {\n \"role\": \"assistant\",\n \"content\": \"Sure, here is your refund.\"\n }\n ]\n },\n \"response_b\": {\n \"messages\": [\n {\n \"role\": \"user\",\n \"content\": \"I want a refund\"\n },\n {\n \"role\": \"assistant\",\n \"content\": \"I'd be happy to help with that. Can you tell me more about why you'd like a refund?\"\n }\n ]\n }\n}"
response = http.request(request)
puts response.read_body{
"winner": "b",
"reward_a": 0.3,
"reward_b": 0.85,
"margin": 0.55,
"scoring_version": "2.0.0"
}{
"error": "<string>",
"details": {}
}