Spaces:
Running
Running
Khanna, Videh Rakesh Rakesh
feat: add Ollama fallback, request context, and cached OHLCV helpers
385ef79 | # ββ AI Backends βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ | |
| # Hugging Face token β two roles: | |
| # 1. Database sync: export_env_secrets.py pushes secrets to V1deh/PaperTrade Space | |
| # 2. LLM Inference API: 3rd fallback AI provider (free serverless, non-Chinese models) | |
| # Get your token at: https://huggingface.co/settings/tokens | |
| HF_TOKEN=hf_your_huggingface_token_here | |
| # Hugging Face Space repo (optional β defaults to V1deh/PaperTrade) | |
| # HF_REPO_ID=V1deh/PaperTrade | |
| # HF Inference API model config (optional β non-Chinese, free serverless tier) | |
| # HF_INFERENCE_MODEL=meta-llama/Llama-3.1-8B-Instruct | |
| # HF_INFERENCE_FALLBACK_MODELS=mistralai/Mistral-7B-Instruct-v0.3,google/gemma-2-9b-it,HuggingFaceH4/zephyr-7b-beta | |
| # ββ AI Backends βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ | |
| # GitHub Personal Access Token (with 'models:read' scope) | |
| # Used as PRIMARY AI backend (GPT-4o via GitHub Models) | |
| # Create one at: https://github.com/settings/tokens β "Generate new token (classic)" | |
| # Required scopes: "models:read" (under the Models section) | |
| GITHUB_TOKEN= | |
| # Anthropic Claude API key (optional β used as fallback if GITHUB_TOKEN fails) | |
| ANTHROPIC_API_KEY= | |
| # ββ OpenRouter (PRIMARY AI provider) ββββββββββββββββββββββββββββββββββββββββββ | |
| # Used for all LLM calls: predictions, news sentiment, backtest | |
| # Get your free key at: https://openrouter.ai/keys | |
| OPENROUTER_API_KEY=Your_OpenRouter_API_Key_Here | |
| # Verified working free models as of 2026-06-29 | |
| OPENROUTER_BEST_FREE_MODEL=openai/gpt-oss-120b:free | |
| OPENROUTER_FREE_MODELS=openai/gpt-oss-120b:free,meta-llama/llama-3.3-70b-instruct:free,nvidia/nemotron-3-ultra-550b-a55b:free,google/gemma-4-31b-it:free | |
| # ββ Groq (optional β fast inference provider) ββββββββββββββββββββββββββββββββββββββββββββββββββββββ | |
| # Alternative AI backend for fast inference | |
| # Get your free key at: https://console.groq.com/keys | |
| GROQ_API_KEY=gsk_your_groq_key_here | |
| # Groq fallback chain | |
| GROQ_FREE_MODELS=llama-3.1-8b-instant | |
| # ββ Ollama (optional β final fallback, local LLM on separate HF Space) βββββββββ | |
| # Reuses existing Ollama space deployed on HF Spaces for reliable LLM fallback | |
| # OLLAMA_ENDPOINT=https://your-ollama-space.hf.space | |
| OLLAMA_ENDPOINT= | |
| # ββ Flask / App βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ | |
| FLASK_ENV=development | |
| FLASK_DEBUG=0 | |
| # ββ NSE Data ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ | |
| # Optional: override default capital (default 1500000 = Rs 15L) | |
| # CAPITAL=1500000 | |
| # ββ WhatsApp Alerts βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ | |
| # Used by whatsapp_alerts.py to push trade signals via WhatsApp gateway | |
| # WHATSAPP_PHONE: your number with country code, no + or spaces (e.g. 919XXXXXXXXX) | |
| # WHATSAPP_APIKEY: API key from your WhatsApp gateway provider | |
| WHATSAPP_PHONE=Your_WhatsApp_number_with_country_code | |
| WHATSAPP_APIKEY=Your_WhatsApp_API_key_here | |