Skip to content

Commit 70043cb

Browse files
committed
Allow to configure reflection prompt
1 parent a4be556 commit 70043cb

File tree

1 file changed

+3
-1
lines changed
  • src/praisonai-agents/praisonaiagents/agent

1 file changed

+3
-1
lines changed

src/praisonai-agents/praisonaiagents/agent/agent.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -368,6 +368,7 @@ def __init__(
368368
max_reflect: int = 3,
369369
min_reflect: int = 1,
370370
reflect_llm: Optional[str] = None,
371+
reflect_prompt: Optional[str] = None,
371372
user_id: Optional[str] = None,
372373
reasoning_steps: bool = False,
373374
guardrail: Optional[Union[Callable[['TaskOutput'], Tuple[bool, Any]], str]] = None,
@@ -470,6 +471,7 @@ def __init__(
470471
self.markdown = markdown
471472
self.max_reflect = max_reflect
472473
self.min_reflect = min_reflect
474+
self.reflect_prompt = reflect_prompt
473475
# Use the same model selection logic for reflect_llm
474476
self.reflect_llm = reflect_llm or os.getenv('OPENAI_MODEL_NAME', 'gpt-4o')
475477
self.console = Console() # Create a single console instance for the agent
@@ -1230,7 +1232,7 @@ def chat(self, prompt, temperature=0.2, tools=None, output_json=None, output_pyd
12301232

12311233
reflection_prompt = f"""
12321234
Reflect on your previous response: '{response_text}'.
1233-
Identify any flaws, improvements, or actions.
1235+
{self.reflect_prompt if self.reflect_prompt else "Identify any flaws, improvements, or actions."}
12341236
Provide a "satisfactory" status ('yes' or 'no').
12351237
Output MUST be JSON with 'reflection' and 'satisfactory'.
12361238
"""

0 commit comments

Comments
 (0)