13 System Prompts and Parameter Tuning
This chapter covers
- What system prompts are and how they shape model behavior
- Building personality presets for different use cases
- How temperature and other parameters control response style
- Creating reusable custom models with Ollama Modelfiles
- Adding customization controls to your Streamlit chatbot
Your chatbot works. It answers questions and holds conversations. But right now it behaves like a generic assistant -- polite and helpful, but without any distinctive character. In this chapter, you will learn how to give your chatbot a personality, control how creative or predictable its responses are, and bundle all your customizations into reusable model configurations.
By the end, your chatbot will have a sidebar with personality presets, a temperature slider, and the ability to behave like anything from a strict coding mentor to a pirate tutor.
13.1 System Prompts Explained
When you chat with an LLM, every conversation is made up of messages. Each message has a role: either user (that is you) or assistant (that is the AI). But there is a third role that most people never see: system.
The system message is a special instruction sent before the conversation begins. It sets the rules, personality, and boundaries for the model. The model reads the system prompt first and follows those instructions in every response it generates (figure 13.1).