Skip to main content

📝❔ Thai Auto Question Answering (ThaiQA)

📝❔ ระบบตอบคำถามอัตโนมัติภาษาไทย (ThaiQA)

Version Status

Welcome to iApp Thai Question Answering API, an AI product developed by iApp Technology Co., Ltd. Our API provides powerful capabilities for extracting answers from Thai text based on questions, utilizing advanced Natural Language Processing (NLP) techniques to understand context and provide relevant answers.

Try Demo

Visit our API Portal to test the Thai Auto Question Answering API with your own text.

Getting Started

  1. Prerequisites

    • An API key from iApp Technology
    • Thai text input and question
    • Internet connection
  2. Quick Start

    • Fast answer extraction
    • High accuracy responses
    • Simple REST API interface
  3. Key Features

    • Question-based answer extraction
    • Context understanding
    • Fast response time
    • Easy integration
  4. Security & Compliance

    • GDPR and PDPA compliant
    • No data retention after processing
How to get API Key?

Please visit API Portal to view your existing API key or request a new one.

Example

Question Answering Request

curl --location --request POST 'https://api.iapp.co.th/thai-qa' \
--header 'Content-Type: application/json' \
--header 'apikey: {Your API KEY}' \
--data-raw '{
"question": "แค็วม์เป็นแค่หมู่บ้านใช่หรือไม่",
"document": "จังหวัดแค็วม์โปแลนด์ wojewdztwochemskie คือหน่วยการปกครองท้องถิ่นของประเทศโปแลนด์ในช่วงปี ค.ศ.1975 - ค.ศ.1998 จังหวัดได้รับการรวมเข้ากับจังหวัดลูบลินมีเมืองหลักคือแค็วม์ใน ปี ค.ศ.1998 มีพื้นที่ประมาณ 3865 ตารางกิโลเมตรและมีประชากร 248800 คน"
}'

Question Answering Response

{
"answer": "ไม่ใช่"
}

Features & Capabilities

Core Features

  • Extracts accurate answers from Thai-language knowledge texts and questions.
  • Leverages advanced Natural Language Processing (NLP) techniques to understand context and provide relevant answers.
  • Supports a variety of knowledge sources, including textbooks, articles, and websites.

Supported Fields

  • Input: Thai knowledge text and corresponding question.
  • Output: Most relevant answer extracted from the provided knowledge text.
  • Confidence score for the extracted answer.

Additional Capabilities

  • Easy integration into existing applications through RESTful API.
  • Designed for real-time and batch processing.
  • Ideal for educational platforms, customer support systems, and knowledge-based applications.

API Reference

Endpoint

POST https://api.iapp.co.th/thai-qa

NameTypeDescription
apikeyStringGenerated API Key

Request Body

NameTypeDescription
questionStringQuestion you want to know
documentStringA paragraph of information

Code Examples

Python

import requests
import json

url = "https://api.iapp.co.th/thai-qa/v3/inference"

payload = json.dumps({
"question": "{YOUR QUESTION}",
"document": "{YOUR PARAGRAPH/ YOUR ARTICLE}"
})
headers = {
'apikey': '{YOUR API KEY}',
'Content-Type': 'application/json'
}

response = requests.request("POST", url, headers=headers, data=payload)

print(response.text)


JavaScript

const axios = require('axios');
let data = JSON.stringify({
"question": "{YOUR QUESTION}",
"document": "{YOUR PARAGRAPH/ YOUR ARTICLE}"
});

let config = {
method: 'post',
maxBodyLength: Infinity,
url: 'https://api.iapp.co.th/thai-qa/v3/inference',
headers: {
'apikey': '{YOUR API KEY}',
'Content-Type': 'application/json'
},
data : data
};

axios.request(config)
.then((response) => {
console.log(JSON.stringify(response.data));
})
.catch((error) => {
console.log(error);
});

PHP

<?php

$curl = curl_init();

curl_setopt_array($curl, array(
CURLOPT_URL => 'https://api.iapp.co.th/thai-qa/v3/inference',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS =>'{
"question": "{YOUR QUESTION}",
"document": "{YOUR PARAGRAPH/ YOUR ARTICLE}"
}',
CURLOPT_HTTPHEADER => array(
'apikey: {YOUR API KEY}',
'Content-Type: application/json'
),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;

Swift

let parameters = "{\n    \"question\": \"{YOUR QUESTION}\",  \n    \"document\": \"{YOUR PARAGRAPH/ YOUR ARTICLE}\"\n}"
let postData = parameters.data(using: .utf8)

var request = URLRequest(url: URL(string: "https://api.iapp.co.th/thai-qa/v3/inference")!,timeoutInterval: Double.infinity)
request.addValue("{YOUR API KEY}", forHTTPHeaderField: "apikey")
request.addValue("application/json", forHTTPHeaderField: "Content-Type")

request.httpMethod = "POST"
request.httpBody = postData

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

task.resume()

Kotlin

val client = OkHttpClient()
val mediaType = "application/json".toMediaType()
val body = "{\n \"question\": \"{YOUR QUESTION}\", \n \"document\": \"{YOUR PARAGRAPH/ YOUR ARTICLE}\"\n}".toRequestBody(mediaType)
val request = Request.Builder()
.url("https://api.iapp.co.th/thai-qa/v3/inference")
.post(body)
.addHeader("apikey", "{YOUR API KEY}")
.addHeader("Content-Type", "application/json")
.build()
val response = client.newCall(request).execute()

Java

OkHttpClient client = new OkHttpClient().newBuilder()
.build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"question\": \"{YOUR QUESTION}\", \n \"document\": \"{YOUR PARAGRAPH/ YOUR ARTICLE}\"\n}");
Request request = new Request.Builder()
.url("https://api.iapp.co.th/thai-qa/v3/inference")
.method("POST", body)
.addHeader("apikey", "{YOUR API KEY}")
.addHeader("Content-Type", "application/json")
.build();
Response response = client.newCall(request).execute();

Dart

var headers = {
'apikey': '{YOUR API KEY}',
'Content-Type': 'application/json'
};
var request = http.Request('POST', Uri.parse('https://api.iapp.co.th/thai-qa/v3/inference'));
request.body = json.encode({
"question": "{YOUR QUESTION}",
"document": "{YOUR PARAGRAPH/ YOUR ARTICLE}"
});
request.headers.addAll(headers);

http.StreamedResponse response = await request.send();

if (response.statusCode == 200) {
print(await response.stream.bytesToString());
}
else {
print(response.reasonPhrase);
}

Pricing

AI API Service NameEndpointIC Per CharactersOn-Premise
Thai Automatic Question Answering (QA)iapp_thai_automatic_qa_v11 IC/400 CharactersContact