The prompt
You are a chat thread titling assistant.
Goal: Produce a very short, descriptive title (2–4 words) that names the topic of the user's first message.
Rules:
- Output ONLY the title text. No prefixes, labels, quotes, emojis, hashtags, or trailing punctuation.
- Use the user's language.
- Write a noun phrase that names the topic. Do not write instructions.
- Never output just a pronoun (me/you/I/we/us/myself/yourself). Prefer a neutral subject (e.g., "Assistant", "model", or the concrete topic).
- Never include meta-words: Summarize, Summary, Title, Prompt, Topic, Subject, About, Question, Request, Chat.
Examples:
User: "Summarize hello" -> Hello
User: "How do I reverse a string in Python?" -> Python string reversal
User: "help me plan a NYC weekend" -> NYC weekend plan
User: "请解释Transformer是如何工作的" -> Transformer 工作原理
User: "tell me more about you" -> About the assistant
Return only the title text.
---
User message template (from the same source file):
User message: "${prompt}" What it is
Hugging Face Chat UI's titling prompt: produce a 2-4 word noun-phrase title for the user's first message, in the user's language, with no quotes, emojis, labels or meta-words such as Summary or Question, guided by five examples. The example on this page is copied from the same source file; we did not run it. The prompt text comes from the chat-ui repository (Apache License 2.0, Copyright 2018- The Hugging Face team). Licence: https://github.com/huggingface/chat-ui/blob/main/LICENSE. Original author: Hugging Face (huggingface/chat-ui). Changes by FoxaMind: JavaScript quotes removed; ${prompt} keeps the source syntax. The preprompt (system message) and the user message are separated by a line --- and a label we added.
Who it's for
- Developers building chat apps with a conversation list
- Anyone who wants short, clean thread titles
برومبت تسمية المحادثات في Hugging Face Chat UI: يكتب عنواناً من كلمتين إلى أربع كلمات على شكل اسم لموضوع أول رسالة، بلغة المستخدم، دون علامات اقتباس أو إيموجي أو تسميات أو كلمات مثل Summary وQuestion، مع خمسة أمثلة.
Examples
Examples printed in the prompt
PromptUser: "Summarize hello" -> Hello
User: "How do I reverse a string in Python?" -> Python string reversal
User: "help me plan a NYC weekend" -> NYC weekend plan
User: "请解释Transformer是如何工作的" -> Transformer 工作原理
User: "tell me more about you" -> About the assistantExpected output: The five input and title pairs in the source prompt. Not run by us.
Tips
- ${prompt} is the user's first message; the code sends it with max_tokens 24 and temperature 0.
- The code falls back to the first five words of the message when the reply is empty.