SoftwareResearch/g2dm-research
0
1"""Independent reviewer for category Special Considerations."""2import prompts3import research_engine4 5MODEL = research_engine.MODEL6 7 8def review_considerations(*, category, special_considerations):9 client = research_engine.get_client()10 try:11 resp = client.messages.create(12 model=MODEL,13 max_tokens=2500,14 thinking={"type": "adaptive"},15 output_config={"effort": "high"},16 system=prompts.REVIEWER_SYSTEM,17 messages=[{18 "role": "user",19 "content": prompts.build_reviewer_user_message(20 category=category,21 special_considerations=special_considerations,22 ),23 }],24 )25 text = research_engine._final_text(resp)26 data = research_engine._extract_json(text)27 if data is None:28 return {"error": "Could not parse reviewer output", "raw": text[:2000]}29 return {30 "category": category,31 "assessment": data.get("assessment", ""),32 "issues": data.get("issues", []) or [],33 "suggested_considerations": data.get("suggested_considerations", ""),34 "change_summary": data.get("change_summary", ""),35 "needs_update": bool(data.get("needs_update", False)),36 }37 except Exception as exc: # noqa: BLE00138 return {"error": f"{type(exc).__name__}: {exc}", "category": category}39 