triage/config.py
iomgaa 4d7a7b1ba4 实现main.py批处理系统:支持多线程并行处理医疗问诊工作流
主要功能:
- 完整的argparse参数系统,支持线程数、模型类型、数据范围等配置
- 集成AgentOps追踪功能,支持会话管理和性能监控
- 线程安全的BatchProcessor管理器,支持并发执行和进度统计
- 数据集加载和验证功能,支持范围选择和格式检查
- 多线程执行框架,使用ThreadPoolExecutor管理线程池
- 单样本处理函数,调用MedicalWorkflow并集成追踪
- 实时进度监控,后台线程定期报告处理状态
- 完整的错误处理和异常恢复机制
- 结果汇总和报告生成,支持JSON和文本格式
- 统一配置管理,AgentOps API密钥集成到config.py

技术特性:
- 支持20个并发线程处理1677个医疗病例样本
- 线程安全的进度追踪和状态管理
- 详细的日志记录和调试信息输出
- 试运行模式支持配置验证
- 优雅的中断处理和资源清理

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-11 21:04:11 +08:00

93 lines
2.7 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import os
API_KEY = "sk-263038d4bf4e46a0bed16532587cff40"
# AgentOps API密钥
AGENTOPS_API_KEY = "8c30718a-0485-4adb-a852-05d02e50e3cb"
# {project_root}/medsynthai
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
# LLM model configuration based on agno
LLM_CONFIG = {
"deepseek": {
"class": "DeepSeek",
"params": {
"id": "deepseek-chat",
"api_key": API_KEY,
"base_url": "https://api.deepseek.com"
}
},
"gpt-oss:latest": {
"class": "OpenAILike",
"params": {
"id": "gpt-oss:latest",
"base_url": "http://192.168.31.228:11434/v1", # Ollama OpenAI兼容端点
"api_key": "ollama" # Ollama不需要真实API密钥任意字符串即可
}
},
"deepseek-v3": {
"class": "OpenAILike",
"params": {
"id": "deepseek-v3",
"base_url": "https://dashscope.aliyuncs.com/compatible-mode/v1",
"api_key": API_KEY
}
},
"deepseek-r1": {
"class": "OpenAILike",
"params": {
"id": "deepseek-r1",
"base_url": "https://dashscope.aliyuncs.com/compatible-mode/v1",
"api_key": API_KEY
}
},
"qwen-max": {
"class": "OpenAILike",
"params": {
"id": "qwen-max",
"base_url": "https://dashscope.aliyuncs.com/compatible-mode/v1",
"api_key": API_KEY
}
},
"qwen-vl-max": {
"class": "OpenAILike", # 使用OpenAI兼容类
"params": {
"id": "qwen-vl-max",
"base_url": "https://dashscope.aliyuncs.com/compatible-mode/v1", # OpenAI兼容端点 # 降低随机性,提高结果一致性
"api_key": API_KEY
}
},
"aliyun": {
"class": "OpenAILike",
"params": {
"id": "qwen-max", # 默认使用qwen-max模型
"base_url": "https://dashscope.aliyuncs.com/compatible-mode/v1",
"api_key": API_KEY
}
}
}
AGENT_CONFIG = {
"medical_image_analysis_agent": "qwen-vl-max"
}
RAG_CONFIG = {
"lightrag": {
"working_dir": "./Vector_DB_Med",
"tokenizer_name": "trueto/medbert-base-chinese",
"model_name": "trueto/medbert-base-chinese",
"embedding_dim": 768,
"max_token_size": 512
},
"chroma_db": {
"api_key": API_KEY,
"base_url": "https://dashscope.aliyuncs.com/compatible-mode/v1",
"collection_name": "doctor",
"batch_size": 100,
"chroma_db_path": os.path.join(BASE_DIR, "static/rag/chroma_db"),
"csv_path": os.path.join(BASE_DIR, "static/files/zhongkang_doctor_list.csv")
}
}