---
title: CategoricalResponse
seo:
  title: CategoricalResponse — Python SDK
  description: Response for classification-style scorers. (Python SDK)
description: Response for classification-style scorers.
---

Subclass this and define a `categories` class variable listing every
allowed category. The `value` is validated against this list.

```python
class SentimentResponse(CategoricalResponse):
    categories = [
        Category(value="positive", description="Positive sentiment"),
        Category(value="neutral", description="Neutral sentiment"),
        Category(value="negative", description="Negative sentiment"),
    ]

class SentimentJudge(Judge[SentimentResponse]):
    async def score(self, data: Example) -> SentimentResponse:
        return SentimentResponse(
            value="positive",
            reason="The output has an enthusiastic tone.",
        )
```

## Attributes

| Prop | Type | Default | Description |
| - | - | - | - |
| `value?` | `str` | - | The selected category label. |
| `categories?` | `List[Category]` | - | Class-level list of allowed Category objects. |
| `reason?` | `str` | - | |
| `citations?` | `Optional[List[Citation]]` | `None` | |

***

## validate\_value\_in\_categories()

```python
def validate_value_in_categories():
```
