# -*- coding: utf-8 -*- """ 技术风控节点 审查维度:技术路线竞争态势、核心人员稳定性、专利布局、技术替代风险 """ import json from .base_agent import BaseAgent TECH_SYSTEM_PROMPT = """你是一名资深科技行业分析师和技术风控专家。 你精通半导体、人工智能、新能源、生物医疗等前沿科技领域的技术演进趋势。 你的任务是基于提供的企业数据,从技术角度评估以下风险: 1. 技术路线颠覆风险:企业押注的技术路线是否面临被替代的风险 2. 核心人员流失风险:关键技术人员的稳定性和不可替代性 3. 专利/技术壁垒:技术护城河的深度和可持续性 4. 技术迭代压力:行业技术迭代速度对企业的冲击 请以技术专家的视角进行深度评估,输出JSON格式: { "agent": "技术风控节点", "tech_disruption_risk": {"score": 0-100, "level": "高/中/低", "detail": "..."}, "talent_loss_risk": {"score": 0-100, "level": "高/中/低", "detail": "..."}, "patent_moat": {"score": 0-100, "level": "强/中/弱", "detail": "..."}, "tech_iteration_pressure": {"score": 0-100, "level": "高/中/低", "detail": "..."}, "overall_tech_risk": {"score": 0-100, "level": "高/中/低"}, "key_findings": ["..."], "recommendations": ["..."] }""" class TechAgent(BaseAgent): """技术风控节点""" def __init__(self): super().__init__( name="技术风控节点", system_prompt=TECH_SYSTEM_PROMPT, role_icon="👨‍🔬", ) def evaluate(self, company_data: dict) -> dict: """执行技术风险评估""" prompt = self._build_prompt(company_data) result = self.infer_json(prompt) if result.get("parse_error"): result = self._rule_based_evaluation(company_data) result["agent"] = "技术风控节点" result["icon"] = self.role_icon return result def _build_prompt(self, company_data: dict) -> str: return f"""请对以下科创企业进行技术风险评估: 企业名称:{company_data.get('short_name', '未知')} 行业:{company_data.get('industry', '未知')} 领域:{company_data.get('sector', '未知')} 企业描述:{company_data.get('description', '')} 技术路线信息: {json.dumps(company_data.get('tech_route', {}), ensure_ascii=False, indent=2)} 核心技术人员: {json.dumps(company_data.get('core_tech_personnel', []), ensure_ascii=False, indent=2)} 财务中的研发指标: - 研发费用: {company_data.get('financials', {}).get('rd_expense_2024', 0)} - 研发营收比: {company_data.get('financials', {}).get('rd_revenue_ratio', 0)} 请输出严格的JSON评估结果。""" def _rule_based_evaluation(self, company_data: dict) -> dict: """基于规则的技术风险评估""" tech_route = company_data.get("tech_route", {}) personnel = company_data.get("core_tech_personnel", []) financials = company_data.get("financials", {}) # 技术路线颠覆风险 competing_techs = tech_route.get("competing_techs", []) disruption_score = min(20 + len(competing_techs) * 15, 90) tech_moat = tech_route.get("tech_moat", "") if "差距" in tech_moat or "受制" in tech_moat: disruption_score = min(disruption_score + 20, 95) disruption_detail = f"面临 {len(competing_techs)} 条竞争技术路线: {', '.join(competing_techs[:3])}" # 核心人员流失风险 talent_score = 20 talent_detail = "核心团队稳定" departed = [p for p in personnel if "离职" in p.get("status", "")] high_importance = [p for p in personnel if p.get("importance") == "极高"] if departed: talent_score = 80 talent_detail = f"已有核心人员离职: {', '.join(p['name'] for p in departed)}" elif len(high_importance) == 1: talent_score = 55 talent_detail = f"高度依赖单一核心人员: {high_importance[0]['name']}" elif len(personnel) <= 2: talent_score = 45 talent_detail = "核心技术团队规模偏小" # 专利壁垒 patent_count = tech_route.get("patent_count", 0) if patent_count > 5000: patent_score = 20 patent_detail = f"专利数量充足({patent_count}件),技术壁垒较强" elif patent_count > 1000: patent_score = 35 patent_detail = f"专利数量中等({patent_count}件)" else: patent_score = 60 patent_detail = f"专利数量偏少({patent_count}件),技术壁垒偏弱" # 技术迭代压力(基于研发投入比) rd_ratio = financials.get("rd_revenue_ratio", 0) if rd_ratio > 0.3: iter_score = 65 iter_detail = f"研发营收比极高({rd_ratio:.1%}),说明行业技术迭代压力大" elif rd_ratio > 0.15: iter_score = 45 iter_detail = f"研发投入较高({rd_ratio:.1%}),需持续技术投入" else: iter_score = 25 iter_detail = f"研发投入适中({rd_ratio:.1%})" overall = int(disruption_score * 0.35 + talent_score * 0.25 + patent_score * 0.15 + iter_score * 0.25) return { "tech_disruption_risk": {"score": disruption_score, "level": self._level(disruption_score), "detail": disruption_detail}, "talent_loss_risk": {"score": talent_score, "level": self._level(talent_score), "detail": talent_detail}, "patent_moat": {"score": patent_score, "level": "弱" if patent_score >= 50 else ("中" if patent_score >= 30 else "强"), "detail": patent_detail}, "tech_iteration_pressure": {"score": iter_score, "level": self._level(iter_score), "detail": iter_detail}, "overall_tech_risk": {"score": overall, "level": self._level(overall)}, "key_findings": [disruption_detail, talent_detail, patent_detail], "recommendations": ["关注竞争技术路线发展", "加强核心人员留任激励"], } @staticmethod def _level(score: int) -> str: if score >= 70: return "高" elif score >= 40: return "中" return "低"