-
Hello! I'm currently initializing the system prompt client side, like this: useEffect(() => {
if (chat.messages.length === 0) {
void chat.append({ role: "system", content: prompt.systemPrompt });
}
}, [chat.messages.length, prompt, chatId]); Is there a way I can do this server-side instead, maybe in The system prompt contains a phrase like "start by introducing yourself" (the bot), so I don't want to wait until the user sends a message |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
You can set it in the |
Beta Was this translation helpful? Give feedback.
-
One question regarding the system property: should it be set with every streamText() call or only once before the beginning of the chat? How does the system property of the streamText work internally? Would the system prompt be internally prefixed to the chat messages or is there a dedicated separate channel where the system messages are communicated to the model? I am trying the understand the Pros and Cons of setting the system message as the first message in the chat history once vs setting the system property for every call of streamText(). Any insights would be highly appreciated. I would like to avoid keep instructing the same system prompt to the model with every call, if it makes sense |
Beta Was this translation helpful? Give feedback.
You can set it in the
system
property ofstreamText
, see https://sdk.vercel.ai/docs/ai-sdk-core/prompts#system-messages