Files
gavindiazandClaude Code 7e50a0fef6 feat(llm): provider-agnostic OpenAI-compatible client; FinBERT warm-up off the event loop
Replace the Google Gemini lock-in with a unified chat client usable with any
OpenAI-compatible /v1 endpoint (OpenAI, OpenRouter, DeepSeek, Moonshot, Qwen,
Ollama, Gemini-via-compat...). Switch provider purely via AI_BASE_URL/AI_MODEL.

- ai/llm_client.py (new): lazy openai SDK, per-candidate 429/503/timeout
  failover across AI_MODEL_FAILOVER, robust JSON extraction, reasoning-budget
  retry, image analysis via base64 data URI, singleton get_llm_client()
- settings.py: GeminiSettings -> LLMSettings (api_key/base_url/model/failover/
  vision_model), keeps GEMINI_API_KEY fallback so existing .env keeps working
- news_analyzer.py: analyze_with_gemini -> analyze_with_llm (same output keys);
  FinBERT now loads in a daemon warm-up thread with lexicon fallback - the
  transformers first import was blocking the asyncio main loop 15-45s
  (importlib.metadata full package scan); HF_ENDPOINT hf-mirror setdefault
- telegram_bot.py: news digest + AI-vision chart analysis via the LLM client
- requirements: google-genai -> openai>=1.0; docs/.env.example/README updated
  for the new provider-agnostic setup; dashboard meta updated

Co-Authored-By: Claude Code <noreply@anthropic.com>
2026-10-21 20:56:52 +08:00

59 lines
782 B
Plaintext

# Dependencies
# ============================================
# Core
python-dotenv>=1.0
pydantic>=2.0
pydantic-settings>=2.0
PyYAML>=6.0
# MetaTrader 5
MetaTrader5>=5.0
# Data & Analysis
pandas>=2.0
numpy>=1.24
pandas-ta>=0.3.14b1
# AI / ML
scikit-learn>=1.3
xgboost>=2.0
joblib>=1.3
# NLP / Sentiment
transformers>=4.30
torch>=2.0
# Unified LLM chat (any OpenAI-compatible provider: OpenAI, OpenRouter, DeepSeek, Moonshot, Qwen, Ollama...)
openai>=1.0
# News APIs
httpx>=0.24
# Web Dashboard
fastapi>=0.100
uvicorn[standard]>=0.20
websockets>=12.0
# Telegram
python-telegram-bot>=21.0
# Database
SQLAlchemy>=2.0
aiosqlite>=0.19
# Scheduling
APScheduler>=3.10
# Logging
loguru>=0.7
# HTTP
aiohttp>=3.9
# Testing
pytest>=8.0
pytest-asyncio>=0.21
# Utilities
rich>=13.0