The LlmSetModelFlags function overrides the capability flags
associated with the currently selected model. These flags determine how
the client formats requests and interprets responses for the model.
Model capability flags are normally determined automatically by the
library based on the selected provider and model. This function is
primarily intended for advanced scenarios where the default behavior
must be adjusted, such as when working with custom providers, locally
hosted models, or when a model's capabilities have changed and are not
yet reflected in the library.
The specified flags must include LLM_MODEL_FLAG_CHAT, as
the API requires a chat-based interface for sending and receiving
messages. Specifying flags that are not supported by the selected model
may result in request failures or undefined behavior.
Changing model flags can affect how requests are constructed, such as
which parameters are used, how input is formatted, and which features
are enabled. Applications should only modify these flags if they fully
understand the capabilities of the target model.
If you enable a capability that is not supported by the model or
provider, this will often result in an error condition and may cause
subsequent requests to fail. For example, if you attempt to force the
use of a system prompt by setting the LLM_MODEL_FLAG_SYSTEM_ROLE flag,
this can cause unexpected failures on models hosted locally using an
application like LM Studio.
Changing the current model using the LlmSetModelName function
will reset the model flags for the session back to their default
values for the new model.