The SystemPrompt property returns the current system prompt.
If a system prompt has not been specified, this property will return
an empty string. Changing the value of this property will change the
system prompt included with subsequent messages sent to the model.
A system prompt provides instructions that are included with each
request sent to the model. It can be used to define the expected role,
tone, response style, formatting rules, or other application-specific
guidance that should apply to the session. For example, an application
might use a system prompt to request short responses, avoid Markdown
formatting, return structured text, or answer only within the context
of a specific feature or workflow.
Because conversation history is included with each request, messages
generated using a previous system prompt may still influence subsequent
responses. Changing or clearing the system prompt only affects future
requests and does not retroactively modify existing messages in the
history. If the new prompt represents a significant change in behavior,
applications may want to call ClearHistory before sending
additional messages.
The system prompt should be treated as guidance, not a guarantee.
Different providers and models may interpret system instructions
differently, and user messages may still influence the response.
Setting this property to an empty string will clear the current
system prompt and subsequent requests will not include a system
prompt.
Support for system prompts may vary between providers and models.
Some providers treat the system prompt as a distinct message role,
while others incorporate it as part of a separate instruction field.
The control will map the system prompt to the appropriate format for
the selected provider, but the exact behavior and influence on the
response may differ. Applications should test system prompt behavior
with their selected provider to ensure it produces the desired
results.
Some providers and models may not support a dedicated system role.
This is more common with locally hosted models using applications
such as LM Studio or Ollama. To determine if a model supports system
prompts, check the value of the ModelFlags property for the
llmModelFlagSystemRole flag.