跳到主要内容

📝🔎 iApp 文本摘要 API [版本 2]

1 IC每400字符
✅ 活跃🗣️ NLP

欢迎使用 iApp 泰语文本摘要 API,这是由艾艾普科技开发的一款人工智能产品。我们的 API 为泰语内容提供强大的文本摘要功能,可以将长文本浓缩成简洁的摘要,同时保留关键信息。

试用演示

入门

先决条件

  • 文本输入(英语或泰语)
  • 最大输出令牌数:8192
  • 来自艾艾普科技的 API 密钥

快速入门

  • 通过并发批量处理实现快速处理
  • 多种摘要风格
  • 双语支持(英/泰)

主要功能

  • AI 驱动的文本摘要
  • 多种摘要风格
  • 双语支持(英语/泰语)
  • 批量处理能力
  • 可自定义的输出长度

摘要风格

风格描述最适合
standard包含引言和结论的正式摘要商业文件、报告
clarify包含对未解决问题的说明技术文档、讨论
friendly简洁易懂的摘要一般内容、博客

API 端点

端点方法描述费用
/v3/store/nlp/thai-text-summary/v1
旧版: /thai-summary, /text-summarization
POST摘要泰语文本(版本 1)1 IC/400 字符
/v3/store/nlp/thai-text-summary-v2
旧版: /v2/text/summarize
POST具有多种风格的泰语文本摘要(版本 2)1 IC/400 字符

API 用法

端点

  • POST /v2/text/summarize - 摘要单个文本
  • POST /v2/text/summarize/batch - 摘要多个文本
  • GET /v2/text/health - 检查 API 状态

参数

单个文本摘要

{
"text": "string", // 必填:要摘要的文本
"style": "standard", // 可选:“standard” | “clarify” | “friendly”
"language": "th", // 可选:“en” | “th”
"max_output_tokens": 8192 // 可选:摘要的最大长度
}

批量摘要

{
"texts": ["string"], // 必填:要摘要的文本数组
"style": "standard", // 可选:“standard” | “clarify” | “friendly”
"language": "th", // 可选:“en” | “th”
"max_output_tokens": 8192 // 可选:摘要的最大长度
}

API 请求示例

使用 cURL:

# 单个文本摘要
curl -X POST "https://api.iapp.co.th/v2/text/summarize" \
-H "Content-Type: application/json" \
-H "apikey: YOUR_API_KEY" \
-d '{
"text": "Your text to summarize",
"style": "standard",
"language": "en",
"max_output_tokens": 500
}'

# 批量摘要
curl -X POST "https://api.iapp.co.th/v2/text/summarize/batch" \
-H "Content-Type: application/json" \
-H "apikey: YOUR_API_KEY" \
-d '{
"texts": ["First text", "Second text"],
"style": "standard",
"language": "en",
"max_output_tokens": 500
}'

使用 Python:

import requests

# 单个文本摘要
response = requests.post(
"https://api.iapp.co.th/v2/text/summarize",
headers={"apikey": "YOUR_API_KEY"},
json={
"text": "Your text to summarize",
"style": "standard",
"language": "en",
"max_output_tokens": 500
}
)

# 批量摘要
response = requests.post(
"https://api.iapp.co.th/v2/text/summarize/batch",
headers={"apikey": "YOUR_API_KEY"},
json={
"texts": ["First text", "Second text"],
"style": "standard",
"language": "en",
"max_output_tokens": 500
}
)

最佳实践

  • 为您的内容类型选择合适的风格
  • 根据您的需求调整 max_output_tokens:
    • 较短的摘要(200-500 令牌):快速概览
    • 中等摘要(500-1000 令牌):详细摘要
    • 较长的摘要(1000+ 令牌):全面覆盖
  • 对于批量处理,请考虑并发请求的数量
  • 对需要额外上下文的技术内容使用 clarify 风格

代码示例

Curl

