Allow the split as system/user prompt

Created on 17 May 2025, 21 days ago

Problem/Motivation

Currently the AI Search Block builds a single combined prompt that includes both instructions and content. When feeding large volumes of content (e.g. dozens of articles), many smaller LLMs tend to drift from the initial instructions. Splitting instructions into a dedicated “system” prompt ensures the model consistently follows its role definition.

Proposed resolution

  • Add an optional “Enable system/user split” checkbox to the block’s settings form.
  • When enabled, display two textareas via #states:
    • system_prompt – the role/instruction message.
    • user_prompt – content & question placeholder (e.g. “{{ articles }}\n\n{{ query }}”).
  • Modify the prompt builder service so that:
    1. If split enabled: send system_prompt as the system message and user_prompt (with tokens substituted) as the user message.
    2. Otherwise: fall back to original single‑prompt behavior.

User interface changes

  • New checkbox: enable_system_user_split under “Prompt settings”.
  • Conditional textareas:
    • system_prompt (instruction role).
    • user_prompt (articles + query template).
  • Field descriptions explaining substitution tokens ({{ articles }}, {{ query }}).

Remaining tasks

  1. Implement new form elements and #states in AI_search_block\Form\SettingsForm.
  2. Extend prompt builder to detect and split into two messages.
Feature request
Status

Active

Version

1.0

Component

Code

Created by

🇪🇸Spain Nikro Benalmadena, Malaga

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024