{
"ok": true,
"data": {
"chunk_count": 2,
"total_chars": 188,
"total_estimated_tokens": 68,
"avg_chunk_tokens": 34,
"preserved_code_blocks": 1,
"preserved_tables": 1,
"chunks": [
{
"index": 0,
"chunk_id": "chk_2296f0a18a703ee7",
"text": "[Context: Gateway Manual > Authentication]\n\n# Gateway Manual\n\n## Authentication\n\nPass your proxy secret header.\n\n```bash\ncurl -X POST https://api.tinplate.dev/v1/json-heal\n```",
"raw_text": "# Gateway Manual\n\n## Authentication\n\nPass your proxy secret header.\n\n```bash\ncurl -X POST https://api.tinplate.dev/v1/json-heal\n```",
"heading_path": [
"Gateway Manual",
"Authentication"
],
"block_types": [
"heading",
"prose",
"code"
],
"char_count": 175,
"estimated_tokens": 44,
"start_line": 1,
"end_line": 8
},
{
"index": 1,
"chunk_id": "chk_664daeea150dbc83",
"text": "[Context: Gateway Manual > Quotas]\n\n## Quotas\n\n| Plan | Calls |\n| --- | --- |\n| Basic | 500 |",
"raw_text": "## Quotas\n\n| Plan | Calls |\n| --- | --- |\n| Basic | 500 |",
"heading_path": [
"Gateway Manual",
"Quotas"
],
"block_types": [
"heading",
"table"
],
"char_count": 93,
"estimated_tokens": 24,
"start_line": 10,
"end_line": 13
}
]
},
"meta": {
"request_id": "4810c6bd-31b3-45fe-92cc-1f98d1b44193",
"ms": 2,
"version": "1.0.53"
}
}
curl --location --request POST 'https://zylalabs.com/api/15524/markdown+and+code+rag+chunker+api/41760/split+markdown+or+text+into+token-budgeted+rag+chunks+with+heading+breadcrumbs+and+intact+code+table+blocks?text=# Gateway Manual
## Authentication
Pass your proxy secret header.
```bash
curl -X POST https://api.tinplate.dev/v1/json-heal
```
## Quotas
| Plan | Calls |
| --- | --- |
| Basic | 500 |&max_tokens=128&overlap_tokens=16&prepend_breadcrumbs=true' --header 'Authorization: Bearer YOUR_API_KEY'
注册后,每个开发者都会被分配一个个人 API 访问密钥,这是一个唯一的字母和数字组合,用于访问我们的 API 端点。要使用 Markdown 和代码 RAG 分块器 API 进行身份验证,只需在 Authorization 标头中包含您的 bearer token。
| 标头 | 描述 |
|---|---|
授权
|
必需
应为 Bearer access_key. 订阅后,请查看上方的"您的 API 访问密钥"。
|
将 Markdown 和技术文档拆分为符合 token 预算的 RAG 分块,同时保持围栏代码块和表格完整,注入标题导航路径,并生成确定性分块 ID
它返回一个 JSON 对象,其中包含 `ok` 状态,以及 `data` 中按 token 预算划分的文档块。响应包含汇总指标和一个 `chunks` 数组,其中每一项都包含块文本、原始文本、标题上下文、块类型、索引和确定性块 ID
该端点接受 Markdown 或纯技术文本。它可以识别标题、正文、围栏代码块和 Markdown 表格,从而在保留重要区块边界的同时处理结构化文档
各个文本块按照文档顺序返回在 `chunks` 数组中。每个文本块都包含 `index`、处理后的 `text`、原始 `raw_text`、`heading_path`、`block_types` 和 `chunk_id`,因此结果适用于索引、检索和源内容重构.
`chunk_count` 是生成的块数,`total_chars` 是字符总数,`total_estimated_tokens` 是估算的令牌总数,`avg_chunk_tokens` 是估算的平均大小。`preserved_code_blocks` 和 `preserved_tables` 报告了保留的结构
分割时,围栏代码块和 Markdown 表格会作为完整块处理。这可以防止代码示例或表格行被拆分到不同的块中,而 `block_types` 字段则标识每个结果中包含的结构
标题面包屑为每个文本块提供文档层级。`heading_path` 数组列出诸如 `["Gateway Manual", "Authentication"]` 的标题,而处理后的 `text` 可以包含类似 `[Context: Gateway Manual > Authentication]` 的上下文行,以提高检索相关性.
每个分块都会获得一个确定性的 `chunk_id`,例如 `chk_2296f0a18a703ee7`。这些稳定标识符可用于对分块去重、跟踪已索引内容、将搜索结果与源记录关联起来,以及检测重复处理中的未更改内容
这些分块可以存储为 RAG 文档、生成嵌入以进行语义搜索,或作为引用上下文返回。使用 `text` 进行带标题上下文的检索,在需要原始内容时使用 `raw_text`,并使用元数据字段进行筛选、显示和来源追踪