Files
Profeto/README.md
T
shangfangjian 0a27b18c27 feat: 足球 LLM 预测服务初始提交
Profeto — 给 LLM 提供数据,让 LLM 预测足球比分。

核心模块:
- FastAPI 后端 + PostgreSQL (SQLAlchemy async)
- 多 Agent LLM 预测 (5 专家 + 终裁)
- 数据采集 (bzzoiro / understat / injuries)
- React 前端 (Vite + Tailwind)

包含:
- 数据源抽象 (DataSource 协议 + 注册表)
- Alembic 数据库迁移
- Prompt 模板 (单/多 Agent)
- 核心路径单元测试
2026-09-09 02:10:47 +08:00

89 lines
2.0 KiB
Markdown

# Profeto — 足球 LLM 预测服务
**给 LLM 提供数据,让 LLM 预测足球比分。**
与旧项目 `MatchPro`(自研统计模型预测引擎)完全不同:
- MatchPro: 160 个 Python 文件,7 套 ML 模型,OOF/校准/Promotion Gate,6 容器
- **Profeto**: ~25 个文件,5 张表,LLM 做预测,2 容器(api + postgres)
## 架构
```
前端(单页) → FastAPI → PostgreSQL
LLM (OpenAI-compatible)
bzzoiro / understat
```
## 快速开始
### 1. 环境
```bash
# 后端
pip install -e ".[dev]"
cp .env.example .env
# 编辑 .env: 填 LLM_API_KEY、BZZOIRO_KEY
# 数据库
docker compose up -d postgres
```
### 2. 启动
```bash
# 后端
uvicorn src.api.app:app --reload
# 前端(另一个终端)
cd frontend && npm install && npm run dev
```
### 3. 使用
```bash
# 采集数据
curl -X POST http://localhost:8000/api/v1/ingest/bzzoiro \
-H "Content-Type: application/json" \
-d '{"leagues":["E0","SP1"],"date_from":"2026-08-01","date_to":"2026-09-06"}'
# 查比赛
curl "http://localhost:8000/api/v1/matches?league=E0&status=scheduled"
# LLM 预测
curl -X POST http://localhost:8000/api/v1/predict \
-H "Content-Type: application/json" \
-d '{"match_id": 1}'
# 赛后回填
curl -X POST http://localhost:8000/api/v1/eval/settle \
-H "Content-Type: application/json" \
-d '{"prediction_id": 1, "home_goals": 2, "away_goals": 1}'
# 评估汇总
curl http://localhost:8000/api/v1/eval/summary
```
前端访问 `http://localhost:5173`
## 核心模块
| 文件 | 作用 |
|---|---|
| `src/llm/context_builder.py` | **最重要**: 拼 LLM 看到的上下文 |
| `src/llm/prompts/match_prediction.md` | prompt 模板(迭代最频繁) |
| `src/llm/provider.py` | 多提供商抽象 |
| `src/data/bzzoiro.py` | 数据采集(迁移自旧项目) |
| `src/data/normalize.py` | 数据清洗契约 |
## 测试
```bash
pytest
```
## License
个人研究项目,预测结果不构成投注建议。