Allow chat history to be sent to AI engine (#6128)

# Description of Changes
Add an extra parameter to every agent to receive the conversation
history in addition to the current message. This will make it possible
to answer followup questions from the AI without needing to give full
context in your message.
This commit is contained in:
James Brunton
2026-04-21 15:03:10 +00:00
committed by GitHub
parent f779085d75
commit 2a856fbc19
14 changed files with 116 additions and 19 deletions
+2
View File
@@ -13,6 +13,7 @@ from stirling.contracts import (
PdfEditRequest,
PdfEditResponse,
ToolOperationStep,
format_conversation_history,
)
from stirling.models import OPERATIONS, ApiModel, ParamToolModel, ToolEndpoint
from stirling.services import AppRuntime
@@ -146,6 +147,7 @@ class PdfEditAgent:
def _build_selection_prompt(self, request: PdfEditRequest) -> str:
file_names = ", ".join(request.file_names) if request.file_names else "No file names were provided."
return (
f"Conversation history:\n{format_conversation_history(request.conversation_history)}\n"
f"User request: {request.user_message}\n"
f"Files: {file_names}\n"
f"Supported operations: {self._supported_operations_prompt()}\n"