- Added dex_info_writer.py with a full pipeline for

generating Pokédex-style species descriptions
  - Loads species from portland_wildlife.csv (taxon_id,
  common_name, wikipedia_url)
  - Fetches Wikipedia articles from a self-hosted Kiwix mirror
  (WIKI_LINK env var); falls back to live Wikipedia if unset
  - Spaces in Wikipedia URLs are normalized to underscores
  before fetching
  - LiteLLM instance prompted via OpenAI-compatible client
  (LITELLM_URL, LITELLM_API_KEY, LITELLM_MODEL env vars)
  - LLM has tool-calling access to fetch_wikipedia_article with
   an agentic loop
  - Output descriptions are sanitized — only alphanumerics and
  . , ! ? ' - : allowed
  - Writes results to portland_wildlife_dex_entries.csv in
  append mode with resume support (skips already-processed
  taxon_ids)
  - Live [i/total] progress counter printed each iteration
  along with the generated description
This commit is contained in:
SuppaiNeko committed 2026-03-25 21:02:30 -07:00
1 parent 7a91a9bed4
commit f01728adb7
3 files changed
+638

No files matched your search

@@ -0,0 +1,6 @@
taxon_id,common_name,description
48957,North American Wheel Bug,"The North American wheel bug is a massive, camouflaged assassin bug with a distinctive wheel-shaped crest on its back, reaching up to 1.5 inches in length. This shy predator hunts caterpillars and beetles by injecting dissolving enzymes through its long beak, making it a welcome gardener's ally against pests. Though harmless-looking at first glance, this armored hunter delivers painful bites if disturbed, yet thrives quietly among sunflowers and leafy thickets day and night."
6930,Mallard,"The mallard is a striking dabbling duck recognizable by males' glossy bottle-green heads and white collars, while females wear protective mottled brown plumage with speckles. These adaptable waterfowl thrive in wetlands across continentsfrom Arctic tundra to urban parksand form large social flocks year-round. As the ancestor of most domestic ducks, mallards eat a versatile diet of aquatic plants, insects, and small creatures, making them easy prey for predators while remaining resilient invaders in many ecosystems worldwide."
64968,American Toad,"The American toad features variable skin from yellow to dark brown, marked by distinctive warts that secrete mild toxins for defense. Nocturnal hunters breed in shallow ponds where females lay massive egg ropes before migrating to upland forests and grasslands as adults. Feeding on insects and earthworms, these adaptable creatures burrow underground to hibernate safely during the cold winter months."
28362,Common Garter Snake,"Native to wetlands and forests across North America, the slender common garter snake sports vibrant yellow stripes against black or green scales. These diurnal hunters resist potent toxins while darting through streams to feast on amphibians, worms, and fish. During warm summer mornings, they bask in the sun before gathering for complex mating balls that precede live births."
58523,Black Swallowtail,"The eastern black swallowtail boasts a striking wingspan of up to eight centimeters, featuring bold black wings accented by rows of bright yellow spots and iridescent blue dusting on the hindwings. Native to open fields across North America, these butterflies feed on parsley family plants where their larvae develop chemical defenses, unfurling an orange horn resembling a snake tongue when threatened. During the breeding season, males aggressively defend high-elevation territories to attract mates in a dynamic lekking system."
1 taxon_id common_name description
2 48957 North American Wheel Bug The North American wheel bug is a massive, camouflaged assassin bug with a distinctive wheel-shaped crest on its back, reaching up to 1.5 inches in length. This shy predator hunts caterpillars and beetles by injecting dissolving enzymes through its long beak, making it a welcome gardener's ally against pests. Though harmless-looking at first glance, this armored hunter delivers painful bites if disturbed, yet thrives quietly among sunflowers and leafy thickets day and night.
3 6930 Mallard The mallard is a striking dabbling duck recognizable by males' glossy bottle-green heads and white collars, while females wear protective mottled brown plumage with speckles. These adaptable waterfowl thrive in wetlands across continentsfrom Arctic tundra to urban parksand form large social flocks year-round. As the ancestor of most domestic ducks, mallards eat a versatile diet of aquatic plants, insects, and small creatures, making them easy prey for predators while remaining resilient invaders in many ecosystems worldwide.
4 64968 American Toad The American toad features variable skin from yellow to dark brown, marked by distinctive warts that secrete mild toxins for defense. Nocturnal hunters breed in shallow ponds where females lay massive egg ropes before migrating to upland forests and grasslands as adults. Feeding on insects and earthworms, these adaptable creatures burrow underground to hibernate safely during the cold winter months.
5 28362 Common Garter Snake Native to wetlands and forests across North America, the slender common garter snake sports vibrant yellow stripes against black or green scales. These diurnal hunters resist potent toxins while darting through streams to feast on amphibians, worms, and fish. During warm summer mornings, they bask in the sun before gathering for complex mating balls that precede live births.
6 58523 Black Swallowtail The eastern black swallowtail boasts a striking wingspan of up to eight centimeters, featuring bold black wings accented by rows of bright yellow spots and iridescent blue dusting on the hindwings. Native to open fields across North America, these butterflies feed on parsley family plants where their larvae develop chemical defenses, unfurling an orange horn resembling a snake tongue when threatened. During the breeding season, males aggressively defend high-elevation territories to attract mates in a dynamic lekking system.