Skip to content

Self-evolving Context Database for AI Agents. Unify Agent Memory, Knowledge RAG and Skills.

523 B
Raw Blame
# Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
# SPDX-License-Identifier: AGPL-3.0
from typing import Any, Dict, Optional


def form_error(err: Any, code: int = 400, data: Optional[Dict] = None) -> tuple:
    if data is None:
        data = {}
    return {"code": code, "message": str(err), "data": data}, 400


def form_res(data: Any = None, code: int = 200, message: str = "success") -> tuple:
    if data is None:
        data = {}
    return {"code": code, "message": str(message), "data": data}, 200