{"record":{"id":"d00d5515c62b32ed","repo":"iflytek/astron-agent","slug":"iflyauditapi-output-media-is-not-implemented-yet","errorCode":null,"errorMessage":"IFlyAuditAPI.output_media is not implemented yet","messagePattern":"IFlyAuditAPI\\.output_media is not implemented yet","errorType":"exception","errorClass":"NotImplementedError","httpStatus":null,"severity":"error","filePath":"core/workflow/infra/audit_system/audit_api/iflytek/ifly_audit_api.py","lineNumber":450,"sourceCode":"        :param kwargs: Additional keyword arguments\n        :return: None\n        \"\"\"\n        # path = f\"/audit/v3/aichat/inputMedia\"\n\n        # TODO: To be implemented\n        raise NotImplementedError(\"IFlyAuditAPI.input_media is not implemented yet\")\n\n    async def output_media(self, text: str, **kwargs: Any) -> None:\n        \"\"\"\n        In LLM content security scenarios, filter, detect and identify LLM output images,\n        videos, audio, etc., and process and respond accordingly based on security policies.\n        :param text: Text content to be processed\n        :param kwargs: Additional keyword arguments\n        :return: None\n        \"\"\"\n        # path = f\"/audit/v3/aichat/outputMedia\"\n        # TODO: To be implemented\n        raise NotImplementedError(\"IFlyAuditAPI.output_media is not implemented yet\")\n\n    async def know_ref(self, text: str, **kwargs: Any) -> None:\n        \"\"\"\n        In LLM content security scenarios, filter, detect and identify websites, knowledge bases\n        and other data referenced during LLM responses, and process and respond accordingly based on security policies.\n        :param text: Text content to be processed\n        :param kwargs: Additional keyword arguments\n        :return: None\n        \"\"\"\n        # path = f\"/audit/v3/aichat/knowRef\"\n        # TODO: To be implemented\n        raise NotImplementedError(\"IFlyAuditAPI.know_ref is not implemented yet\")\n","sourceCodeStart":432,"sourceCodeEnd":463,"githubUrl":"https://github.com/iflytek/astron-agent/blob/5e758547a83371a5a4b29dadf4ac03e8dd527635/core/workflow/infra/audit_system/audit_api/iflytek/ifly_audit_api.py#L432-L463","documentation":"IFlyAuditAPI.output_media is a stub for the iFlytek content-security 'outputMedia' audit endpoint (/audit/v3/aichat/outputMedia). The method body is unimplemented (only a commented-out path and a TODO), so any call unconditionally raises NotImplementedError. This is intentional: the real LLM output-media (image/video/audio) moderation flow has not been wired up against the iFlytek audit service yet.","triggerScenarios":"Any call to IFlyAuditAPI.output_media(...) while the iFlytek audit backend (IFlyAuditAPI) is the configured audit implementation — regardless of arguments — because the method has no implementation.","commonSituations":"An agent/workflow run configured with the iFlytek audit provider hits a pipeline stage that audits LLM-generated media (images, videos, audio) rather than text; teams switch from MockAuditAPI to the production iFlytek backend without realizing media moderation is unimplemented; tests exercising the full audit interface surface the gap.","solutions":["Do not call output_media with the iFlytek backend; route media moderation to input_text/output_text text audits or skip the media stage until implemented.","Switch the configured audit API to an implementation that supports media (e.g. MockAuditAPI alternative or another backend) via the audit-system configuration.","Implement the method in core/workflow/infra/audit_system/audit_api/iflytek/ifly_audit_api.py using the documented endpoint /audit/v3/aichat/outputMedia, mirroring the payload/response handling of output_text.","Add capability discovery or a guard in the audit pipeline so unsupported audit kinds are skipped/logged instead of crashing the run."],"exampleFix":"# before\nasync def output_media(self, text: str, **kwargs: Any) -> None:\n    # path = f\"/audit/v3/aichat/outputMedia\"\n    # TODO: To be implemented\n    raise NotImplementedError(\"IFlyAuditAPI.output_media is not implemented yet\")\n\n# after\nasync def output_media(self, text: str, **kwargs: Any) -> None:\n    payload = {\"intention\": \"dialog\", \"content\": text, **kwargs}\n    resp = await self._post(\"/audit/v3/aichat/outputMedia\", payload, kwargs.get(\"chat_app_id\", \"\"), kwargs.get(\"uid\", \"\"))\n    if resp.get(\"data\", {}).get(\"action\") != ActionEnum.NONE:\n        raise CustomException(CodeEnum.AUDIT_OUTPUT_ERROR, cause_error=f\"Audit result abnormal: {resp}\")","handlingStrategy":"fallback","validationCode":"if not getattr(audit_api, \"supports_media_audit\", False):\n    logger.warning(\"Audit backend %s does not support media audit; skipping\", type(audit_api).__name__)\n    return","typeGuard":"def supports_output_media(api) -> bool:\n    cls = type(api)\n    impl = cls.output_media\n    return not getattr(impl, \"__is_stub__\", False) and \"NotImplementedError\" not in (impl.__doc__ or \"\")","tryCatchPattern":"try:\n    await audit_api.output_media(media_ref)\nexcept NotImplementedError:\n    logger.warning(\"output_media unimplemented for %s; falling back to text-only audit\", type(audit_api).__name__)\nexcept CustomException as e:\n    handle_audit_rejection(e)","preventionTips":["Check backend capabilities before enabling media moderation stages in audit config","Do not route media content to text-only audit backends","Write an interface conformance test that fails loudly on stub methods in production profiles","Track TODO stubs in the audit module and gate them behind feature flags"],"tags":["python","audit","not-implemented","iflytek","content-moderation"],"backgroundTag":"method-not-implemented","analyzedSha":"5e758547a83371a5a4b29dadf4ac03e8dd527635","analyzedAt":"2026-09-12T08:03:51.356Z","contentChangedAt":"2026-09-12T08:03:51.356Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}