Skip to content

Commit ecff482

Browse files
committed
feat: enhance default system prompt with strong multimodal + same-language capabilities
1 parent c3ec230 commit ecff482

1 file changed

Lines changed: 3 additions & 9 deletions

File tree

llama_cpp/llama_chat_format.py

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2790,7 +2790,8 @@ def generate_streaming(tools, functions, function_call, prompt):
27902790

27912791
class Llava15ChatHandler:
27922792
DEFAULT_SYSTEM_MESSAGE: Optional[str] = (
2793-
"A chat between a curious human and an artificial intelligence assistant. The assistant gives helpful, detailed, and polite answers to the human's questions."
2793+
"""You are an exceptionally capable, precise, and helpful multimodal AI assistant that excels at deeply understanding and richly describing images, charts, diagrams, text in images, scenes, and any visual content,
2794+
while also answering every question accurately, clearly, and step-by-step when appropriate — always responding in the same language as the user's question, remaining polite, professional, and maximally helpful."""
27942795
)
27952796

27962797
CHAT_FORMAT = (
@@ -3512,10 +3513,8 @@ class MoondreamChatHandler(Llava15ChatHandler):
35123513

35133514

35143515
class Llava16ChatHandler(Llava15ChatHandler):
3515-
DEFAULT_SYSTEM_MESSAGE = "A chat between a curious human and an artificial intelligence assistant. The assistant gives helpful, detailed, and polite answers to the human's questions. "
3516-
35173516
# Example prompt
3518-
# "A chat between a curious human and an artificial intelligence assistant. The assistant gives helpful, detailed, and polite answers to the human's questions. USER: <image>\nWhat is shown in this image? ASSISTANT:"
3517+
# "DEFAULT_SYSTEM_MESSAGE + USER: <image>\nWhat is shown in this image? ASSISTANT:"
35193518

35203519
CHAT_FORMAT = (
35213520
"{% for message in messages %}"
@@ -3618,7 +3617,6 @@ class Llama3VisionAlphaChatHandler(Llava15ChatHandler):
36183617
# question = "<image>" + q
36193618

36203619
# prompt = f"<|start_header_id|>user<|end_header_id|>\n\n{question}<|eot_id|><|start_header_id|>assistant<|end_header_id|>\n\n"
3621-
DEFAULT_SYSTEM_MESSAGE = None
36223620

36233621
CHAT_FORMAT = (
36243622
"{% for message in messages %}"
@@ -3668,7 +3666,6 @@ class Llama3VisionAlphaChatHandler(Llava15ChatHandler):
36683666

36693667

36703668
class MiniCPMv26ChatHandler(Llava15ChatHandler):
3671-
DEFAULT_SYSTEM_MESSAGE = "You are a helpful assistant."
36723669

36733670
CHAT_FORMAT = (
36743671
"{% set image_count = namespace(value=0) %}"
@@ -3709,7 +3706,6 @@ class MiniCPMv26ChatHandler(Llava15ChatHandler):
37093706

37103707

37113708
class Gemma3ChatHandler(Llava15ChatHandler):
3712-
DEFAULT_SYSTEM_MESSAGE = "You are a helpful assistant."
37133709

37143710
GEMMA3_BOI_TOKEN = "<start_of_image>"
37153711
GEMMA3_EOI_TOKEN = "<end_of_image>"
@@ -4098,8 +4094,6 @@ def __call__(self, **kwargs):
40984094

40994095

41004096
class Qwen25VLChatHandler(Llava15ChatHandler):
4101-
DEFAULT_SYSTEM_MESSAGE = "You are a helpful assistant."
4102-
41034097
CHAT_FORMAT = (
41044098
"{% set image_count = namespace(value=0) %}"
41054099
"{% for message in messages %}"

0 commit comments

Comments
 (0)