Add pluggable LLM support with Gemini provider

- Add LLMProvider registry (llm/registry.py) that builds a provider from
  env vars (LLM_PROVIDER, GEMINI_API_KEY, GEMINI_MODEL)
- Add GeminiLLMProvider using the google-genai SDK
- Wire build_llm_provider() into CLI and web pipeline route (replacing llm=None)
- Wrap pass 2 and pass 4 LLM calls in per-combo try/except so API errors
  skip individual combos rather than aborting the whole run
- Add gemini optional dep to pyproject.toml; Dockerfile installs [web,gemini]
- Document env vars in .env.example and README
- Lower requires-python to >=3.10 to match installed system Python

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-02-18 22:04:35 -06:00
parent f1b3c75190
commit 20dae0dce3
10 changed files with 204 additions and 40 deletions

View File

@@ -41,6 +41,55 @@ Putting together lists 1 and 2 we can create 81 mostly novel forms of transporta
Using these metrics this experiment intends to sift vaguely reasonable concepts from nonsense. Its shortlist may include concepts that sound bizarre but may be technically plausible. Bicycles, motorcycles, and e-bikes all had their turn. Why not hydrogen-bikes?
## Setup
### Docker (recommended)
```bash
docker compose up web
```
Then open [http://localhost:5000](http://localhost:5000).
Seed the database with the transport example:
```bash
docker compose run cli seed transport
```
### Local development
```bash
pip install -e ".[dev,web]"
python -m physcom init
python -m physcom seed transport
python -m physcom_web
```
Then open [http://localhost:5000](http://localhost:5000).
Run tests:
```bash
python -m pytest tests/ -q
```
### LLM integration (optional)
By default the pipeline uses stub estimation. To enable Gemini:
```bash
pip install -e ".[gemini]"
export LLM_PROVIDER=gemini
export GEMINI_API_KEY=your_key_here
# export GEMINI_MODEL=gemini-2.0-flash # optional, this is the default
physcom run urban_commuting --passes 1,2,3,4
```
Copy `.env.example` to `.env` and fill in your key for persistent configuration.
---
a few notes: the thin atmosphere and the sun are obvious dependencies to the solar sail power source. Dependencies would include things such as scale of force (nuclear reactor vs pedalling obviously has an important force differential) and geographic requirements (walking requires ground and gravity). The project should include on every entity a list of dependencies. The viability tester will need to pull in all of these dependencies to ensure they do not contradict.
Additionally, metrics are expected to be extremely close to full points or none at all. The speed of a person pushing a car is effectively zero in its domain whereas a rocket powered car would easily reach the limits of speed in the domain. The resulting multiplication between metrics to get the viability score will be heavily logarithmic. This is expected and is intended to be a filter to eliminate technically plausible but completely pointless in practice concepts.