---
title: "LLM as judge"
description: "Score model output with a second model, as a chain of computed columns"
url: "https://www.pixeltable.com/notebooks/pattern-llm-judge"
updated: "2026-09-08"
---

# LLM as judge

Score model output with a second model, as a chain of computed columns

- **Type:** Recipe
- **Group:** Agents

## What it covers

- The table
- The answer under test
- The judge prompt
- The verdict and the score

## What it uses

- **Pixeltable calls:** `openai.chat_completions()`, `pxt.create_table()`, `@pxt.udf`, `add_computed_column()`, `insert()`

## A look at the code

```python
runs.add_computed_column(
    response=openai.chat_completions(
        messages=[{'role': 'user', 'content': runs.prompt}], model='gpt-4o-mini'
    )
)
runs.add_computed_column(answer=runs.response.choices[0].message.content)
```

## Open it

- **Docs page:** https://docs.pixeltable.com/howto/cookbooks/agents/pattern-llm-judge
- **Source on GitHub:** https://github.com/pixeltable/pixeltable/blob/release/docs/release/howto/cookbooks/agents/pattern-llm-judge.mdx
