Advanced prompt configuration

You can configure the full prompt that Sensible inputs to a large language model (LLM). You can apply configurations to multiple fields in a config, and you can override them for individual fields.

When you write a prompt in a Sensible Instruct method, Sensible combines your prompt with other information to create the full prompt. The full prompt includes:

  • a prompt introduction
  • "context", made up of chunks excerpted from the document and of page metadata. For more information about chunks, see the Notes section.
  • concatenated descriptive prompts you configure in a Sensible Instruct method, such as in the List or Query Group methods.

See the following image for an example of a full prompt that Sensible inputs to an LLM for the Query Group method:

Click to enlarge

The following table shows parameters that configure parts of the full prompt and that are global, or common to all Sensible Instruct methods:

keydescriptionglobal parameter name
AOverall description of the chunks.
The preceding image shows an example of a user-configured context description overriding the default.
Context Description
BPage metadata for chunks.Page Hinting
CChunks, or "context", excerpted from document.Chunk Count
Chunk Size
Chunk Overlap Percentage
Page Range
DConcatenation of all the descriptive prompts you configured in the method. For example, concatenation of all the column descriptions and the overall table description for the NLP Table method.Description

You can configure all of these parameters in the SenseML editor and in the Sensible Instruct editor. For example, the following screenshots show prompt settings in Sensible Instruct for a Query Group field:

Click to enlarge

The following screenshot shows prompt settings in Sensible Instruct for all fields in a config:

Click to enlarge

Global Sensible Instruct parameters

The following table shows global parameters, or parameters that are common to all Sensible Instruct methods. You can configure these parameters for all fields in a config, or on a field-by-field basis.

For parameters specific to a Sensible instruct method, see its reference topic, for example, the Query Group method reference topic. Like global parameters, method-specific parameters can be set for all fields in a config, or on a field-by-field basis.

SenseML parametervalueconfig-level description:
configure in NLP preprocessor or in Sensible Instruct configuration settings
method-level description:
configure in a field
confidenceSignalsboolean.
defaults: true in Sensible Instruct editor,
false in SenseML editor
If specified, Sensible prompts the LLM to report any uncertainties it has about the accuracy of its response. For more information, see Qualifying LLM accuracy.
Applies to each supported method in the config. Sensible currently supports this parameter for the Query Group method.
Overrides config-level parameter for a single field.
contextDescriptionstring. default: The below context is an excerpt from a document.Configures context's metadata. For details about context and chunks, see the Notes section.
Overwrites the default context description.
Applies to each Sensible Instruct field in the config.
For example:
- The below context is an excerpt from a scanned index card that contains botanical information about a single plant species, including phenology information.
- The below context is an excerpt from an email. Assume the sender is always an automated system from an insurance broker.
Overrides config-level parameter for a single field.
pageHintingboolean. default: trueConfigures context's metadata. For details about context and chunks, see the Notes section.
Includes or or removes page metadata for each chunk from the full prompt Sensible inputs to an LLM.
Applies to each Sensible Instruct field in the config.
For example, if your PDF converter automatically applied page numbers to scanned ID cards, set this parameter to false to ignore the page numbers, since their relationship to the cards' text is arbitrary.

If set to true, then you can add location information to a prompt to narrow down the context's location. For example:
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?"
Location relative to content in document
- "total amount in the expense table"
- "phone number after section 2"
Overrides config-level parameter for a single field.
chunkCountnumber. default: see each method's reference topicFor more information about the Page HintingConfigures context's size. For details about context and chunks, see the Notes section.
The number of top-scoring chunks Sensible combines as context as part of the full prompt it submits to an LLM.
Applies to each Sensible Instruct field in the config.
Often, chunk count and chunk size are related. For example, if you know that your target data are spread over 7-10 pages, and occupy a small portion of those pages, you can specify a chunk count of 10 and a half-page chunk size.
Overrides config-level parameter for a single field.
chunkSize0.5, 1 default: see each method's reference topicConfigures context's size. For details about context and chunks, see the Notes section.
The size of the chunks Sensible splits the document into, as a page fraction. For example, 0.5 specifies each chunk is half a page.
Applies to each Sensible Instruct field in the config.
Often, chunk count and chunk size are related. For example, if you know that the data you seek is contained in one cover page, you can set chunk size to 1 and a chunk count to 1.
Overrides config-level parameter for a single field.
chunkOverlapPercentage0, 0.25, 0.5 default: see each method's reference topicConfigures context's size. For details about context and chunks, see the Notes section.
The extent to which chunks overlap, as a percentage of the chunks' height. For example, 0.5 specifies each chunk overlaps by half its height.
Applies to each Sensible Instruct field in the config.
Sensible recommends setting a non-zero overlap to avoid splitting data across chunks. Set overlap to 0 solely if you're confident that your document layout doesn't flow across page boundaries and you're using a one-page chunk size.
Overrides config-level parameter for a single field.
pageRangeobjectConfigures the context's range in the document. For details about context and chunks, see the Notes section.
If specified, Sensible creates chunks in the page range and ignores other pages. For example, use this parameter to improve performance, or to avoid extracting unwanted data if your prompt has multiple candidate answers.

Contains the following parameters:
startPage: Zero-based index of the page at which Sensible starts creating chunks (inclusive).
endPage: Zero-based index of the page at which Sensible stops creating chunks (exclusive).

Note: Sensible ignores this parameter when searching for a field's anchor. If you want to exclude the field's anchor from the page range, use the Page Range preprocessor instead.
Overrides config-level parameter for a single field.
(Deprecated) promptIntroductionstringDeprecated. Overwrites the introductory text at the beginning of the full prompt that Sensible submits to the LLM.

Notes

For an overview of how Sensible Instruct methods work, see the following steps.

  1. To meet the LLM's input token limit, Sensible splits the document into chunks.
  2. Sensible selects the most relevant chunks and combines them with page-hinting data to create a "context".
  3. Sensible creates a full prompt for the LLM that includes the context and the descriptive prompts you configure in the method. For an example of a full prompt, see the beginning of this topic.
  4. Sensible returns the LLM's response.

For specifics about how each Sensible instruct method works, see the Notes section for each method's SenseML reference topic, for example, List method.