curl -X POST https://api.iapp.co.th/v3/store/nlp/thai-text-summary/v2 \
-H "apikey: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"text": "Your Thai text here", "style": "general"}'

Python

import requests
import json

url = "https://api.iapp.co.th/v3/store/nlp/thai-text-summary/v2"
headers = {
"apikey": "YOUR_API_KEY",
"Content-Type": "application/json"
}
data = {"text": "Your Thai text here", "style": "general"}

response = requests.post(url, headers=headers, data=json.dumps(data))
print(response.json())

JavaScript

const axios = require("axios");

const config = {
method: "post",
url: "https://api.iapp.co.th/v3/store/nlp/thai-text-summary/v2",
headers: {
apikey: "YOUR_API_KEY",
"Content-Type": "application/json",
},
data: {"text": "Your Thai text here", "style": "general"},
};

axios(config)
.then((response) => console.log(response.data))
.catch((error) => console.log(error));

PHP

<?php
$curl = curl_init();

curl_setopt_array($curl, array(
CURLOPT_URL => 'https://api.iapp.co.th/v3/store/nlp/thai-text-summary/v2',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_POST => true,
CURLOPT_POSTFIELDS => '{"text": "Your Thai text here", "style": "general"}',
CURLOPT_HTTPHEADER => array(
'apikey: YOUR_API_KEY',
'Content-Type: application/json'
),
));

$response = curl_exec($curl);
curl_close($curl);
echo $response;
?>

Swift

import Foundation

let url = URL(string: "https://api.iapp.co.th/v3/store/nlp/thai-text-summary/v2")!
var request = URLRequest(url: url)
request.httpMethod = "POST"
request.addValue("YOUR_API_KEY", forHTTPHeaderField: "apikey")
request.addValue("application/json", forHTTPHeaderField: "Content-Type")

let jsonData = try! JSONSerialization.data(withJSONObject: {"text": "Your Thai text here", "style": "general"})
request.httpBody = jsonData

let task = URLSession.shared.dataTask(with: request) { data, response, error in
if let data = data {
print(String(data: data, encoding: .utf8)!)
}
}
task.resume()

Kotlin

import okhttp3.*
import okhttp3.MediaType.Companion.toMediaTypeOrNull
import okhttp3.RequestBody.Companion.toRequestBody

val client = OkHttpClient()

val json = """
{"text": "Your Thai text here", "style": "general"}
""".trimIndent()

val requestBody = json.toRequestBody("application/json".toMediaTypeOrNull())

val request = Request.Builder()
.url("https://api.iapp.co.th/v3/store/nlp/thai-text-summary/v2")
.addHeader("apikey", "YOUR_API_KEY")
.post(requestBody)
.build()

client.newCall(request).execute().use { response ->
println(response.body?.string())
}

Java

import okhttp3.*;

OkHttpClient client = new OkHttpClient();

String json = "{"text": "Your Thai text here", "style": "general"}";

RequestBody body = RequestBody.create(
MediaType.parse("application/json"),
json
);

Request request = new Request.Builder()
.url("https://api.iapp.co.th/v3/store/nlp/thai-text-summary/v2")
.addHeader("apikey", "YOUR_API_KEY")
.post(body)
.build();

try (Response response = client.newCall(request).execute()) {
System.out.println(response.body().string());
}

Dart

import 'package:http/http.dart' as http;
import 'dart:convert';

var headers = {
'apikey': 'YOUR_API_KEY',
'Content-Type': 'application/json'
};

var data = {"text": "Your Thai text here", "style": "general"};

var response = await http.post(
Uri.parse('https://api.iapp.co.th/v3/store/nlp/thai-text-summary/v2'),
headers: headers,
body: jsonEncode(data)
);

print(response.body);

定价

AI API 服务名称端点每个字符的 IC本地部署
泰语文本摘要器iapp_thai_text_summarization_v11 IC/400 字符联系我们