Schema Wizard: Build Extraction Schemas in the Playground
To make it as easy as possible to build an extraction schema, we’ve created a wizard in our Playground that guides you through the process.Here is the workflow for building a schema in the playground:
After you upload a document to the Playground and open the Extract tool, suggests a schema based on the fields and your document layout. Accept the suggestions and further customize and validate your schema as needed.To create an extraction schema based on smart suggestions:
By default, Smart Suggestion is enabled. The app reviews your document and suggests a schema based on the logical structure of the document. To accept the schema and use it as a starting point, click Start with Suggestions. You can edit the schema in the next step.
The full suggested schema displays. You can now edit and remove fields as needed.
Click Run Schema to see how the extracted data looks. This opens the Extracted Results panel, so that you can quickly validate the schema.
You can continue to edit the schema. Click Run Schema to re-validate.
After you upload a document to the Playground and open the Extract tool, you can prompt to extract specific fields.This is useful if you only want to extract certain fields, and not all the data in the document. For example, let’s say that you’re reviewing bank account statements, but you only need to know the account number and the closing balance on the account. In this case, you could prompt to return only these two fields.To create an extraction schema from a prompt:
Enter a very clear and detailed prompt. Specify the exact fields you want to extract. Explain how they are labeled in the document, and if you want them labeled differently in the extracted results.
Click Generate Schema.
creates a schema based on your prompt. You can now edit and remove fields as needed.
Click Run Schema to see how the extracted data looks. This opens the Extracted Results panel, so that you can quickly validate the schema.
You can continue to edit the schema. Click Run Schema to re-validate.
If you have an existing extraction schema you want to edit, you can upload it to the Playground to validate it. Uploaded schemas cannot be edited directly in the Playground.Uploading a schema replaces any existing schema and extracted values.To upload an existing extraction schema:
In the Schema panel, click … and select Upload JSON Schema.
Select the JSON file you want to load.
The app loads the JSON file and switches to the Code Editor. This opens the Extracted Results panel, so that you can quickly validate the schema. (If prompted, click Run to update.)
After creating a schema in the Playground, you can edit and validate it. You can add fields, update descriptions, remove fields, and validate the full schema.
To edit a field: click the element you want to edit. For example, if you want to change a field type from String to Number, click String and select Number.
To remove a field: hover over it and click the Delete button. Deleting a field cannot be undone.
After making any changes to the schema, click Run Schema to re-validate.
After creating or editing a schema in the Playground, click Run Schema to validate it.Running a schema refreshes the Extracted Results panel. The Extracted Results panel displays two sets of content:
Data: This is the list of extracted key-value pairs.
Metadata: This is the list of chunk_references for each extracted value.
After creating and validating a schema, you are now ready to export it to use with the library or API.Exporting the schema creates the full code you will need to parse and extract with either the library or API.To export the extraction schema: