Query extraction tips

This Sensible Instruct method extracts an individual fact in a document, such as the date of an invoice, the liability limit of an insurance policy, or the destination address of a shipping container delivery.

Prompt Tips

  • Try framing each prompt so that it has a single, short answer such as:

    • "company address"
    • "name of recipient"
    • "document date"
  • See the following resources for creating prompts:

  • You can narrow down your search and disambiguate between multiple possible answers by adding location information to prompts:

    Location relative to page number and position on page

    • "address in the top left of the first page of the document"

    • "What is the medical paid value on the last claim of the second page?"

    • "consumer electronics device with highest sales mentioned near end of document"

      Location relative to content in document

    • "total amount in the expense table"

    • "phone number after section 2"


  • For information about troubleshooting error messages about prompts, see Qualifying LLM accuracy.

  • You can view the source text for an LLM's answer highlighted in the document. In the Sensible Instruct editor, click the Location button in the output of a query field to view its source text in the document. For more information about how location highlighting works and its limitations, see Location highlighting.

    Click to enlarge


Example 1

The following example shows using the Query method to extract agricultural data from a government report:

Click to enlarge

To try out this example in the Sensible app, take the following steps:

  1. Download the following example document:

    Example documentDownload link
  2. Create a test document type in the Sensible app, then click the document type you created to edit it. In the document type's Reference documents tab, upload the example document you downloaded in a previous step.

  3. Click the document type's Configurations tab, create a new test configuration, and click the configuration you created to edit it.

  4. Click Sensible Instruct and create fields to extract data using the following table:

Field nameMethodPrompt
report_dateQuery"for which month and year does this report describe wheat production. look in beginning of the document for the answer"
change_in_productionQuery"by what amount did US wheat production estimate change this month? if it didn't change, respond with 'no change'""
seed_useQuery"what was US wheat seed use this year in the US in millions of bushels?"
seed_use_changeQuery"by what amount did US wheat seed use change this year, in million bushels? Use a negative sign for negative change and a positive sign for positive change"
global_wheat_production_changeQueryby what amount did global wheat production change this year, measured in MMT? look near the end of the document for the answer"


For the full reference for this method in SenseML, see Query method.