---
title: Example
seo:
  title: Example — Python SDK
  description: A single evaluation example with flexible key-value properties. (Python SDK)
description: A single evaluation example with flexible key-value properties.
---

Use `Example.create()` to build examples with any fields your scorers
need. Common fields include `input`, `actual_output`, `expected_output`,
and `retrieval_context`, but you can add any custom fields.

Access properties with bracket notation: `example["input"]`.

Create an example for evaluating a Q\&A system:

```python
example = Example.create(
    input="What is the capital of France?",
    actual_output="Paris is the capital of France.",
    expected_output="Paris",
)
```

Include retrieval context for RAG evaluation:

```python
example = Example.create(
    input="What is Python?",
    actual_output="A programming language.",
    retrieval_context=["Python is a high-level programming language..."],
)
```

Access properties:

```python
print(example["input"])      # "What is Python?"
print("input" in example)    # True
```

## Attributes

| Prop | Type | Default | Description |
| - | - | - | - |
| `example_id?` | `str` | `field(default_factory=(lambda: str(uuid.uuid4())))` | |
| `created_at?` | `str` | `field(default_factory=(lambda: datetime.utcnow().isoformat()))` | |
| `name?` | `Optional[str]` | `None` | |
| `trace?` | `Optional[Trace]` | `None` | |
| `properties?` | `Dict[str, Any]` | - | Return a copy of the example's custom properties. |

***

## create()

Create an example with the given properties.

```python
def create(**kwargs) -> Example:
```

### Parameters

| Prop | Type | Default | Description |
| - | - | - | - |
| `kwargs?` | `Any` | `{}` | |

### Returns

`Example` - A new `Example` instance.

***

## to\_dict()

Serialize the example to a dictionary suitable for the API.

```python
def to_dict() -> APIExample:
```

### Returns

`APIExample`
