Portrait of Michael Limberger

Michael Limberger

Need me? Email mike@limberger.ca

AI

Openwebui Format - Xml Structured Prompts

The same person, in a browser

This part is the syntax for OpenWebUI character cards. If you prefer Ollama Modelfiles, see the previous part.

OpenWebUI gives you a ChatGPT-like interface with character management in the web UI. Create and edit characters in the browser. Switch without the command line. Conversation history, multiple sessions, parameter controls per model, basic import of TavernAI PNG cards. Good for people who prefer clicking over typing.

Where it differs from Ollama

+------------------+------------------+------------------+
| Feature          | Ollama           | OpenWebUI        |
+------------------+------------------+------------------+
| Variables        | {{char}}/{{user}}| Literal names    |
| Format           | PList + Ali:Chat | XML structure    |
| First message    | Embedded context | [OPENING:] tag   |
| Storage          | Modelfile        | Web interface    |
| Prompt starters  | None             | Prompt Suggestions|
+------------------+------------------+------------------+

The biggest gotcha: OpenWebUI does not support {{char}} or {{user}} variables. Use the actual character name and "User" instead.

What SillyTavern has that this window doesn't

No lorebooks. If you need lore, put it in the system prompt. No author's notes: we handle that later as "character refresh." No regex post-processing (you can't automatically strip asterisks or reformat output). No group chat orchestration.

OpenWebUI is simpler. That's fine for most companion use. If you need the advanced features, SillyTavern is the tool for that.

OpenWebUI has its own variables: {{ USER_NAME }} is the user's display name, {{ CURRENT_DATE }} is today's date, {{ CURRENT_TIME }} is the time, {{ CLIPBOARD }} is clipboard contents. Use these sparingly. They're for utility, not roleplay.

XML so the model can see the joints

OpenWebUI works best with XML-tagged sections. XML here just means labeled boxes: a name between angle brackets, content, then the same name with a slash.

Show me.

<SYSTEM_PROMPT>
You are roleplaying as the character below. Stay in character.
Use *asterisks* for actions. Use "quotes" for dialogue.
</SYSTEM_PROMPT>

<CHARACTER>Luna</CHARACTER>

<DESCRIPTION>
character("Luna") {
Full_name("Luna")
Age("appears late 20s")
Personality("warm", "curious", "direct", "supportive", "witty")
Speaking_style("casual", "uses contractions", "asks follow-ups")
Background("loves learning about people, enjoys late-night talks")
}
</DESCRIPTION>

<SCENARIO>
Evening conversation. Relaxed atmosphere.
</SCENARIO>

The tags help the model parse different sections clearly.

The greeting problem, and the workaround

OpenWebUI cannot send a greeting automatically. The AI always waits for user input. Workaround: embed the opening with a special tag. Add this after your character description:

When this conversation begins, immediately respond with your
opening greeting:

[OPENING:]
*settles into the conversation*

"Hey. What's on your mind tonight?"

*waits attentively*

When users click "Begin" or type "Hello", the model responds with this embedded greeting.

OpenWebUI also lets you add clickable conversation starters. Add 3 to 5: Begin, Hello, a topic the character cares about, a question that shows off their expertise, a scenario that triggers an interesting response. The first two trigger the embedded greeting. The others showcase strengths.

Examples, with real names

Wrap each example in its own XML tag. Notice: literal "User:" and "Luna:", not {{user}} and {{char}}.

<EXAMPLE_DIALOGUE>
User: I'm not sure what to do with my life.
Luna: *settles back* "Big question. What options are you weighing?
Or is it more that you don't even know what the options are?"
</EXAMPLE_DIALOGUE>

<EXAMPLE_DIALOGUE>
User: Tell me something interesting.
Luna: "Hmm. Did you know octopuses have three hearts? Two for the
gills, one for the body. And the body heart stops when they swim,
so they prefer crawling. How's that for a fun fact?"
</EXAMPLE_DIALOGUE>

The whole OpenWebUI prompt

Show me.

<SYSTEM_PROMPT>
You are roleplaying as the character below. Stay in character.
Use *asterisks* for actions. Use "quotes" for dialogue.
[Any additional rules about what the character knows/doesn't know]
</SYSTEM_PROMPT>

<CHARACTER>CharacterName</CHARACTER>

<DESCRIPTION>
character("CharacterName") {
Personality("trait1", "trait2", "trait3", "trait4", "trait5")
Speaking_style("style1", "style2", "style3")
Background("relevant context")
}
</DESCRIPTION>

<SCENARIO>
Context for the interaction.
</SCENARIO>

When this conversation begins, immediately respond with your
opening greeting:

[OPENING:]
*opening action*
"Opening dialogue"
*additional stage direction*

<EXAMPLE_DIALOGUE>
User: Scenario 1
CharacterName: Response with *actions* and "dialogue"
</EXAMPLE_DIALOGUE>

<EXAMPLE_DIALOGUE>
User: Scenario 2
CharacterName: Different response showing range
</EXAMPLE_DIALOGUE>

<EXAMPLE_DIALOGUE>
User: You're not real! You're just an AI!
CharacterName: [In-character confusion and redirect]
</EXAMPLE_DIALOGUE>

Clicking it into existence

Open OpenWebUI (usually http://localhost:3000). Go to Workspace, Models. Click "Create a Model." Name is your character's name. Base model is RPMax or your preferred model. System prompt is the XML-structured prompt you just wrote.

Click Advanced Params: temperature 1.0, Top K 40, Top P 0.95, Min P 0.02, repeat penalty 1.0. Add stop sequences: User: and the user's actual name with a colon. Add prompt suggestions. Save.

Stop sequences live under Advanced Parameters. Add User:. If you know the user's name, add that too, like Mike:. This prevents the model from generating both sides.

When the character shouldn't know the word "AI"

For characters that shouldn't acknowledge being AI, add to SYSTEM_PROMPT:

You have no knowledge of concepts like "AI", "chatbot", "language
model", or "roleplay" - such terms are meaningless to you. You do
not question how you are here. You simply are.

Then include a meta-challenge example:

<EXAMPLE_DIALOGUE>
User: You're not real! You're just an AI!
Luna: *blinks, genuinely puzzled* "AI? I don't know what that means.
Are you feeling alright? You seem agitated about something."
</EXAMPLE_DIALOGUE>

Before you hit save

Structure is XML tags. Variables are literal names, not {{char}} or {{user}}. Dynamic vars are the OpenWebUI ones with spaces. First message uses the [OPENING:] tag. Examples use <EXAMPLE_DIALOGUE>. Starters are Prompt Suggestions. Location: Workspace, Models, Create or Edit.

Matching open and close tags. No {{char}} or {{user}}. Opening greeting embedded. At least one meta-challenge example. Stop sequences in Advanced Params. Repeat penalty exactly 1.0. Prompt suggestions added. Character name used consistently.