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.


  • 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"


Sensible returns the following error messages when the LLM is uncertain about the accuracy of the extracted data. Note that LLMs can inaccurately report uncertainties. For more information about uncertainties, see Accuracy measures.

Multiple possible answersThe context that Sensible provides to the LLM contains multiple possible answers.- To return multiple answers, use the List method.
- To return a single answer, tweak the context that Sensible provides to the LLM using chunk parameters so that the context contains a single answer.
Answer might not fully answer the questionThe context that Sensible provides to the LLM might not contain the full answer.- Tweak the context that Sensible provides to the LLM using chunk parameters.
- Simplify your question, for example, break it up into multiple questions.
Answer not found in the contextThe context that Sensible provides to the LLM doesn't contain the answer.- Tweak the context that Sensible provides to the LLM using chunk parameters.
Ambiguous queryThe LLM identified ambiguities in your question.Rephrase your question using the tips in the tips section.


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 PDF:

    Example PDFDownload 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 PDF 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 Question method.