用途:通过 ibl.ai 平台 API 管理某个智能体(agent)的 RAG 训练数据集,即向智能体知识库投喂资料并维护其训练状态。
认证与约定:Base URL 为 https://api.iblai.app;每个请求需带 Header: Authorization: Api-Token $IBLAI_API_KEY。路径变量中 {org}=$IBLAI_ORG,{username}=$IBLAI_USERNAME,{mentor} 为智能体唯一 id(即 pathway)。相关端点位于 …/dm/api/ai-index/… 下。尚未连接时需先运行 /iblai-api-login 以填充 IBLAI_ORG、IBLAI_USERNAME、IBLAI_API_KEY。
读取:GET …/orgs/{org}/users/{username}/documents/pathways/{mentor}/?limit=5&offset={n}&search={q} 列出训练文档;文档处于 pending 时应每 2 秒轮询。每行会显示训练者 username、user_email、user_full_name(后两者在 username 不对应任何用户时为 null)。GET …/documents/{document_id}/settings/ 获取重训计划。列 GitHub 分支用 https://api.github.com/repos/{owner}/{repo}/branches(外部、无需认证)。
写入:POST …/documents/train/ 添加训练资源(multipart/form-data),type 可为 file、url、youtube、blackboard、webcrawler、github;文件需 file 字段,URL/YouTube/Blackboard 需 url,网站爬取可设 crawler_max_depth、crawler_max_pages_limit、crawler_match_patterns、crawler_pattern_type(glob|regex),GitHub 需 url 与 branch。所有类型均可带 custom_metadata:扁平 JSON 对象,键须为 ^\w+$(无 __),值为标量,作为检索过滤器的硬条件。PUT …/documents/{document_id}/ 用于训练/取消训练、设置 access(public|private)并可替换 custom_metadata(省略则不变)。POST …/documents/{document_id}/settings/ 用 retrain_interval_days 设置重训周期。DELETE …/documents/{document_id}/ 删除数据集,属破坏性操作,须先与用户确认。
限制:custom_metadata 校验失败会返回验证错误;未打标签的文档不会被某键的过滤器排除;删除不可逆。