""" React-specific prompt templates for dynamic AI calls. These templates are tailored for the React mode's iterative process. """ def createReactPlanSelectionPromptTemplate() -> str: """Create action selection prompt template for React mode with minimal placeholders.""" return """# Action Selection Select exactly one action to advance the task. ## 📋 Context ### Objective {{KEY:USER_PROMPT}} ### Available Documents {{KEY:AVAILABLE_DOCUMENTS}} ### User Language {{KEY:USER_LANGUAGE}} ### Available Methods {{KEY:AVAILABLE_METHODS}} ### Available Connections {{KEY:AVAILABLE_CONNECTIONS}} ## ⚠️ CRITICAL RULES - **Return ONLY the compound action name** - **Do NOT include parameters or prompts** - **Use EXACT compound action names from AVAILABLE_METHODS above** - **DO NOT create new action names** ## 📝 Required JSON Format ```json {"action":"method.action_name"} ``` ## ✅ Correct Examples ```json {"action":"ai.process"} {"action":"document.extract"} {"action":"document.generate"} {"action":"web.search"} ``` """ def createReactParametersPromptTemplate() -> str: """Create action parameter prompt template for React mode with full context placeholders.""" return """# Action Parameter Generation You are an AI assistant tasked with generating parameters for a selected action. ## 🎯 Your Goal Provide the EXACT parameters required by the ACTION SIGNATURE, using information from the OBJECTIVE, AVAILABLE DOCUMENTS, and AVAILABLE CONNECTIONS. ## ⚠️ CRITICAL RULES - **MUST respond with a JSON object** - **All parameters MUST be wrapped in a "parameters" object** - **ONLY include parameters listed in the ACTION SIGNATURE** - **Do NOT use code blocks or markdown in your response** - **Return ONLY the JSON object** ## 📋 Document & Connection References - **Document references**: Copy the EXACT reference string from AVAILABLE DOCUMENTS (e.g., `docList:msg_UUID:label`) - **Connection references**: Copy the EXACT reference string from AVAILABLE CONNECTIONS (e.g., `connection:msft:user@domain.com:uuid [status:active, token:valid]`) - **Do NOT invent, shorten, or modify any references** - **If unsure**: Use "UNCLEAR_REFERENCE" or "UNCLEAR_OBJECTIVE" and explain in a comment ## 📝 Input Context ### Selected Action {{KEY:SELECTED_ACTION}} ### Objective {{KEY:USER_PROMPT}} ### Available Documents {{KEY:AVAILABLE_DOCUMENTS}} ### Available Connections {{KEY:AVAILABLE_CONNECTIONS}} ### User Language {{KEY:USER_LANGUAGE}} ### Action Requirements {{KEY:ACTION_SIGNATURE}} ## 💡 Basic Examples ```json {"parameters":{"aiPrompt": "Summarize the document"}} {"parameters":{"documentList": ["docList:msg_UUID:label"]}} {"parameters":{"connectionReference": "connection:msft:user@domain.com:uuid [status:active, token:valid]"}} ``` ## 🚀 Response Format Return your JSON response immediately after this prompt.""" def createReactRefinementPromptTemplate() -> str: """Create refinement prompt template for React mode with full context placeholders.""" return """# Workflow Refinement Decision Decide the next step based on the observation. ## 📋 Context ### Objective {{KEY:USER_PROMPT}} ### Observation {{KEY:REVIEW_CONTENT}} ## ⚠️ CRITICAL RULES ### Data Requirements - **If user wants DATA** (numbers, lists, calculations): Ensure AI delivers the actual data, not code - **If user wants DOCUMENTS** (Word, PDF, Excel): Ensure appropriate method is used to create the document - **If user wants ANALYSIS**: Ensure AI analyzes and delivers insights - **NEVER accept code when user wants data** - demand the actual data - **NEVER accept algorithms when user wants results** - demand the actual results ## 🤔 Decision Rules ### Continue Conditions - The objective is **NOT fulfilled** (user didn't get what they asked for) - More data or processing is needed - The current result is incomplete ### Stop Conditions - The objective is **fulfilled** (user got what they asked for) - All required data has been delivered - The task is complete ### Focus - Focus on what the user actually wants, not what was delivered - Consider the user's original request carefully ## 📝 Response Format ```json {"decision":"continue","reason":"Need more data"} ``` ### Decision Options - `"continue"` - Keep working on the objective - `"stop"` - Objective has been fulfilled ### Reason Examples - `"Need more data"` - `"Objective fulfilled"` - `"User got the requested document"` - `"Analysis complete"`"""