A 5–7 minute walkthrough that runs end-to-end on the real generative-AI path. Generative AI is mandatory — there is no mock or fallback mode — so the demo requires an API key.
python3 -m venv .venv && source .venv/bin/activate
pip install -r requirements.txt # or: make install
# A key is required. Default provider is Gemini (free tier —
# get a key at https://aistudio.google.com/apikey):
export GEMINI_API_KEY=... # or: export OPENAI_API_KEY=sk-...Without a key, the run stops immediately with a clear MissingAPIKeyError.
python demo.py # or: make demoYou'll see a header showing the active provider, then both cases run. Each case
prints a provenance banner: [LLM] gemini:gemini-2.5-flash (1 attempt(s), X ms). This is the proof generative AI produced the answer — every result is
model-authored.
Open the generated artifacts:
cat case_1_earnings_tracker/outputs/report.md
cat case_2_macro_engine/outputs/report.md
cat case_1_earnings_tracker/outputs/analysis.jsonDefault provider is Gemini. To pin a model or run the alternative provider:
export GEMINI_MODEL=gemini-2.5-flash # optional
export OPENAI_API_KEY=sk-... # banner: [LLM] openai:gpt-4o-mini …
# or force one explicitly: LLM_PROVIDER=openai python demo.py- Show
[LLM] gemini:…(oropenai:…) in the banner — every run prints it. grep -n "generate_content\|chat.completions" shared/llm/providers.py→ the real API calls.- Show the versioned prompts:
case_*/prompts/system_prompt.txt. - Turn on debug to see the call live:
LLM_LOG_LEVEL=DEBUG python demo.py.
Robustness is built into the client, not a fallback. Point out:
- Retries (default
LLM_MAX_RETRIES=4) that honor a 429's server-suggestedretryDelay. - Regeneration up to 3 times on malformed/invalid JSON.
- Gemini native structured output (
response_schema= the pydantic model), which guarantees schema-valid JSON. If all of these are exhausted the run raises — there is no mock or fallback, so a persistent quota/429 error surfaces honestly (wait and retry, or switch provider withLLM_PROVIDER).
pytest -q # 39 passedCall out: BOTH real paths (Gemini and OpenAI) are unit-tested via an injected
fake SDK client (no network, no key), plus retries, schema validation,
regeneration-then-raise, MissingAPIKeyError when no key, provider precedence,
and both end-to-end flows.
- Problem (30s). Equity Strategy needs earnings-call signal in minutes and fast macro→sector→ticker translation. Both are Tech/AI tasks.
- Solution (30s). Two Python tools; a shared LLM layer does the core reasoning; output is structured JSON + a short analyst report.
- Architecture (1m). Show the Mermaid diagram in
ARCHITECTURE.md: input → versioned prompts →
LLMClient→ (Gemini|OpenAI) → parse+validate (+regenerate on failure) → JSON + report, raising on unrecoverable failure. Stress the separation of concerns. - Generative AI (1m). Run
python demo.pywith a freeGEMINI_API_KEY→[LLM] gemini:…banner. Showproviders.pyand the prompts. Note the same abstraction also supports OpenAI. - Prompt engineering (1m). Open
system_prompt.txt: grounding, verbatim quotes, no hallucination, JSON contract. Tie to schema validation + PROMPT_ENGINEERING.md. - Results (1m). Walk the two reports. Case 1: verbatim red flags, surprise score, guidance change vs. Q4. Case 2: 5+5 sectors with transmission, 3+3 tickers, risks, confidence.
- Quality (30s).
pytest -q→ 39 green. Mention the injected-fake-SDK tests cover both real providers with no network or key. - Limitations (30s, honest). Single-call extraction for long transcripts; live runs depend on API availability/quota (a 429 after retries fails the run — no offline fallback by design); no programmatic quote-grounding verifier yet (see README).
- Close (15s). Two-week roadmap: quote verifier, chunk-map-reduce, self-critique, multi-model + backtest, Streamlit UI.
Case 1 report includes: management tone with verbatim evidence; key takeaways; guidance; guidance changes vs. prior quarter (e.g. "delinquency / credit quality: increased emphasis (prior=6, current=38 mentions)"); top-3 analyst questions; verbatim red-flag quotes; a calibrated surprise score (the committed sample run scored 6/10, with a justification quoting the call).
Case 2 report includes: scenario summary derived from the input; 5 benefited and 5 hurt sectors with transmission rationale; 3 positive + 3 negative B3 tickers; top-3 risks; confidence (e.g. 8/10) with a derived rationale and a net view.
"Generative AI is mandatory here — there is no mock or fallback, so every result you see is model-authored and labelled
[LLM]. Robustness comes from retries, regeneration, and Gemini's native structured output; if those are exhausted the run raises rather than degrade silently. I don't yet programmatically verify that every quote is an exact substring of the source — that's the first item on my two-week roadmap."