Append text to a system message.
Creates a new SystemMessage with the text appended to the existing content. If the original message has content, the new text is separated by two newlines.
appendToSystemMessage(
systemMessage: SystemMessage<MessageStructure<MessageToolSet>> | null | undefined,
text: string
): SystemMessage| Name | Type | Description |
|---|---|---|
systemMessage* | SystemMessage<MessageStructure<MessageToolSet>> | null | undefined | Existing system message or null/undefined. |
text* | string | Text to add to the system message. |
const original = new SystemMessage({ content: "You are a helpful assistant." });
const updated = appendToSystemMessage(original, "Always be concise.");
// Result: SystemMessage with content "You are a helpful assistant.\n\nAlways be concise."