iflytek/astron-agent · error · NotImplementedError
IFlyAuditAPI.know_ref is not implemented yet
Error message
IFlyAuditAPI.know_ref is not implemented yet
What it means
IFlyAuditAPI.know_ref is a placeholder for the iFlytek 'knowRef' audit endpoint (/audit/v3/aichat/knowRef), which is meant to screen websites/knowledge bases referenced during LLM responses. The body only contains the commented-out path and a TODO, so calling it always raises NotImplementedError. It exists to satisfy the audit API interface contract, not to provide behavior.
Solutions
- Disable/skip the knowledge-reference audit stage in the pipeline configuration when using the iFlytek backend.
- Implement know_ref in ifly_audit_api.py calling POST /audit/v3/aichat/knowRef and raising CustomException(CodeEnum.AUDIT_*) when data.action != ActionEnum.NONE, mirroring output_text.
- Gate the call behind a capability check (e.g. hasattr/isinstance or a supports_know_ref flag) so unsupported backends degrade gracefully.
- File/track the TODO so the stub is implemented before enabling reference auditing in production.
Example fix
# before
async def know_ref(self, text: str, **kwargs: Any) -> None:
# path = f"/audit/v3/aichat/knowRef"
# TODO: To be implemented
raise NotImplementedError("IFlyAuditAPI.know_ref is not implemented yet")
# after
async def know_ref(self, text: str, **kwargs: Any) -> None:
payload = {"intention": "dialog", "content": text, **kwargs}
resp = await self._post("/audit/v3/aichat/knowRef", 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 audit_config.get("enable_know_ref_audit") or audit_backend == "iflytek":
logger.info("know_ref audit disabled: unsupported by iFlytek backend")
return Type guard
def implements_know_ref(api) -> bool:
import inspect
src = inspect.getsource(type(api).know_ref)
return "raise NotImplementedError" not in src Try / catch
try:
await audit_api.know_ref(reference_text)
except NotImplementedError:
logger.warning("know_ref audit not implemented; skipping reference screening")
except CustomException as e:
handle_audit_rejection(e) Prevention
- Keep a capability matrix of audit backends vs supported endpoints and drive config from it
- Skip knowledge-reference auditing for backends that lack the knowRef endpoint
- Raise at configuration-load time if an enabled feature maps to a stub method
- Cover all interface methods in CI so unimplemented stubs surface in tests, not production
When it happens
Trigger: Any invocation of IFlyAuditAPI.know_ref(...) while the iFlytek audit backend is active — arguments are irrelevant — typically when the audit pipeline processes knowledge-base/RAG references in LLM output.
Common situations: A RAG-enabled workflow configured with the iFlytek audit provider reaches the knowledge-reference moderation step; developers enable reference auditing in config without knowing the iFlytek backend lacks this capability; interface-conformance tests call every abstract method and hit the stub.
Related errors
- IFlyAuditAPI.output_media is not implemented yet
- SparkDesk-RAG does not support split operation.
- SparkDesk-RAG does not support chunks_save operation.
- SparkDesk-RAG does not support chunks_update operation.
- SparkDesk-RAG does not support chunks_delete operation.
AI-assisted analysis of iflytek/astron-agent@5e758547a8 (2026-09-12).
Data as JSON: /api/errors/0a600a018811ad64.
Report an issue: GitHub.
Appendix: source
Thrown at core/workflow/infra/audit_system/audit_api/iflytek/ifly_audit_api.py:462
: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)