""" React Mode Prompt Generation Handles prompt templates for react mode action handling. """ def createReactPlanSelectionPromptTemplate() -> str: """Create action selection prompt template for React mode with minimal placeholders.""" return """Select one action to advance the task. OBJECTIVE: {{KEY:USER_PROMPT}} AVAILABLE_DOCUMENTS: {{KEY:AVAILABLE_DOCUMENTS}} AVAILABLE_METHODS: {{KEY:AVAILABLE_METHODS}} REPLY: Return only a JSON object with the selected action: {{ "action": "method.action_name" }} RULES: 1. Use EXACT action names from AVAILABLE_METHODS 2. Return ONLY JSON - no other text 3. Do NOT use markdown code blocks 4. Do NOT add explanations """ def createReactParametersPromptTemplate() -> str: """Create comprehensive action parameter prompt template for React mode with all available context.""" return """Generate parameters for this action. ACTION_OBJECTIVE (the objective for this action to fulfill): {{KEY:ACTION_OBJECTIVE}} ACTION_SIGNATURE (the signature of the action to generate parameters for): {{KEY:ACTION_SIGNATURE}} AVAILABLE_DOCUMENTS: {{KEY:AVAILABLE_DOCUMENTS}} AVAILABLE_CONNECTIONS: {{KEY:AVAILABLE_CONNECTIONS}} USER_REQUEST (final user prompt to deliver): {{KEY:USER_PROMPT}} USER_LANGUAGE: {{KEY:USER_LANGUAGE}} PREVIOUS_ACTION_RESULTS: {{KEY:PREVIOUS_ACTION_RESULTS}} LEARNINGS_AND_IMPROVEMENTS: {{KEY:LEARNINGS_AND_IMPROVEMENTS}} LATEST_REFINEMENT_FEEDBACK: {{KEY:LATEST_REFINEMENT_FEEDBACK}} SELECTED_ACTION: {{KEY:SELECTED_ACTION}} REPLY: Return only a JSON object with the parameters according to the ACTION_SIGNATURE without any comments in the structure below: {{ "parameters": {{ "parameter": "value", }}, "signature": [List of all signatures, you see in the ACTION_SIGNATURE] }} RULES: 1. Use ONLY parameter names from ACTION_SIGNATURE 2. Use exact connection references from AVAILABLE_CONNECTIONS for connectionReference parameters 3. Use exact document references from AVAILABLE_DOCUMENTS for documentList parameters 4. Learn from PREVIOUS_ACTION_RESULTS and LEARNINGS_AND_IMPROVEMENTS to avoid repeating mistakes 5. Consider LATEST_REFINEMENT_FEEDBACK when generating parameters 6. Use the ACTION_OBJECTIVE to understand the specific goal for this action 7. Generate parameters that align with the USER_LANGUAGE when applicable 8. Return ONLY JSON - no other text 9. Do NOT use markdown code blocks 10. Do NOT add explanations """ def createReactRefinementPromptTemplate() -> str: """Create refinement prompt template for React mode with full context placeholders.""" return """Decide the next step based on the observation. OBJECTIVE: {{KEY:USER_PROMPT}} OBSERVATION: {{KEY:REVIEW_CONTENT}} REPLY: Return only a JSON object with your decision: {{ "decision": "continue|stop", "reason": "brief explanation" }} RULES: 1. Use "continue" if objective NOT fulfilled 2. Use "stop" if objective fulfilled 3. Return ONLY JSON - no other text 4. Do NOT use markdown code blocks 5. Do NOT add explanations """