iflytek/astron-agent · error · NotImplementedError
MockAuditAPI.output_media is not implemented yet
Error message
MockAuditAPI.output_media is not implemented yet
What it means
MockAuditAPI is the mock/no-op implementation of the audit API client in the workflow service's audit system. Its output_media method is a stub for the `/audit/v3/aichat/outputMedia` endpoint that has not been implemented yet, so any call immediately raises NotImplementedError. The library throws it to fail loudly rather than silently skipping output-media moderation.
Solutions
- Switch the audit API configuration to the real audit service client instead of MockAuditAPI
- Implement output_media in mock_audit_api.py following the pattern of other implemented mock methods (perform the same validation/no-op contract as the real client)
- If media auditing is not needed in this environment, guard the call site so output_media is only invoked when the frame's content type requires it
Example fix
// before (mock_audit_api.py)
async def output_media(self, text: str, **kwargs: Any) -> None:
# path = f"/audit/v3/aichat/outputMedia"
# TODO: To be implemented
raise NotImplementedError("MockAuditAPI.output_media is not implemented yet")
// after
async def output_media(self, text: str, **kwargs: Any) -> None:
logger.info("mock output_media skipped: %s", text)
return None Defensive patterns
Strategy: try-catch
Validate before calling
from infra.audit_system.audit_api.mock.mock_audit_api import MockAuditAPI
if isinstance(audit_api, MockAuditAPI):
raise RuntimeError("output_media is unimplemented in MockAuditAPI; use the real audit client") Type guard
def supports_output_media(api) -> bool:
impl = getattr(type(api), "output_media", None)
return impl is not None and "not implemented" not in (impl.__doc__ or "") Try / catch
try:
await audit_api.output_media(text)
except NotImplementedError:
logger.warning("output_media not implemented by %s; skipping media audit", type(audit_api).__name__) Prevention
- Do not wire MockAuditAPI into environments that exercise media/output auditing
- Keep the mock's stubs in sync with the real client's interface; track TODOs
- Add a startup check that fails fast if an unimplemented audit API method is reachable
When it happens
Trigger: Any code path calls `await MockAuditAPI().output_media(text, **kwargs)` — e.g. the audit pipeline processes an output/media frame while the audit client is configured to use the mock implementation instead of the real audit service client.
Common situations: Running the workflow service locally or in tests where the mock audit API is wired in via config, but the audit strategy still emits media/output-media audit calls; the real HTTP client exists but the mock was never finished (see the TODO and commented-out path).
Related errors
- MockAuditAPI.input_media is not implemented yet
- MockAuditAPI.know_ref is not implemented yet
- IFlyAuditAPI.output_media is not implemented yet
- IFlyAuditAPI.know_ref is not implemented yet
- SparkDesk-RAG does not support split operation.
AI-assisted analysis of iflytek/astron-agent@5e758547a8 (2026-09-12).
Data as JSON: /api/errors/1126f33ecd5a162e.
Report an issue: GitHub.
Appendix: source
Thrown at core/workflow/infra/audit_system/audit_api/mock/mock_audit_api.py:260
:param kwargs: Additional keyword arguments
:return: None
"""
# path = f"/audit/v3/aichat/inputMedia"
# TODO: To be implemented
raise NotImplementedError("MockAuditAPI.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("MockAuditAPI.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("MockAuditAPI.know_ref is not implemented yet")
View on GitHub (pinned to 5e758547a8)