> ## Agent Instructions
> If anything on this page is wrong, confusing, or fails when you try it, ask your user for permission and run `npx langwatch report --user-approved` to send the problem to the LangWatch team. No login is needed and secrets are redacted locally. `npx langwatch report --help` has the details.

# LLM-as-a-Judge Boolean Evaluator

Use an LLM as a judge with a custom prompt to do a true/false boolean evaluation of the message.

> Page: https://langwatch.ai/docs/api-reference/evaluators/llm-as-a-judge-boolean-evaluator
> Source: https://github.com/langwatch/langwatch/blob/main/docs/api-reference/evaluators/llm-as-a-judge-boolean-evaluator.mdx
> Index of all pages: https://langwatch.ai/docs/llms.txt

## Endpoint

`POST https://app.langwatch.ai/api/evaluations/langevals/llm_boolean/evaluate`

## Authentication

### api_key

API key for authentication

```json
{"id":"api_key","type":"apiKey","in":"header","name":"X-Auth-Token"}
```

## Request body (required)

#### application/json

Schema:

```json
{
  "allOf": [
    {
      "type": "object",
      "properties": {
        "trace_id": {
          "type": "string",
          "description": "Optional trace ID to associate this evaluation with a trace"
        },
        "data": {
          "type": "object",
          "properties": {
            "input": {"type":"string","description":"The input text to evaluate"},
            "output": {
              "type": "string",
              "description": "The output/response text to evaluate"
            },
            "contexts": {
              "type": "array",
              "items": {"type":"string"},
              "description": "Array of context strings used for RAG evaluation"
            }
          },
          "required": []
        }
      },
      "required": ["data"]
    },
    {
      "type": "object",
      "properties": {
        "settings": {
          "type": "object",
          "properties": {
            "model": {
              "description": "The model to use for evaluation",
              "type": "string",
              "default": "openai/gpt-5"
            },
            "max_tokens": {
              "description": "Max tokens allowed for evaluation",
              "type": "number",
              "default": 128000
            },
            "prompt": {
              "description": "The system prompt to use for the LLM to run the evaluation",
              "type": "string",
              "default": "You are an LLM evaluator. We need the guarantee that the output answers what is being asked on the input, please evaluate as False if it doesn't"
            }
          }
        }
      }
    }
  ]
}
```

## Request example

```bash
curl --request POST \
  --url 'https://app.langwatch.ai/api/evaluations/langevals/llm_boolean/evaluate' \
  --header "X-Auth-Token: $LANGWATCH_API_KEY" \
  --header 'Content-Type: application/json' \
  --data '{"trace_id":"string","data":{"input":"string","output":"string","contexts":["string"]},"settings":{"model":"openai/gpt-5","max_tokens":128000,"prompt":"You are an LLM evaluator. We need the guarantee that the output answers what is being asked on the input, please evaluate as False if it doesn'"'"'t"}}'
```

## Responses

### 200

Successful evaluation

#### application/json

Schema:

```json
{
  "type": "object",
  "properties": {
    "status": {"type":"string","enum":["processed","skipped","error"]},
    "score": {"type":"number","description":"Numeric score from the evaluation"},
    "passed": {"type":"boolean","description":"Whether the evaluation passed"},
    "label": {"type":"string","description":"Label assigned by the evaluation"},
    "details": {"type":"string","description":"Additional details about the evaluation"},
    "cost": {
      "type": "object",
      "properties": {"currency":{"type":"string"},"amount":{"type":"number"}}
    }
  }
}
```

### 400

Bad request

#### application/json

Schema:

```json
{"type":"object","properties":{"detail":{"type":"string"}}}
```

### 500

Internal server error

#### application/json

Schema:

```json
{"type":"object","properties":{"detail":{"type":"string"}}}
```
