Skip to content

Calculate Comet

POST
/calculate_comet
curl --request POST \
--url https://example.com/calculate_comet \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{ "source": "example", "hypothesis": "example", "reference": "example" }'

Calculate COMET score for a translation using source, hypothesis, and reference.

COMET is a neural evaluation metric that correlates better with human judgment than traditional metrics. It requires the source text in addition to hypothesis and reference.

Note: This calls the remote COMET model endpoint and may take longer than BLEU/CHRF.

Media typeapplication/json
CometScoringRequest
object
source
required
Source

Original source text

string
>= 1 characters
hypothesis
required
Hypothesis

Machine translation to evaluate

string
>= 1 characters
reference
required
Reference

Reference translation

string
>= 1 characters
Examplegenerated
{
"source": "example",
"hypothesis": "example",
"reference": "example"
}

Successful Response

Media typeapplication/json
CometScoringResponse
object
score
Any of:
number
processing_time_ms
required
Processing Time Ms

Processing time in milliseconds

number
success
required
Success

Whether the COMET evaluation succeeded

boolean
error_message
Any of:
string
Examplegenerated
{
"score": 1,
"processing_time_ms": 1,
"success": true,
"error_message": "example"
}

Validation Error

Media typeapplication/json
HTTPValidationError
object
detail
Detail
Array<object>
ValidationError
object
loc
required
Location
Array
msg
required
Message
string
type
required
Error Type
string
input
Input
ctx
Context
object
Examplegenerated
{
"detail": [
{
"loc": [
"example"
],
"msg": "example",
"type": "example",
"input": "example",
"ctx": {}
}
]
}