Skip to content

[Enhancement] Pass session history to Follow Up Prompts to enable deduplication of suggested questions #6378

@ivannalevchuk

Description

@ivannalevchuk

Problem / motivation

The Follow Up Prompts feature currently passes only the current bot response (apiMessage.content) as the {history} variable in the prompt template.

Because the model has no access to the previous conversation context, it is technically "blind" to the rest of the session. Any prompt instructions requiring session awareness will automatically fail.

Use case

A common scenario is configuring Follow Up Prompts to select from a fixed list of predefined questions (rather than generating new ones freely).

To prevent looping, a user adds a prompt rule like: "Never suggest a question the user has already asked in this session."
With the current implementation, this rule cannot work. The model has no way to know which questions from the list were already discussed, making it impossible to avoid duplicate suggestions across a multi-turn conversation.

Proposed improvement

Either:

  • Option A — change {history} to contain the full session history instead of just the current response
  • Option B — keep {history} as-is and introduce a new variable, e.g. {session_history}, that contains all messages from the current session
    Option B is preferred as it is fully backward-compatible with existing prompt configurations.

Why this change is safe

  • Strictly backward-compatible (Option B) - the existing {history} variable remains untouched, meaning no current user setups will break.
  • Minimal change - modifies only a few lines in the pipeline.
  • Improves prompt control for follow-up generation without breaking existing configurations

Suggested labels: enhancement, follow-up-prompts

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions