---
title: "LMUnit"
method: POST
path: "/lmunit"
tags: ["/lmunit"]
---

# LMUnit

`POST /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](https://contextual.ai/news/lmunit/). Email [lmunit-feedback@contextual.ai](mailto:lmunit-feedback@contextual.ai) with any feedback or questions.

>🚀 Obtain an LMUnit API key by completing [this form](https://contextual.ai/request-lmunit-api/)

## Request body

- LMUnitRequestV1 — 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`

Successful Response

- LMUnitResponseV1 — 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.

## Other responses

- `422` — Validation Error

---

[API](https://skmtc.net/contextualai/apis/endpoints.md) · [All operations](https://skmtc.net/contextualai/apis/endpoints/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/contextualai/endpoints/versions/ca7f807eec8b/schema)
