Docs/Research Data

Research Data

Tài liệu cho đội kỹ thuật khi cần lấy dữ liệu có cấu trúc qua API.

Endpoint

  • Method: POST
  • Path: /api/v1/rag/query/data

Request payload

Có thể điều chỉnh top_k, kg_top_k, chunk_top_k, token limits và cờ include references/chunk content.

Response shape

Tập trung đọc theo thứ tự:

  1. chunks
  2. references
  3. metadata

Integration checklist

  • Handle timeout và retry.
  • Hiển thị references để người dùng đối chiếu nguồn.

cURL Example

curl "http://localhost:8000/api/v1/rag/query/data" \
  -H "Content-Type: application/json" \
  --data-raw '{
    "query": "Tong loi nhuan ke toan truoc thue cua HPG nam 2025",
    "mode": "hybrid",
    "top_k": 20,
    "kg_top_k": 40,
    "chunk_top_k": 20,
    "include_references": true,
    "include_chunk_content": true
  }'

Request Payload

{
  "query": "Tong loi nhuan ke toan truoc thue cua HPG nam 2025",
  "mode": "hybrid",
  "top_k": 20,
  "kg_top_k": 40,
  "chunk_top_k": 20,
  "max_entity_tokens": 3000,
  "max_relation_tokens": 3000,
  "max_total_tokens": 10000,
  "enable_rerank": false,
  "include_references": true,
  "include_chunk_content": true
}

Response Shape

{
  "status": "success",
  "message": "Query processed successfully",
  "data": {
    "chunks": [
      {
        "reference_id": "1",
        "chunk_id": "chunk-13d0322c564731d2",
        "file_path": "uploads/ocr/.../HPG_Baocaotaichinh_2025_Kiemtoan_Congtyme.pdf",
        "content": "# THUYET MINH BAO CAO TAI CHINH..."
      }
    ],
    "references": [
      {
        "reference_id": "1",
        "file_path": "uploads/ocr/.../HPG_Baocaotaichinh_2025_Kiemtoan_Congtyme.pdf"
      }
    ]
  }
}

Mục trước

OCR-RAG

Mục tiếp theo

Tính năng chính