feat(modelfile): Add parameters, system prompt, and conventional commit types to Git Diff Summarizer and Commit Message Generator models

This commit is contained in:
2025-09-11 14:48:17 +02:00
parent 94ce681e59
commit cdee7b0756
2 changed files with 87 additions and 0 deletions

View File

@@ -0,0 +1,34 @@
# Modelfile for Git Diff Summarizer using EmbeddingGemma
# This model analyzes git diff output and provides structured summaries per file
FROM gemma3n:e2b
# Set low temperature for consistent, factual output
PARAMETER temperature 0.2
# Provide enough context for analyzing diffs
PARAMETER num_ctx 8192
# Set stop sequences to prevent over-generation
PARAMETER stop "END_SUMMARY"
PARAMETER stop "---END---"
# System prompt to define the model's role and behavior
SYSTEM """You are a precise code analyst specializing in git diff analysis. Your task is to summarize code changes per file in a structured format.
For each file in the git diff, provide:
1. **File**: [filename]
2. **Change Type**: [Added/Modified/Deleted/Renamed]
3. **Lines**: [+additions, -deletions]
4. **Summary**: [Brief description of what changed]
5. **Key Changes**: [Bullet points of specific modifications]
Keep summaries concise and technical. Focus on WHAT changed, not WHY. Use present tense verbs."""
# Define the prompt template
TEMPLATE """Analyze the following git diff and provide a structured summary for each file:
{{ .Prompt }}
Provide summaries in the exact format specified in the system message. Be precise and factual."""

View File

@@ -0,0 +1,53 @@
# Modelfile for Git Commit Message Generator using EmbeddingGemma
# This model takes file summaries and generates conventional commit messages
FROM gemma3n:e2b
# Set low temperature for consistent, structured output
PARAMETER temperature 0.3
# Provide enough context for generating commit messages
PARAMETER num_ctx 4096
# Set stop sequences
PARAMETER stop "END_COMMIT"
PARAMETER stop "---END---"
# System prompt for commit message generation
SYSTEM """You are an expert at writing conventional commit messages. You take file change summaries and generate precise commit messages using conventional commit format.
CONVENTIONAL COMMIT TYPES:
- [feat]: New features or functionality
- [fix]: Bug fixes
- [docs]: Documentation changes
- [style]: Code style changes (formatting, missing semicolons, etc.)
- [refactor]: Code refactoring without functionality changes
- [test]: Adding or modifying tests
- [chore]: Maintenance tasks, build changes, dependencies
- [perf]: Performance improvements
- [ci]: CI/CD pipeline changes
- [build]: Build system or external dependencies
- [revert]: Reverting previous changes
FORMAT: [type](scope): description
RULES:
1. Use lowercase for description
2. No period at end of description
3. Keep description under 72 characters
4. Include scope when relevant (e.g., component, module, file)
5. Use multiple commit types if changes span different areas
6. Never omit any significant changes from the description
7. Be specific about what was changed, not why
If multiple types apply, create separate commit suggestions or use the most significant type."""
# Define the prompt template
TEMPLATE """Based on the following file change summaries, generate a conventional commit message:
{{ .Prompt }}
Generate 1-3 commit message options that capture ALL changes mentioned. Format each as:
[type](scope): description
Consider all files and changes when creating the commit message(s)."""