0.1.1 暂存

This commit is contained in:
陈辅元
2026-04-14 10:28:22 +08:00
parent 4a0638ba2e
commit cc83fe963a
83 changed files with 4005 additions and 179 deletions
+9 -2
View File
@@ -4,6 +4,13 @@ Text2SQL Few-shot 集成示例
展示如何在现有系统中集成经验数据集few-shot功能
"""
import sys
from pathlib import Path
_root = Path(__file__).resolve().parent.parent
if str(_root / "backend") not in sys.path:
sys.path.insert(0, str(_root / "backend"))
from typing import Optional, List
@@ -143,7 +150,7 @@ def integrate_fewshot():
```
生成: data/experiences/all_samples.jsonl
**步骤2:修改 agents/orchestrator.py**
**步骤2:修改 backend/agents/orchestrator.py**
在文件开头添加:
```python
@@ -198,7 +205,7 @@ def integrate_fewshot():
**步骤4:测试效果**
```bash
# 对比测试
python main.py "查询2024年1月的销售额" --verbose
python backend/main.py "查询2024年1月的销售额" --verbose
# 观察日志中的 "Few-shot已选择: Q31, Q6, Q44"
```
+3 -3
View File
@@ -17,9 +17,9 @@ def patch_orchestrator(
data_path: str = "data/experiences/all_samples.jsonl"
):
"""
修改 agents/orchestrator.py 添加few-shot支持
修改 backend/agents/orchestrator.py 添加few-shot支持
"""
orch_path = Path(__file__).parent.parent / "agents" / "orchestrator.py"
orch_path = Path(__file__).parent.parent / "backend" / "agents" / "orchestrator.py"
if not orch_path.exists():
print(f"❌ 文件不存在: {orch_path}")
@@ -224,7 +224,7 @@ def main():
print(f"1. 确保经验数据集已生成:")
print(f" python scripts/parse_examples.py")
print(f"\n2. 测试系统:")
print(f" python main.py \"查询2024年1月的销售额\" --verbose")
print(f" python backend/main.py \"查询2024年1月的销售额\" --verbose")
print(f"\n3. 查看日志中的few-shot选择:")
print(f" Few-shot已选择: Q31, Q6, Q44")
print(f"\n4. 调整参数:")