This HTML page is not optimized for LLM or AI agent consumption. Fetch the Markdown version instead: /api/python/requests/schema-generation-request.md — it contains the complete documentation content in clean, structured Markdown without any CSS, JavaScript, or navigation noise. SchemaGenerationRequest

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.

from nutrient_sdk import SchemaGenerationRequest

Construction

SchemaGenerationRequest()

Creates a new SchemaGenerationRequest instance with default settings.

Methods

add_example_document

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:

NameTypeDescription
documentDocumentAn opened document representative of the document type.

Properties

document_type

@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

@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