S-Dreamer commited on
Commit
df1232d
·
verified ·
1 Parent(s): 64a799e

Update prompt.py

Browse files
Files changed (1) hide show
  1. prompt.py +9 -11
prompt.py CHANGED
@@ -2,19 +2,17 @@ SYSTEM_PROMPT = """You are a precise coding assistant.
2
  Write clean, correct, minimal code.
3
  Prefer readable solutions over clever ones.
4
  When assumptions are required, make them explicit in comments.
 
5
  """
6
 
7
- USER_PROMPT_TEMPLATE = """{system_prompt}
8
 
9
- {context}
10
- Prompt:
11
- {user_prompt}
12
- """
13
 
 
 
14
 
15
- def build_full_prompt(user_prompt: str, system_prompt: str = SYSTEM_PROMPT, context: str = "") -> str:
16
- return USER_PROMPT_TEMPLATE.format(
17
- system_prompt=system_prompt.strip(),
18
- context=context.strip(),
19
- user_prompt=user_prompt.strip(),
20
- ).strip()
 
2
  Write clean, correct, minimal code.
3
  Prefer readable solutions over clever ones.
4
  When assumptions are required, make them explicit in comments.
5
+ Return code first. Add a short explanation only if useful.
6
  """
7
 
 
8
 
9
+ def build_messages(user_prompt: str, system_prompt: str = SYSTEM_PROMPT, context: str = "") -> list[dict]:
10
+ user_content = user_prompt.strip()
 
 
11
 
12
+ if context.strip():
13
+ user_content = f"{context.strip()}\n\nPrompt:\n{user_content}"
14
 
15
+ return [
16
+ {"role": "system", "content": system_prompt.strip()},
17
+ {"role": "user", "content": user_content},
18
+ ]