TsgcAIOpenAIChatBotMethods › ChatAsSystem

ChatAsSystem Method

Sends a system-role instruction to steer the assistant; speech output is off by default.

Syntax

void __fastcall ChatAsSystem(const UnicodeString aText, bool aTextToSpeech = False, TsgcOpenAIArray_Request_Completion_Messages * aHistory = nil);

Parameters

NameTypeDescription
aTextconst stringThe system-role instruction that conditions the assistant (for example persona, tone, or RAG context).
aTextToSpeechBooleanWhen True, the assistant reply is also spoken through TextToSpeech. Defaults to False.
aHistoryTsgcOpenAIArray_Request_Completion_MessagesOptional earlier messages that should precede the system instruction. Pass nil to start fresh.

Remarks

Use this method to inject persona or retrieval context before the next user turn. Because no user prompt is sent, aTextToSpeech defaults to False — the assistant would just acknowledge the instruction. Combine ChatAsSystem with a follow-up ChatAsUser to implement a RAG workflow.

Example

Back to Methods