iflytek/astron-agent · warning · NotImplementedError

IFlyAuditAPI.input_media is not implemented yet

Error message

IFlyAuditAPI.input_media is not implemented yet

What it means

input_media is a stub: the endpoint path /audit/v3/aichat/inputMedia is commented out and the method immediately raises NotImplementedError. The media (image/video/audio) input audit capability has not been implemented in IFlyAuditAPI yet.

Solutions

  1. Do not call input_media; gate multimodal flows on feature detection and fall back to text-only auditing.
  2. Implement the method following output_text's pattern: build the payload, call self._post('/audit/v3/aichat/inputMedia', ...), and check data.action != ActionEnum.NONE.
  3. Alternatively register a different audit API implementation that supports media via the audit_system abstraction.

Example fix

// before
class MediaAuditor:
    async def audit(self, api, media):
        await api.input_media(media.url)  # NotImplementedError
// after: feature-detect and fallback
if isinstance(api, IFlyAuditAPI):
    logger.warning("media audit not supported; skipping")
    return
await api.input_media(media.url)
Defensive patterns

Strategy: fallback

Validate before calling

def supports_media_audit(api) -> bool:
    return not isinstance(api, IFlyAuditAPI)

Type guard

def has_media_audit(api) -> bool:
    return callable(getattr(api, 'input_media', None)) and not isinstance(api, IFlyAuditAPI)

Try / catch

try:
    await api.input_media(media_url)
except NotImplementedError:
    logger.warning("media audit unavailable; using text-only audit")
    await api.input_text(media_caption, chat_sid, span)

Prevention

When it happens

Trigger: Any call to IFlyAuditAPI.input_media(text, **kwargs), e.g. attempting to audit user-uploaded images or audio before sending them through a workflow.

Common situations: Developers extending the audit pipeline to multimodal content assume parity with input_text/output_text and call the media methods; feature was planned (TODO in code) but not wired up.

Related errors


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

Appendix: source

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

        )
        if resp.get("data", {}).get("action") != ActionEnum.NONE:
            raise CustomException(
                CodeEnum.AUDIT_OUTPUT_ERROR,
                cause_error=f"Audit result abnormal: {resp}",
            )

    async def input_media(self, text: str, **kwargs: Any) -> None:
        """
        In LLM content security scenarios, filter, detect and identify user input text,
        images, videos, documents, 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/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

View on GitHub (pinned to 5e758547a8)