Skip to content

Surface wikidata misses + default to gemini-flash-lite#19

Merged
fleveque merged 1 commit into
mainfrom
fix/wikidata-visibility-and-quota
May 16, 2026
Merged

Surface wikidata misses + default to gemini-flash-lite#19
fleveque merged 1 commit into
mainfrom
fix/wikidata-visibility-and-quota

Conversation

@fleveque

Copy link
Copy Markdown
Owner

Why

After #18 deployed, prod traces still show non-US tickers (REP.MC, DGE.L) jumping straight from "cache miss" → "LLM provider miss". No log line between them — Wikidata's failure path was at Debug level so we can't see whether it's being skipped (missing `company_name`?), failing to find a Q-entity, missing P154, or 404-ing on the Commons download.

Separately, the Gemini free tier exhausted today (20 req/day per project on flash-2.5, shared with dividend-portfolio):

```
"gemini API returned 429: ... Quota exceeded for metric:
generativelanguage.googleapis.com/generate_content_free_tier_requests,
limit: 20, model: gemini-2.5-flash"
```

Changes

  • Bump wikidata "provider miss" log from Debug to Info, with `company_name` field. One line moves the diagnostic out of debug-only territory.
  • Default `llm.gemini.model` from `gemini-2.5-flash` (20 req/day free) to `gemini-2.5-flash-lite` (1000 req/day free). Wikidata should cover the named-company case anyway, so flash-lite is plenty for long-tail fallback.

Verification

After deploy, the next REP.MC / DGE.L request should produce a log line like:

```
"wikidata provider miss" symbol=DGE.L company_name="Diageo plc" error="..."
```

That tells us exactly which step of the wikidata pipeline is failing in production, and we can act from there.

🤖 Generated with Claude Code

Two changes to debug + sustain non-US logo discovery.

## Observability
Wikidata's "provider miss" was at Debug, hidden in production's
info-level logs. After yesterday's deploy of the wikidata layer, prod
traces still showed the chain jumping straight from "cache miss" to
"LLM provider miss" with no signal whether wikidata was being skipped
(no company_name?), failing to find a Q-entity, missing a P154 claim,
or 404-ing on the Commons download. Bumping the miss log to Info with
the company_name field included makes the cause visible per request.

## Free-tier quota
The Gemini free tier is 20 req/day per project on flash-2.5; we
exhausted it on the first day of cache misses (shared quota with
dividend-portfolio). Switch the default to gemini-2.5-flash-lite which
has a 1000-req/day free quota. Wikidata is supposed to cover most
named companies anyway, so the LLM layer is mostly long-tail fallback
now — flash-lite is plenty.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@fleveque fleveque merged commit 6211d3a into main May 16, 2026
2 checks passed
@fleveque fleveque deleted the fix/wikidata-visibility-and-quota branch May 16, 2026 21:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant