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 SchemaGenerationRequestConstruction
SchemaGenerationRequest()Creates a new SchemaGenerationRequest instance with default settings.
Methods
add_example_document
def add_example_document(self, document: Document) -> NoneAdds 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 | An opened document representative of the document type. |
Properties
document_type
@propertydef document_type(self) -> str
@document_type.setterdef document_type(self, value: str) -> NoneThe class of documents the schema must represent (for example, “invoice” or “lab report”). Required; grounds the schema vocabulary.
Type: str
requirement
@propertydef requirement(self) -> str
@requirement.setterdef requirement(self, value: str) -> NoneOptional 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