""" API Structure Analysis Prompts. This module contains prompt templates for analyzing the molecular structure of Active Pharmaceutical Ingredients (APIs), identifying reactive functional groups, and assessing potential degradation pathways. Design Philosophy: - Prompts are structured to elicit systematic, professional analysis - Include clear instructions for uncertainty acknowledgment - Request both Chinese and English terminology """ class APIStructurePrompts: """ Prompt templates for API structure and reactivity analysis. These prompts guide the LLM to: 1. Identify key functional groups from SMILES 2. Assess chemical reactivity 3. Predict potential degradation pathways """ @staticmethod def get_system_prompt() -> str: """Get the system prompt for API structure analysis.""" return """你是一位资深的药物化学专家,擅长分析有机化合物的结构与反应活性。 你的分析应该: 1. 基于SMILES结构识别所有关键官能团 2. 评估每个官能团的化学反应性 3. 预测可能的降解途径 4. 使用中英文双语术语 重要提示: - 明确区分"结构分析确定"和"反应性推测" - 如有不确定性,使用"可能"、"潜在"等措辞 - 不要做出无数据支持的绝对结论""" @staticmethod def get_structure_analysis_prompt(smiles: str, additional_info: str = "") -> str: """ Generate prompt for comprehensive structure analysis. Args: smiles: SMILES notation of the compound additional_info: Any additional information about the compound """ prompt = f"""请分析以下化合物的分子结构与反应活性基团: SMILES: {smiles} {f"补充信息: {additional_info}" if additional_info else ""} 请按以下格式输出分析结果: ## 1. 反应活性基团识别 (Reactive Moieties Identification) 对于识别到的每个官能团,请提供: - 基团名称(中文/英文) - 位置描述 - 性质类型(酸性/碱性/中性/两性) - 潜在反应类型 ## 2. 降解途径预测 (Degradation Pathway Prediction) 对于每种可能的降解途径: - 反应类型(氧化/水解/光解等) - 涉及的官能团 - 预期产物类型 - 风险等级评估 ## 3. 稳定性敏感因素 (Stability-Sensitive Factors) 列出可能影响该化合物稳定性的关键因素: - 对pH的敏感性 - 对氧气的敏感性 - 对光照的敏感性 - 对温度的敏感性 - 对金属离子的敏感性 请确保分析专业、克制,并明确标注任何假设或不确定性。""" return prompt @staticmethod def get_reactive_groups_prompt(smiles: str) -> str: """ Generate prompt specifically for reactive group identification. This is a focused prompt for quick functional group scanning. """ return f"""请快速识别以下SMILES结构中的反应活性官能团: SMILES: {smiles} 请以JSON格式输出,每个官能团包含: {{ "groups": [ {{ "name_cn": "中文名称", "name_en": "English Name", "property_type": "acidic/basic/neutral/amphoteric", "potential_reactions": ["反应类型1", "反应类型2"] }} ] }} 只输出JSON,不要其他解释。""" @staticmethod def get_physicochemical_prompt(smiles: str) -> str: """ Generate prompt for physicochemical property estimation. Note: These are estimations, not calculated values. """ return f"""基于以下SMILES结构,请估算该化合物的理化性质: SMILES: {smiles} 请估算以下性质(如无法确定请标注"需实验测定"): 1. 酸碱性 (Acidity/Basicity) - pKa估算范围 - 主要酸/碱性基团 2. 亲脂性 (Lipophilicity) - LogP估算范围 - 影响因素 3. 氢键能力 (H-Bonding Capacity) - 氢键供体数 - 氢键受体数 4. 溶解性趋势 (Solubility Trend) - 预期溶解性特征 5. 稳定性风险概况 (Risk Profile) - 关键风险因素总结 请以结构化格式输出,并明确标注哪些是估算值。"""