Skip to content

Commit cd7c23f

Browse files
committed
Updated DEFAULT_JAN_MODEL to "llama3.2-3b-instruct" and refactored commit message generation to use get_commit_message_prompt function.
1 parent 0b5f3cc commit cd7c23f

File tree

3 files changed

+25
-13
lines changed

3 files changed

+25
-13
lines changed

src/blueprint/cli.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
)
1616

1717
DEFAULT_OLLAMA_MODEL = "llama3.1"
18-
DEFAULT_JAN_MODEL = "llama3.1-8b-instruct"
18+
DEFAULT_JAN_MODEL = "llama3.2-3b-instruct"
1919

2020

2121
def setup_logging(debug_mode):

src/blueprint/commit_generator.py

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
from typing import List
77

88
from blueprint.ai_service import AIService
9+
from blueprint.prompts import get_commit_message_prompt
910

1011

1112
def get_git_diff(max_chars: int = 5000, debug: bool = False) -> str:
@@ -328,7 +329,7 @@ def generate_commit_messages(
328329
max_chars: int = 200,
329330
service_type: str = "ollama",
330331
ollama_model: str = "llama3.1",
331-
jan_model: str = "Llama 3.1",
332+
jan_model: str = "llama3.2-3b-instruct",
332333
debug: bool = False,
333334
) -> List[str]:
334335
"""Generate commit messages based on git diff.
@@ -356,17 +357,7 @@ def generate_commit_messages(
356357
if not filtered_diff:
357358
logger.warning("FILTERED DIFF is empty")
358359

359-
prompt = f"""
360-
First, describe everything that is accomplished in the GIT DIFF in a single paragraph.
361-
Then convert the paragraph into a good git commit message. It should summarize the entire diff, be a good writer.
362-
Repeat this 3 times.
363-
Return these sentences as a numbered list (example: "1. ", "2. ", or "3. ").
364-
Please keep it under {max_chars} characters per message.
365-
Here is the GIT DIFF:
366-
--- BEGIN GIT DIFF ---
367-
{filtered_diff}
368-
--- END GIT DIFF ---
369-
"""
360+
prompt = get_commit_message_prompt(diff, max_chars)
370361

371362
logger.debug(f"Created prompt with length {len(prompt)} chars")
372363
if debug:

src/blueprint/prompts.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
"""Prompts used for AI services."""
2+
3+
4+
def get_commit_message_prompt(diff: str, max_chars: int = 200) -> str:
5+
"""Generate the prompt for commit message generation.
6+
7+
Args:
8+
diff: Git diff to generate commit messages for
9+
max_chars: Suggested maximum characters for commit messages
10+
11+
Returns:
12+
Formatted prompt string
13+
"""
14+
return f"""
15+
Your task is to generate three concise, informative git commit messages based on the following git diff.
16+
Be sure that each commit message reflects the entire diff.
17+
Keep the commit messages under {max_chars} characters.
18+
It is very important that the entire commit is clear and understandable with each of the three options.
19+
Each message should be on a new line, starting with a number and a period (e.g., '1.', '2.', '3.').
20+
Here's the diff:\n\n{diff}
21+
"""

0 commit comments

Comments
 (0)