---
title: "SchemaGenerationRequest"
canonical_url: "https://www.nutrient.io/api/python/requests/schema-generation-request/"
md_url: "https://www.nutrient.io/api/python/requests/schema-generation-request.md"
last_updated: "2026-07-15T14:46:57.766Z"
description: "Describes a schema generation request for `GenerateSchema`. Carries the document type the schema must represent, an optional free-form requirement, and up to f…"
---

Describes a schema generation request for `GenerateSchema`. Carries the document type the schema must represent, an optional free-form requirement, and up to five example documents that ground the schema in real layouts.

The example documents are treated as representative samples of future documents the schema has to fit — not as an exhaustive list. The shape of the generated schema (field budget, nesting, target structured-output dialect) is controlled separately via `SchemaGenerationSettings`.

```python

from nutrient_sdk import SchemaGenerationRequest

```

## Construction

```python

SchemaGenerationRequest()

```

Creates a new `SchemaGenerationRequest` instance with default settings.

## Methods

### add_example_document

```python

def add_example_document(self, document: Document) -> None

```

Adds an example document to the request. Up to five example documents can be added; they act as grounding samples of the documents the generated schema has to represent.

**Parameters:**

| Name       | Type                                | Description                                             |
| ---------- | ----------------------------------- | ------------------------------------------------------- |
| `document` | [`Document`](/api/python/document/) | An opened document representative of the document type. |

---

## Properties

### document_type

```python

@property
def document_type(self) -> str

@document_type.setter
def document_type(self, value: str) -> None

```

The class of documents the schema must represent (for example, "invoice" or "lab report"). Required; grounds the schema vocabulary.

**Type:** `str`

---

### requirement

```python

@property
def requirement(self) -> str

@requirement.setter
def requirement(self, value: str) -> None

```

Optional natural-language description of what the schema must capture: fields of interest, granularity, naming preferences, or anything else an extraction engineer would tell a colleague.

**Type:** `str`

---

---

## Related pages

- [All public classes import directly from the top-level package:](/api/python/requests.md)
- [Classification Request](/api/python/requests/classification-request.md)
- [Structured Extraction Request](/api/python/requests/structured-extraction-request.md)

