Spaces:
Sleeping
Sleeping
Commit History
-
Gemini: switch to gemini-2.0-flash; move key to header; redact errors
Three issues surfaced in the live chat box on the HF Space, all from the same Gemini call: LLM provider 'gemini' is unavailable: Gemini call failed: Client error '404 Not Found' for url 'https://generativelanguage.googleapis.com/v1beta/models/ gemini-1.5-flash:generateContent?key=AQ.Ab8RN6Ic8-CB7kqKS1-... (1) Google retired the gemini-1.5 family in mid-2025; the endpoint now returns 404 with a misleading 'model not found' wording. Switching the DEFAULT_MODELS['gemini'] entry to the current free-tier successor 'gemini-2.0-flash' (1M context, same JSON structured-output behaviour) restores parsing. (2) The provider was passing the key in the URL query string, so httpx's HTTPStatusError quoted the FULL request URL including ?key=... into the exception message --- which surfaced verbatim in the chat box and the build log. The key is now sent via the 'x-goog-api-key' HTTP header instead, so even when the next 4xx fires the URL no longer carrie…0f51210 -
LLM provider abstraction + conversational simulation builder + token leak fix
Implements the directive's LLM integration layer cleanly: five providers, zero hard SDK dependencies, never crashes when no key is configured. Also fixes the immediate security issue: the previous deploy attempt embedded a write-scope HF token directly in the git remote URL (visible to anyone running git remote -v). Security fix The token-embedded remote URL was sanitised: git remote set-url space https://huggingface.co/spaces/JoeTach/cdpr-simulator The leaked token MUST also be revoked manually at https://huggingface.co/settings/tokens . See the runbook in docs/hf-auth-troubleshoot.md for the full rotation procedure. src/cdpr/llm/ --- provider-agnostic LLM layer base.py LLMProvider Protocol + LLMMessage / LLMResponse dataclasses + LLMUnavailableError. config.py LLMConfig.from_env() that reads .env via dotenv (optional dep), with canonical env-var names (GEMINI_API_KEY, OPENROUTER_API_KEY, OLLAMA…1f10b7b