Skip to main content

zleap_parser

zleap_parser 是 zleap 的 Python 文档解析 SDK:把本地文件或远程 HTML 转换为 Markdown,并归档为知识型 .octx 文件。当前规划基线为 M2.8 (0.2.1),普通解析与连接器取数不依赖外部事项提取或向量服务。

文档

  1. 计划总览
  2. 安装与快速上手
  3. 配置手册
  4. 文档解析 API
  5. 连接器 API
  6. 钉钉连接器与 MCP 方案
  7. 服务 API 与部署

安装

python -m pip install zleap_parser

# URL 采集首次使用时准备浏览器二进制
python -m camoufox fetch

可选能力通过 extras 安装:

python -m pip install "zleap_parser[pdf]"
python -m pip install "zleap_parser[xlsx]"
python -m pip install "zleap_parser[media]"       # 另需系统 ffmpeg
python -m pip install "zleap_parser[db-all]"
python -m pip install "zleap_parser[dingtalk-oa]" # 钉钉 OA MCP(可选)
python -m pip install "zleap_parser[dingtalk-profile]" # 钉钉加密 profile(可选)

SQLite、Markdown 归档和普通文本解析可直接运行。RTF/XLSX 预览需要系统 soffice/libreoffice;URL 采集需要 Camoufox 浏览器二进制。

最小示例

import zleap_parser
from zleap_parser import CacheConfig, Parser

zleap_parser.config(cache=CacheConfig(cache_namespace="sdk-default"))
parser = Parser()

parsed = parser.parse(file="/path/to/document.pdf")
print(parsed["result"])       # 已存在的 *.octx 路径
print(parsed["usage"])        # 完整零用量账本

csv_path = parser.pack_csv_to_octx("name,age\nAlice,30\n")
print(csv_path)

Parser.parse(url=...)Parser.parse(file=...) 必须二选一。归档产物包含 knowledge/main.md、metadata 和原始附件;不会生成事项、关系或向量文件。

连接器

from zleap_parser.connector import Connector, RSSAdapter

result = Connector().fetch(
    adapter=RSSAdapter(url="https://example.com/feed.xml", limit=20)
)
print(result["results"])       # knowledge-only *.octx 路径列表
print(result["usage"])         # 普通数据源为完整零用量

内置数据源包括 RSS/WebSearch/DeepCrawl、企业微信/飞书/Salesmartly/钉钉 聊天与群列表、钉钉知识库/云盘/文档/OA 审批、邮件、API 请求、 GitHub/GitLab/Gitee 仓库、DB/BigDB。所有数据源统一使用 fetch(); 邮件额外返回邮件 OCTX 列表和 sync-cursor OCTX。

Git 仓库分析是唯一默认会调用模型的取数场景。它使用统一 LLMConfig 和 OpenAI-compatible 客户端,分析摘要写入 knowledge Markdown,代码文件作为 附件归档;usage 明细统一为 kind="llm"

配置和多模态能力

文本及未来多模态请求统一使用 LLMConfigsupports_multimodal=False 为 默认值,只有显式设置为 True 才表示模型接受多模态消息;M2.8 不执行多模态 enrichment,不根据模型名猜测能力,也不静默降级。

CacheConfig.cache_namespace 默认 "sdk-default",参与所有缓存 key/signature。 多租户服务必须为每个任务创建独立配置快照,例如 tenant-<sha256(tenant_id) 前 32 位>,不得在并发任务中修改全局配置。

文件格式

支持文本、源码、PDF、RTF、DOCX、PPTX、XLSX、HTML、XML、图片和音视频。 格式识别优先依据内容特征;新增格式通过 BaseAdapter 插件接入。

API 变更(M2.8)

  • 保留 Parser.parse()pack_to_octx()pack_csv_to_octx()pack_xlsx_to_octx()Connector.fetch()
  • 直接删除旧的事项提取/向量入口、旧连接器组合入口及其残留模块; 不提供兼容别名、弃用警告或失败桩。
  • 移除 embedding 配置和独立视觉模型/图片处理配置;只保留 LLMConfig.supports_multimodal 能力字段。
  • OCTX metadata 写入 com.zleap.parser.archive_schema=knowledge-only/1, capability 集合显式为空。

历史需求和旧版本行为请查阅 plan/M1plan/M2plan/M2.5plan/M2.6plan/M2.7CHANGELOG.md;这些记录不构成当前安装或 API 依据。

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

zleap_parser-0.2.1.tar.gz (47.0 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

zleap_parser-0.2.1-py3-none-any.whl (3.7 MB view details)

Uploaded Python 3

File details

Details for the file zleap_parser-0.2.1.tar.gz.

File metadata

  • Download URL: zleap_parser-0.2.1.tar.gz
  • Upload date:
  • Size: 47.0 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.12.6

File hashes

Hashes for zleap_parser-0.2.1.tar.gz
Algorithm Hash digest
SHA256 0d6835d7f8dc1b1114db887cbb374f7d2802b7b1edd449acfc0278a233fb2640
MD5 0b8e764e357dbbebc38118caf3b6fbf3
BLAKE2b-256 b0587423503ad2095fc42d39749120c6621ef476048d0144ce0542580133d8fe

See more details on using hashes here.

File details

Details for the file zleap_parser-0.2.1-py3-none-any.whl.

File metadata

  • Download URL: zleap_parser-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 3.7 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.12.6

File hashes

Hashes for zleap_parser-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 077e0e72419b3f1936a39a63638f634cde33f760c9d835978f95e912e9ef2770
MD5 f34650f4e6962a936aef54e5a38eb44b
BLAKE2b-256 24db0fa84055baadbdd0f215c401760696a380a3eb6b66059ed2ed19b48f1129

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.2.1 This release

2 files

0.2.0

2 files

0.1.5

3 files

0.1.4

2 files

0.1.3

2 files

0.1.2

2 files

0.1.1

2 files

0.1.0

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page