# @goodgo/ai-services Microservice AI/ML viết bằng Python FastAPI cho GoodGo Platform. ## Các dịch vụ | Dịch vụ | Router | Mô tả | |---------|--------|-------------| | **AVM** | `/avm` | Mô hình định giá tự động — dự đoán giá bất động sản dựa trên XGBoost | | **Moderation** | `/moderation` | Kiểm duyệt nội dung tin đăng (phân tích văn bản + hình ảnh) | | **NLP** | `/nlp` | NLP tiếng Việt — trích xuất đặc trưng, hiểu truy vấn tìm kiếm | ## Tech Stack - **Python** 3.12+ - **FastAPI** 0.115 + Uvicorn - **XGBoost** 2.1 (mô hình định giá bất động sản) - **Underthesea** 6.8 (tokenizer NLP tiếng Việt) - **Pydantic** 2.9 (schema request/response) ## Quick Start ```bash # Via Docker (recommended — runs as part of the platform stack) docker compose up -d ai-services # Standalone cd libs/ai-services pip install -e ".[dev]" uvicorn app.main:app --reload --port 8000 ``` ## Cấu trúc dự án ``` libs/ai-services/ ├── app/ │ ├── main.py # FastAPI app entry point │ ├── config.py # Settings (Pydantic BaseSettings) │ ├── middleware.py # CORS, rate limiting, error handling │ ├── models/ # Pydantic request/response schemas │ │ ├── avm.py │ │ ├── moderation.py │ │ └── nlp.py │ ├── routers/ # API route handlers │ │ ├── avm.py │ │ ├── moderation.py │ │ └── nlp.py │ └── services/ # Business logic │ ├── avm_service.py │ ├── moderation_service.py │ └── nlp_service.py ├── tests/ # pytest test suite ├── Dockerfile # Production container image └── pyproject.toml # Dependencies and config ``` ## Test ```bash cd libs/ai-services pytest ``` ## Health Check ``` GET /health → {"status": "ok"} ```