Retrieval hooks

Developers can adjust how many content slices from a single page, post, or product are sent to the AI with each question.

By default SensAI sends the single highest-scoring chunk per post so one long page cannot fill the context window. That default is unchanged unless you add a filter.

wpai_retrieval_final_chunks_per_post

Purpose:
Raise (or keep) how many retrieved chunks from one post ID may appear in the final context.

Arguments:

$n (int): Current limit. Default: 1
$post_id (int): WordPress post ID of the retrieved item

Return an integer of 1 or more. Values below 1 are treated as 1.

Example (Code Snippet or child theme):
Allow two slices from one long page so fields that live in different chunks (for example two sections of the same listing) can both reach the AI. Replace 12345 with the page ID (Pages → edit the page → the ID in the URL).

add_filter('wpai_retrieval_final_chunks_per_post', function  ($n, $post_id) {
if ((int) $post_id === 12345) {
return 2;
}
return (int) $n;
}, 10, 2);

Notes:

  • Sites that do not add this filter keep one chunk per post.
  • Raising the count uses more of the context window for that page and can crowd out other pages.
  • This does not index extra content. It only allows more already-indexed slices of that post into the chat turn.
  • Requires SensAI 1.1.6 or later.
Use of your personal data
We and our partners process your personal data (such as browsing data, IP Addresses, cookie information, and other unique identifiers) based on your consent and/or our legitimate interest to optimize our website, marketing activities, and your user experience.