iflytek/astron-agent · error · NotImplementedError

IFlyAuditAPI.output_media is not implemented yet

Error message

IFlyAuditAPI.output_media is not implemented yet

What it means

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.

Solutions

  1. 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.
  2. Switch the configured audit API to an implementation that supports media (e.g. MockAuditAPI alternative or another backend) via the audit-system configuration.
  3. 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.
  4. Add capability discovery or a guard in the audit pipeline so unsupported audit kinds are skipped/logged instead of crashing the run.

Example fix

# before
async def output_media(self, text: str, **kwargs: Any) -> None:
    # path = f"/audit/v3/aichat/outputMedia"
    # TODO: To be implemented
    raise NotImplementedError("IFlyAuditAPI.output_media is not implemented yet")

# after
async def output_media(self, text: str, **kwargs: Any) -> None:
    payload = {"intention": "dialog", "content": text, **kwargs}
    resp = await self._post("/audit/v3/aichat/outputMedia", payload, kwargs.get("chat_app_id", ""), kwargs.get("uid", ""))
    if resp.get("data", {}).get("action") != ActionEnum.NONE:
        raise CustomException(CodeEnum.AUDIT_OUTPUT_ERROR, cause_error=f"Audit result abnormal: {resp}")
Defensive patterns

Strategy: fallback

Validate before calling

if not getattr(audit_api, "supports_media_audit", False):
    logger.warning("Audit backend %s does not support media audit; skipping", type(audit_api).__name__)
    return

Type guard

def supports_output_media(api) -> bool:
    cls = type(api)
    impl = cls.output_media
    return not getattr(impl, "__is_stub__", False) and "NotImplementedError" not in (impl.__doc__ or "")

Try / catch

try:
    await audit_api.output_media(media_ref)
except NotImplementedError:
    logger.warning("output_media unimplemented for %s; falling back to text-only audit", type(audit_api).__name__)
except CustomException as e:
    handle_audit_rejection(e)

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of iflytek/astron-agent@5e758547a8 (2026-09-12). Data as JSON: /api/errors/d00d5515c62b32ed. Report an issue: GitHub.

Appendix: source

Thrown at core/workflow/infra/audit_system/audit_api/iflytek/ifly_audit_api.py:450

        :param kwargs: Additional keyword arguments
        :return: None
        """
        # path = f"/audit/v3/aichat/inputMedia"

        # TODO: To be implemented
        raise NotImplementedError("IFlyAuditAPI.input_media is not implemented yet")

    async def output_media(self, text: str, **kwargs: Any) -> None:
        """
        In LLM content security scenarios, filter, detect and identify LLM output images,
        videos, audio, etc., and process and respond accordingly based on security policies.
        :param text: Text content to be processed
        :param kwargs: Additional keyword arguments
        :return: None
        """
        # path = f"/audit/v3/aichat/outputMedia"
        # TODO: To be implemented
        raise NotImplementedError("IFlyAuditAPI.output_media is not implemented yet")

    async def know_ref(self, text: str, **kwargs: Any) -> None:
        """
        In LLM content security scenarios, filter, detect and identify websites, knowledge bases
        and other data referenced during LLM responses, and process and respond accordingly based on security policies.
        :param text: Text content to be processed
        :param kwargs: Additional keyword arguments
        :return: None
        """
        # path = f"/audit/v3/aichat/knowRef"
        # TODO: To be implemented
        raise NotImplementedError("IFlyAuditAPI.know_ref is not implemented yet")

View on GitHub (pinned to 5e758547a8)