iflytek/astron-agent · warning · AuditServiceException

9023

9023

Error message

审核结果异常: {resp}

What it means

Same contract as the input audit: after POSTing model output to `/audit/v3/aichat/output`, `output_text` requires `data.action == ActionEnum.NONE`; otherwise it raises `AuditServiceException(*c9023)` ('审核结果异常: {resp}').

Solutions

  1. Read the exception's `resp` payload to identify the flagged category and span of text.
  2. Add guardrails/system prompts to steer the model away from flagged content.
  3. Adjust moderation policy thresholds on the audit platform for false positives.
  4. Return a user-friendly moderation message in the chat flow instead of surfacing the raw exception.
Defensive patterns

Strategy: try-catch

Type guard

def output_audit_passed(resp: dict) -> bool:
    from common.audit_system.audit_api.iflytek.ifly_audit_api import ActionEnum
    return resp.get("data", {}).get("action") == ActionEnum.NONE

Try / catch

try:
    await audit_api.output_text(...)
except AuditServiceException as e:
    logger.info("model output blocked by moderation: %s", e)
    yield fallback_safe_message()

Prevention

When it happens

Trigger: `output_text` receives an audit response whose `data.action` is not NONE, meaning the LLM's answer was flagged/blocked by output moderation.

Common situations: Model outputs containing sensitive content; RAG content pulling in flagged text; vendor policy updates newly flagging previously allowed output.

Understand the failure class

Background: "invalid response format", "malformed payload", "missing data field": when an API returns 200 but the response shape is wrong — this error's family across 23 libraries.

Related errors


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

Appendix: source

Thrown at core/common/audit_system/audit_api/iflytek/ifly_audit_api.py:256

        chat_app_id: str = "",
        uid: str = "",
        **kwargs: Any,
    ) -> None:
        payload = {
            "intention": "dialog",
            "stage": stage.value,
            "content": content,
            "pindex": pindex,
            "is_pending": is_pending,
            "is_stage_end": is_stage_end,
            "is_end": is_end,
            "chat_sid": chat_sid,
        }
        resp = await self._post(
            "/audit/v3/aichat/output", payload, span, chat_app_id, uid
        )
        if resp.get("data", {}).get("action") != ActionEnum.NONE:
            raise AuditServiceException(*c9023)(f"审核结果异常: {resp}")

    async def input_media(self, text: str, **kwargs: Any) -> None:
        """
        大模型内容安全场景中,对用户输入的文本、图片、视频、文档等进行过滤、检测和识别,并根据安全策略进行相应的处理和响应。
        :param text:
        :param kwargs:
        :return:
        """
        # path = f"/audit/v3/aichat/inputMedia"

        raise NotImplementedError("IFlyAuditAPI.input_media is not implemented yet")

    async def output_media(self, text: str, **kwargs: Any) -> None:
        """
        大模型内容安全场景中,对大模型输出的图片、视频、音频等进行过滤、检测和识别,并根据安全策略进行相应的处理和响应。
        :param text:
        :param kwargs:
        :return:

View on GitHub (pinned to 5e758547a8)