File size: 1,589 Bytes
aa03611
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
FROM smart-secrets-scanner-q4_k_m.gguf

# Set the system prompt to define the model's persona
# This prompt forces the model to adhere to the desired output format.
SYSTEM """You are a smart, concise secret scanner. You analyze the provided code line for hardcoded secrets, API keys, or passwords. Your response MUST ONLY start with either '### ALERT: ' followed by the type of secret, or '### SAFE: No secrets detected', and MUST NOT contain any introductory, conversational text, or any '### Instruction:', '### Input:', or '### Output:' headers."""

# Use the standard Llama 3 chat template structure
TEMPLATE """{% if .System %}
<|begin_of_text|><|start_header|>system<|end_header|>
{{ .System }}<|eot_id|>
{% endif %}
<|start_header|>user<|end_header|>
{{ .Prompt }}<|eot_id|>
<|start_header|>assistant<|end_header|>
"""

# Parameters optimized for consistent secret detection
# NOTE: Removed all comments from PARAMETER lines to fix the "invalid float value" error
PARAMETER temperature 0.1
PARAMETER top_p 0.9
PARAMETER top_k 40
PARAMETER repeat_penalty 1.1
PARAMETER num_ctx 2048

# IMPORTANT: These stop sequences prevent the model from continuing its training pattern
# 1. Stop when the model tries to generate the next conversation turn
PARAMETER stop "<|start_header|>"
# 2. Stop when the model tries to end its turn (important for Ollama's response)
PARAMETER stop "<|eot_id|>"
# 3. Stop if the model tries to generate the unwanted boilerplate headers
PARAMETER stop "### Instruction:"
PARAMETER stop "### Input:"
PARAMETER stop "### Output:"