> [!WARNING]
>
> **Preview**
>
>
> This product is
>
> subject to the "Pre-GA Offerings Terms" in the General Service Terms section of the
> [Service Specific
> Terms](https://docs.cloud.google.com/terms/service-terms#1).
>
> Pre-GA products are available "as is" and might have limited support.
>
> For more information, see the
> [launch stage descriptions](https://cloud.google.com/products/#product-launch-stages).

Document AI's automated schema generation lets you automatically generate a
document's schema from a test document you supply. Then, you can approve or
decline the schema and edit it manually. This saves time and effort when defining
the document schema for your custom processor and lets you focus on refining the
schema.

Automated schema generation also has a wider knowledge base on creating high
quality schemas. This can potentially improve document extraction quality.

## Generate a schema

If you haven't already snapshotted or fine-tuned your processor, take the following steps.

> [!NOTE]
> **Note:** If you've snapshotted or fine-tuned the processor, the option in the first step isn't displayed. The existing fields can't be deleted.

1. On the **Get started** tab, select **Generate schema from document** . The
   **Edit schema** page opens.

   ![cde-schema-generation-1](https://docs.cloud.google.com/static/document-ai/docs/images/create/cde-schema-generation-1.png)
2. Use the input field to select a local file file to generate the schema, or
   use the **Browse** option to upload a sample document.

   ![cde-schema-generation-2](https://docs.cloud.google.com/static/document-ai/docs/images/create/cde-schema-generation-2.png)

   > [!TIP]
   > **Tip:** Enter a prompt in **Generate a schema prompt** to provide additional input and direction for the generator.

3. Select **Generate Schema**.

4. Review the generated schema preview. You can choose accept or reject the
   schema with **Apply schema** or **Abort schema**, to try again with a different
   sample document or prompt.

   ![cde-schema-generation-3](https://docs.cloud.google.com/static/document-ai/docs/images/create/cde-schema-generation-3.png)

   > [!TIP]
   > **Tip:** You can use the **View More** option by each field to edit the auto-generated schema after applying it.

5. Optional: If the resulting schema doesn't serve your
   needs, or requires more than manual editing, you can enter a prompt in **Generate
   a schema prompt** to provide additional input and direction for the generator.
   Try prompts such as: specifying the document type, stating the most important
   parts of the document, or suggesting a target number of entities.

## What's next

- Learn about [uptraining a specialized processor](https://docs.cloud.google.com/document-ai/docs/uptrain-pretrained-processor).
- Explore [validation and correction](https://docs.cloud.google.com/document-ai/docs/ce-validation).