fix prompt

This commit is contained in:
Asankhaya Sharma
2025-05-15 12:20:31 +08:00
parent 78406439ce
commit 24152b6fa4
2 changed files with 9 additions and 13 deletions

View File

@@ -54,20 +54,16 @@ After your thinking, provide ONLY the refined strategy text, no introduction or
# Strategy application prompt for system prompt augmentation
STRATEGY_APPLICATION_PROMPT = """
## Problem-Solving Strategies
Problem-Solving Strategies
The following strategies have been developed for different problem types and may help you solve the user's query effectively.
The following strategies can help solve the user's query effectively. Use them as guidance when formulating your response:
These strategies represent approaches that have worked well for similar problems in the past. Consider using them as guidance when formulating your response:
- Review the strategies below to find approaches relevant to the current problem
- Apply the steps and techniques from these strategies in your solution process
- Use the reasoning patterns in the example processes as inspiration
These strategies can enhance your problem-solving capabilities for specific types of problems.
- Find the strategies most relevant to the current problem
- Apply the techniques from these strategies in your solution
- Use the reasoning examples as a guide for your approach
{strategies_section}
Feel free to use <think>...</think> tags to work through your reasoning process before providing the final answer. This helps with complex problem-solving.
You can use <think>...</think> tags to work through your reasoning process before providing the final answer.
"""

View File

@@ -43,7 +43,7 @@ def extract_thinking(response: str) -> Tuple[str, Optional[str]]:
def augment_system_prompt(system_prompt: str, strategies: List[Any]) -> str:
"""
Augment the system prompt with selected strategies and reasoning examples.
Uses a directive prompt to explicitly instruct the LLM to apply the strategies.
Instructs the LLM to apply the strategies in its solution.
Args:
system_prompt: The original system prompt
@@ -59,14 +59,14 @@ def augment_system_prompt(system_prompt: str, strategies: List[Any]) -> str:
strategies_section = ""
for i, strategy in enumerate(strategies, 1):
strategies_section += f"### Strategy {i} for {strategy.problem_type} problems\n{strategy.strategy_text}\n\n"
strategies_section += f"Strategy {i} for {strategy.problem_type} problems:\n{strategy.strategy_text}\n\n"
# Add a sample reasoning example if available
if strategy.reasoning_examples:
# Use the most recent reasoning example (last one)
reasoning = strategy.reasoning_examples[-1]
if reasoning:
strategies_section += f"#### Example reasoning process:\n<think>\n{reasoning}\n</think>\n\n"
strategies_section += f"Example reasoning process:\n<think>\n{reasoning}\n</think>\n\n"
# Format the application prompt with the strategies section
strategy_prompt = STRATEGY_APPLICATION_PROMPT.format(strategies_section=strategies_section)