POST
/
lmunit
curl --request POST \
  --url https://api.contextual.ai/v1/lmunit \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "query": "<string>",
  "response": "<string>",
  "unit_test": "<string>"
}'
{
  "score": 123
}

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Body

application/json

LMUnit input request object.

query
string
required

The prompt to which the model responds

response
string
required

The model response to evaluate

unit_test
string
required

A natural language statement or question against which to evaluate the response

Response

200
application/json
Successful Response

LMUnit result object.

score
number
required

The response is scored on a continuous scale from 1 to 5 on the unit test. The discrete scores 1, 2, 3, 4, and 5 roughly correspond to "Strongly fails," "Fails," "Neutral," "Passes," and "Strongly passes," respectively.