v21

latestOpenAPI 3.1.0raw.githubusercontent.com2026-01-1340148239.5 KB
/lmunit

LMUnit

Given a query, response, and a unit_test, return the response's score on the unit test on a 5-point continuous scale. The total input cannot exceed 7000 tokens.

See a code example in our blog post. Email lmunit-feedback@contextual.ai with any feedback or questions.

🚀 Obtain an LMUnit API key by completing this form

post/lmunit

Request body

querystring required

The prompt to which the model responds

responsestring required

The model response to evaluate

unit_teststring required

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

Response

Successful Response

scorenumber 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.