128 lines
3.9 KiB
Python
128 lines
3.9 KiB
Python
"""
|
|
配置文件 - API Keys 和模型设置
|
|
"""
|
|
import os
|
|
from dotenv import load_dotenv
|
|
|
|
load_dotenv()
|
|
|
|
# API 配置
|
|
ANTHROPIC_API_KEY = os.getenv("ANTHROPIC_API_KEY", "")
|
|
OPENAI_API_KEY = os.getenv("OPENAI_API_KEY", "")
|
|
AIHUBMIX_API_KEY = os.getenv("AIHUBMIX_API_KEY", "sk-yd8Tik0nFW5emKYcBdFc433b7c8b4dC182848f76819bBe73")
|
|
DEEPSEEK_API_KEY = os.getenv("DEEPSEEK_API_KEY", "")
|
|
SILICONFLOW_API_KEY = os.getenv("SILICONFLOW_API_KEY", "")
|
|
|
|
# LLM Providers Configuration
|
|
LLM_PROVIDERS = {
|
|
"AIHubMix": {
|
|
"base_url": "https://aihubmix.com/v1",
|
|
"api_key_var": "AIHUBMIX_API_KEY",
|
|
"default_model": "gpt-4o"
|
|
},
|
|
"DeepSeek": {
|
|
"base_url": "https://api.deepseek.com",
|
|
"api_key_var": "DEEPSEEK_API_KEY",
|
|
"default_model": "deepseek-chat"
|
|
},
|
|
"SiliconFlow": {
|
|
"base_url": "https://api.siliconflow.cn/v1",
|
|
"api_key_var": "SILICONFLOW_API_KEY",
|
|
"default_model": "deepseek-ai/DeepSeek-V3" # SiliconFlow often uses full path
|
|
},
|
|
"OpenAI": {
|
|
"base_url": "https://api.openai.com/v1",
|
|
"api_key_var": "OPENAI_API_KEY",
|
|
"default_model": "gpt-4o"
|
|
},
|
|
"Custom": {
|
|
"base_url": "http://localhost:8000/v1",
|
|
"api_key_var": "CUSTOM_API_KEY",
|
|
"default_model": "local-model"
|
|
}
|
|
}
|
|
|
|
# AIHubMix 配置 (Legacy, keeping for backward compatibility if needed, but main logic will use LLM_PROVIDERS)
|
|
AIHUBMIX_BASE_URL = "https://aihubmix.com/v1"
|
|
|
|
# 模型配置
|
|
DEFAULT_MODEL = "gpt-4o" # AIHubMix 支持的模型
|
|
LLM_PROVIDER = "aihubmix" # 默认使用 AIHubMix
|
|
|
|
# 支持的模型列表
|
|
AVAILABLE_MODELS = {
|
|
# OpenAI
|
|
"gpt-4o": "GPT-4o (OpenAI)",
|
|
"gpt-4o-mini": "GPT-4o Mini (OpenAI)",
|
|
"gpt-4-turbo": "GPT-4 Turbo (OpenAI)",
|
|
|
|
# Anthropic
|
|
"claude-3-5-sonnet-20241022": "Claude 3.5 Sonnet (Anthropic)",
|
|
"claude-3-opus-20240229": "Claude 3 Opus (Anthropic)",
|
|
"claude-3-haiku-20240307": "Claude 3 Haiku (Anthropic)",
|
|
|
|
# Google
|
|
"gemini-1.5-pro": "Gemini 1.5 Pro (Google)",
|
|
"gemini-1.5-flash": "Gemini 1.5 Flash (Google)",
|
|
"gemini-2.0-flash-exp": "Gemini 2.0 Flash Exp (Google)",
|
|
|
|
# DeepSeek
|
|
"deepseek-chat": "DeepSeek V3 (DeepSeek)",
|
|
"deepseek-reasoner": "DeepSeek R1 (DeepSeek)",
|
|
"deepseek-coder": "DeepSeek Coder (DeepSeek)",
|
|
"deepseek-v2.5": "DeepSeek V2.5 (DeepSeek)",
|
|
"deepseek-coder-v2": "DeepSeek Coder V2 (DeepSeek)",
|
|
|
|
# Meta
|
|
"llama-3.3-70b-instruct": "Llama 3.3 70B (Meta)",
|
|
"llama-3.1-405b-instruct": "Llama 3.1 405B (Meta)",
|
|
|
|
# Alibaba
|
|
"qwen-2.5-72b-instruct": "Qwen 2.5 72B (Alibaba)",
|
|
"qwen-plus": "Qwen Plus (Alibaba)",
|
|
"qwen-turbo": "Qwen Turbo (Alibaba)",
|
|
|
|
# Mistral
|
|
"mistral-large-latest": "Mistral Large (Mistral)",
|
|
|
|
# Perplexity
|
|
"llama-3.1-sonar-huge-128k-online": "Sonar Huge Online (Perplexity)",
|
|
}
|
|
|
|
# 辩论配置
|
|
MAX_DEBATE_ROUNDS = 3 # 最大辩论轮数
|
|
MAX_AGENTS = 6 # 最大参与 Agent 数量
|
|
|
|
# 支持的输出语言
|
|
SUPPORTED_LANGUAGES = ["Chinese", "English", "Japanese", "Spanish", "French", "German"]
|
|
|
|
# 生成配置
|
|
MAX_OUTPUT_TOKENS = 300 # 限制单次回复长度,保持精简
|
|
|
|
# 研究模式模型角色配置
|
|
RESEARCH_MODEL_ROLES = {
|
|
"expert_a": {
|
|
"name": "Expert A (Analyst)",
|
|
"default_model": "gpt-4o",
|
|
"description": "负责初步分析,提出核心观点和方案"
|
|
},
|
|
"expert_b": {
|
|
"name": "Expert B (Critique)",
|
|
"default_model": "gemini-1.5-pro",
|
|
"description": "负责批判性分析,指出潜在问题和漏洞"
|
|
},
|
|
"expert_c": {
|
|
"name": "Expert C (Synthesizer)",
|
|
"default_model": "claude-3-5-sonnet-20241022",
|
|
"description": "负责综合各方观点,生成最终决策方案"
|
|
}
|
|
}
|
|
|
|
# 决策类型
|
|
DECISION_TYPES = {
|
|
"product": "产品方案",
|
|
"business": "商业决策",
|
|
"tech": "技术选型",
|
|
"personal": "个人规划"
|
|
}
|