mirror of
https://github.com/wassname/stampy-chat.git
synced 2026-09-11 12:50:34 +08:00
fix typo
accidentally said assistant instead of user
This commit is contained in:
+7
-22
@@ -73,31 +73,16 @@ def generate_prompt(query: str, history: List[Dict[str, str]] = [], blocks: List
|
||||
Returns:
|
||||
List[Dict[str, str]]: The prompt in messages format.
|
||||
"""
|
||||
# Initialize prompt
|
||||
prompt = []
|
||||
|
||||
# Generate system description
|
||||
if mode == "standard":
|
||||
prompt.append({"role": "system", "content": "You are a helpful assistant knowledgeable about AI Alignment and Safety."})
|
||||
# elif mode == "other":
|
||||
else:
|
||||
raise Exception(f"Invalid mode: {mode}")
|
||||
# Initialize prompt with system description
|
||||
prompt = [{"role": "system", "content": "You are a helpful assistant knowledgeable about AI Alignment and Safety."}]
|
||||
|
||||
# Add previous dialogue
|
||||
for message in history:
|
||||
prompt.append(message)
|
||||
|
||||
# Add instruction
|
||||
if mode == "standard":
|
||||
instruction_prompt = "Please answer my question (after the Q:) using the provided context."
|
||||
prompt.append({"role": "assistant", "content": instruction_prompt})
|
||||
# elif mode == "other":
|
||||
else:
|
||||
raise Exception(f"Invalid mode: {mode}")
|
||||
prompt.extend(history) # Add previous dialogue
|
||||
|
||||
instruction_prompt = "Please answer my question (after the Q:) using the provided context."
|
||||
prompt.append({"role": "user", "content": instruction_prompt})
|
||||
|
||||
|
||||
# Add context from top-k blocks
|
||||
if blocks is None:
|
||||
return "Context missing."
|
||||
context_prompt = "Context:\n\n"
|
||||
for i, block in enumerate(blocks):
|
||||
context_prompt += f"[{i}] {block.text}\n\n"
|
||||
|
||||
Reference in New Issue
Block a user