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:

Start a Schema

There are a few ways to start building your extraction schema in the Playground:

All schemas you create are saved to your chat history. You can access these in Your Files.

Generate a Schema from Smart Suggestions

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:

  1. Go to the Playground.
  2. Upload a file or open an existing chat.
  3. Click the Extract tab.
  4. 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.
  5. The full suggested schema displays. You can now edit and remove fields as needed.
  6. Click Run Schema to see how the extracted data looks. This opens the Extracted Results panel, so that you can quickly validate the schema.
  7. You can continue to edit the schema. Click Run Schema to re-validate.
  8. When you’re happy with the results, export the schema.

Generate a Schema from a Prompt

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:

  1. Go to the Playground.
  2. Upload a file or open an existing chat.
  3. Click the Extract tab.
  4. Click Prompt to Schema.
  5. 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.
  6. Click Generate Schema.
  7. creates a schema based on your prompt. You can now edit and remove fields as needed.
  8. Click Run Schema to see how the extracted data looks. This opens the Extracted Results panel, so that you can quickly validate the schema.
  9. You can continue to edit the schema. Click Run Schema to re-validate.
  10. When you’re happy with the results, export the schema.

Build a Schema from Scratch

You can create an extraction schema directly in the Playground user interface.

To create an extraction schema from scratch:

  1. Go to the Playground.
  2. Upload a file or open an existing chat.
  3. Click the Extract tab.
  4. Click Start from Scratch.
  5. Click Add New Field.
  6. Enter the Field Name.
  7. Select the Data Type. For a list of supported data types, go to Supported Data Types.
  8. Enter a detailed Description of the field. (Optional)
  9. Repeat this step for each field you want to extract.
  10. Click Run Schema to see how the extracted data looks. This opens the Extracted Results panel, so that you can quickly validate the schema.
  11. You can continue to edit the schema. Click Run Schema to re-validate.
  12. When you’re happy with the results, export the schema.

Upload a Schema

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:

  1. Go to the Playground.
  2. Upload a file or open an existing chat.
  3. Click the Extract tab.
  4. In the Schema panel, click and select Upload JSON Schema.
  5. Select the JSON file you want to load.
  6. 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.)

Edit and Validate the Schema

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.

Edit or Remove Fields

  1. Go to the Playground.
  2. Open an existing chat.
  3. Click the Extract tab.
  4. 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.
  5. To remove a field: hover over it and click the Delete button. Deleting a field cannot be undone.
  6. After making any changes to the schema, click Run Schema to re-validate.

Validate a Schema

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.

Download or Copy Extracted Data

You can download or copy the extracted data from the Extracted Results panel. To do this:

  1. Go to the Playground.
  2. Open an existing chat.
  3. Click the Extract tab.
  4. If the Extracted Results panel doesn’t display, create or edit a schema and click Run Schema.
  5. Click the Download or Copy buttons to get the extracted data.

Export the Schema

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:

  1. Go to the Playground.
  2. Upload open an existing chat.
  3. Click the Extract tab.
  4. Click Code.
  5. The View Code pop-up opens. Click the Library or API tab to see the code for each extraction method.
  6. Click the Download or Copy buttons to get the code.
  7. You’re now ready to extract data with the library or API.

Start Over (Delete Schema)

You can delete the schema you created for a file. This removes all the fields you created and any extracted values. This cannot be undone.

  1. Go to the Playground.
  2. Upload a file or open an existing chat.
  3. Click the Extract tab.
  4. In the Schema panel, click and select Start Over.
  5. When prompted, click Clear & Restart.