create
curl --request POST \
--url https://api.example.com/open/agentic_doc_processor/{tenant_name}/v1/app-manage/createconst options = {method: 'POST'};
fetch('https://api.example.com/open/agentic_doc_processor/{tenant_name}/v1/app-manage/create', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.example.com/open/agentic_doc_processor/{tenant_name}/v1/app-manage/create"
response = requests.post(url)
print(response.text)HttpResponse<String> response = Unirest.post("https://api.example.com/open/agentic_doc_processor/{tenant_name}/v1/app-manage/create")
.asString();const url = 'https://api.example.com/open/agentic_doc_processor/{tenant_name}/v1/app-manage/create';
const options = {method: 'POST'};
fetch(url, options)
.then(res => res.json())
.then(json => console.log(json))
.catch(err => console.error(err));package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/open/agentic_doc_processor/{tenant_name}/v1/app-manage/create"
req, _ := http.NewRequest("POST", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}using RestSharp;
var options = new RestClientOptions("https://api.example.com/open/agentic_doc_processor/{tenant_name}/v1/app-manage/create");
var client = new RestClient(options);
var request = new RestRequest("");
var response = await client.PostAsync(request);
Console.WriteLine("{0}", response.Content);
<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.example.com/open/agentic_doc_processor/{tenant_name}/v1/app-manage/create",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}创建高速版抽取应用
通过创建抽取应用 OpenAPI 创建高速版自定义抽取应用。
POST
/
open
/
agentic_doc_processor
/
{tenant_name}
/
v1
/
app-manage
/
create
create
curl --request POST \
--url https://api.example.com/open/agentic_doc_processor/{tenant_name}/v1/app-manage/createconst options = {method: 'POST'};
fetch('https://api.example.com/open/agentic_doc_processor/{tenant_name}/v1/app-manage/create', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.example.com/open/agentic_doc_processor/{tenant_name}/v1/app-manage/create"
response = requests.post(url)
print(response.text)HttpResponse<String> response = Unirest.post("https://api.example.com/open/agentic_doc_processor/{tenant_name}/v1/app-manage/create")
.asString();const url = 'https://api.example.com/open/agentic_doc_processor/{tenant_name}/v1/app-manage/create';
const options = {method: 'POST'};
fetch(url, options)
.then(res => res.json())
.then(json => console.log(json))
.catch(err => console.error(err));package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/open/agentic_doc_processor/{tenant_name}/v1/app-manage/create"
req, _ := http.NewRequest("POST", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}using RestSharp;
var options = new RestClientOptions("https://api.example.com/open/agentic_doc_processor/{tenant_name}/v1/app-manage/create");
var client = new RestClient(options);
var request = new RestRequest("");
var response = await client.PostAsync(request);
Console.WriteLine("{0}", response.Content);
<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.example.com/open/agentic_doc_processor/{tenant_name}/v1/app-manage/create",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}创建高速版自定义抽取应用时,复用标准的创建抽取应用接口。你需要在请求体中将
ai_function 设置为 1425,并将 parse_mode 设置为 fast_vlm。
POST /open/agentic_doc_processor/{tenant_name}/v1/app-manage/create
ai_function 必须传 1425。如果不传或传其他值,服务会按标准自定义抽取应用创建。请求参数
| 名称 | 类型 | 是否必填 | 描述 |
|---|---|---|---|
tenant_name | string | 是 | 租户名称,默认 laiye。 |
app_name | string | 是 | 应用名称,长度 1-100。 |
ai_function | integer | 是 | 应用类型。高速版自定义抽取固定传 1425;标准自定义抽取为 1406。 |
app_label | string[] | 否 | 应用标签列表,最多 5 个。 |
extract_fields | object[] | 是 | 抽取字段配置列表,最多 20 个字段。 |
parse_mode | string | 是 | 解析模式。高速版建议传 fast_vlm。 |
enable_long_doc | boolean | 否 | 是否开启长文档支持,默认 false。 |
long_doc_config | object[] | 否 | 长文档配置,最多 5 组,仅 enable_long_doc=true 时使用。 |
字段配置
extract_fields[]
| 名称 | 类型 | 是否必填 | 描述 |
|---|---|---|---|
field_name | string | 是 | 字段名称。 |
field_type | string | 是 | 字段类型,支持 string、date、table。 |
field_prompt | string | 否 | 字段抽取提示词。 |
sub_fields | object[] | 条件必填 | 表格子字段。field_type=table 时必须至少提供 1 个有效子字段。 |
sub_fields[]
| 名称 | 类型 | 是否必填 | 描述 |
|---|---|---|---|
field_name | string | 是 | 子字段名称。 |
field_type | string | 是 | 子字段类型,支持 string、date。 |
field_prompt | string | 否 | 子字段抽取提示词。 |
请求示例
curl --request POST \
--url 'https://adp.laiye.com/open/agentic_doc_processor/laiye/v1/app-manage/create' \
--header 'Content-Type: application/json' \
--header 'X-API-KEY: {api_key}' \
--data '{
"app_name": "高速版发票抽取应用",
"ai_function": 1425,
"app_label": ["invoice", "high-speed"],
"extract_fields": [
{
"field_name": "发票号码",
"field_type": "string",
"field_prompt": "抽取发票上的唯一发票号码。"
},
{
"field_name": "开票日期",
"field_type": "date",
"field_prompt": "抽取发票开具日期。"
},
{
"field_name": "供应商名称",
"field_type": "string",
"field_prompt": "抽取销售方或供应商名称。"
}
],
"parse_mode": "fast_vlm",
"enable_long_doc": false
}'
表格字段示例
{
"app_name": "高速版订单抽取应用",
"ai_function": 1425,
"app_label": ["purchase-order", "high-speed"],
"extract_fields": [
{
"field_name": "订单号",
"field_type": "string",
"field_prompt": "抽取采购订单编号。"
},
{
"field_name": "商品明细",
"field_type": "table",
"field_prompt": "抽取订单中的商品或服务明细。",
"sub_fields": [
{
"field_name": "商品名称",
"field_type": "string",
"field_prompt": "抽取明细行中的商品名称。"
},
{
"field_name": "数量",
"field_type": "string",
"field_prompt": "抽取明细行中的数量。"
},
{
"field_name": "交付日期",
"field_type": "date",
"field_prompt": "抽取明细行中的交付日期。"
}
]
}
],
"parse_mode": "fast_vlm",
"enable_long_doc": false
}
响应示例
{
"code": "success",
"message": "",
"tips": null,
"data": {
"app_id": "app_abc123",
"app_name": "高速版发票抽取应用",
"app_label": ["invoice", "high-speed"],
"config_version": "v1"
}
}
后续调用
| 目标 | OpenAPI |
|---|---|
| 查询应用配置 | POST /open/agentic_doc_processor/{tenant_name}/v1/app-manage/config |
| 更新应用配置 | POST /open/agentic_doc_processor/{tenant_name}/v1/app-manage/update |
| 同步执行高速版抽取 | POST /open/agentic_doc_processor/{tenant_name}/v1/app/doc/extract |
| 创建异步高速版抽取任务 | POST /open/agentic_doc_processor/{tenant_name}/v1/app/doc/extract/create/task |
| 查询异步抽取任务 | GET /open/agentic_doc_processor/{tenant_name}/v1/app/doc/extract/query/task/{task_id} |
⌘I
