{"record":{"id":"ed1ad2c963dcecbf","repo":"HKUDS/DeepTutor","slug":"summaryagent-prompts-are-not-configured","errorCode":null,"errorMessage":"SummaryAgent prompts are not configured.","messagePattern":"SummaryAgent prompts are not configured\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"deeptutor/agents/math_animator/agents/summary_agent.py","lineNumber":43,"sourceCode":"            api_key=api_key,\n            base_url=base_url,\n            api_version=api_version,\n            language=language,\n        )\n\n    async def process(\n        self,\n        *,\n        user_input: str,\n        output_mode: str,\n        analysis: ConceptAnalysis,\n        design: SceneDesign,\n        render_result: RenderResult,\n    ) -> SummaryPayload:\n        system_prompt = self.get_prompt(\"system\")\n        user_template = self.get_prompt(\"user_template\")\n        if not system_prompt or not user_template:\n            raise ValueError(\"SummaryAgent prompts are not configured.\")\n\n        user_prompt = user_template.format(\n            user_input=user_input.strip(),\n            output_mode=output_mode,\n            analysis_json=json.dumps(analysis.model_dump(), ensure_ascii=False, indent=2),\n            design_json=json.dumps(design.model_dump(), ensure_ascii=False, indent=2),\n            render_json=json.dumps(render_result.model_dump(), ensure_ascii=False, indent=2),\n        )\n        _chunks: list[str] = []\n        async for _c in self.stream_llm(\n            user_prompt=user_prompt,\n            system_prompt=system_prompt,\n            response_format={\"type\": \"json_object\"},\n            stage=\"summary\",\n            trace_meta=build_trace_metadata(\n                call_id=new_call_id(\"math-summary\"),\n                phase=\"summary\",\n                label=\"Summarize result\",","sourceCodeStart":25,"sourceCodeEnd":61,"githubUrl":"https://github.com/HKUDS/DeepTutor/blob/3e82f130422a813cdd73c10b21a44e9325f5821a/deeptutor/agents/math_animator/agents/summary_agent.py#L25-L61","documentation":"Raised by _extract_docx when the primary python-docx extraction produced no text, the raw OOXML fallback also produced nothing, and python-docx is not installed in the environment. With no library and no fallback text, extraction is impossible and CorruptDocumentError is raised.","triggerScenarios":"Calling extraction on a .docx in an environment without python-docx where the file contains no <w:t> text (empty document, images-only, or a .docx that is actually not a Word file).","commonSituations":"Minimal installs of deeptutor-cli; users renaming other files to .docx; documents consisting solely of embedded images.","solutions":["Install python-docx (pip install python-docx) so the primary path can extract formatted content","If the docx is image-only, run OCR on embedded images instead","Verify the file is genuinely a Word file (check magic bytes / _check_magic) before extraction"],"exampleFix":"// before\n# no python-docx installed, empty-content docx\ntext = extract_text_from_bytes(data, filename=\"empty.docx\")  # raises\n\n// after\npip install python-docx\ntext = extract_text_from_bytes(data, filename=\"empty.docx\")","handlingStrategy":"validation","validationCode":"def docx_lib_available() -> bool:\n    try:\n        import docx  # noqa\n        return True\n    except ImportError:\n        return False\n\nif not docx_lib_available() and ext == \".docx\":\n    warn(\"python-docx missing; OOXML fallback only\")","typeGuard":null,"tryCatchPattern":"except CorruptDocumentError as e:\n    if \"python-docx not installed\" in str(e):\n        subprocess pip_install(\"python-docx\") or mark_file_unreadable(fn)","preventionTips":["Install the full document extra in environments that ingest Office files","Check that uploads are real OOXML (PK magic) not renamed legacy files"],"tags":["docx","missing-dependency","empty-document","python-docx"],"backgroundTag":"missing-optional-dependency","analyzedSha":"3e82f130422a813cdd73c10b21a44e9325f5821a","analyzedAt":"2026-08-27T06:57:25.364Z","schemaVersion":2},"datasetVersion":"2026-08-27T08:17:20.692Z"}