Bỏ qua điều hướng - vào nội dung chính

SDK & CLI

Mã nguồn wrapper REST + GraphQL + MCP. Node, Python và CLI. Lưu tại sdk/ trong repo, CHƯA publish npm/PyPI.

📗vietlex-sdk· Node.js / TypeScript

Cài đặt

npm install vietlex-sdk

Node.js / TypeScript example

import { VietLex } from 'vietlex-sdk';

const vl = new VietLex();

// Search VBPL
const r = await vl.searchVbpl('luật đấu thầu', { limit: 5, loai: 'Luật' });
console.log(r.total, r.hits);

// GraphQL
const { data } = await vl.graphql(`{
  searchVbpl(query:"đất đai", limit:5){
    total hits { title url }
  }
}`);

// MCP tool call
const tools = await vl.mcp('search_an_le', { query: 'thừa kế' });

📦 Source: sdk/node/ trong repo VietLex (local)

Chưa publish npm — cần account.

🐍vietlex (Python)· Python 3.7+

Cài đặt

pip install vietlex

Python example

from vietlex import VietLex

vl = VietLex()

# Search VBPL
r = vl.search_vbpl('luật đấu thầu', limit=5, loai='Luật')
for h in r['hits']:
    print(h['title'], h['url'])

# GraphQL
data = vl.graphql('{ searchVbpl(query:"thuế", limit:3){ total hits { title url } } }')

# MCP
ale = vl.mcp('search_an_le', {'query': 'thừa kế'})

📦 Source: sdk/python/ trong repo VietLex (local)

Chưa publish PyPI — cần account.

⌨️vietlex-cli· Terminal CLI

Cài đặt

npm install -g vietlex-cli

Terminal commands

# Search VBPL từ terminal
vietlex search "luật đấu thầu" --limit=5 --loai=Luật

# Get full VBPL
vietlex get doc_xxx

# Search án lệ
vietlex anle "tranh chấp đất đai"

# Search gói thầu
vietlex dauthau "y tế" --provCode=01

# Output JSON
vietlex search "thuế" --format=json | jq '.hits[0]'

# Call MCP tool trực tiếp
vietlex mcp search_vbpl '{"query":"thuế","limit":3}'

📦 Source: sdk/cli/ trong repo VietLex (local)

Chưa publish npm.

⚙️ API endpoints SDK gọi vào

Mã nguồn SDK (Node + Python + CLI) sẽ publish lên npm + PyPI public sớm. Theo dõi cập nhật tại trang chủ.