How nyikomnisii/llm_api-wrapper works
AgriLite AI is a farm-management and agronomy-advice product: users manage farm records and activities, view alerts and weather, and ask for structured AI advice. The Expo app uses Supabase for authentication and persistent farm data, and calls a FastAPI backend for chat and weather services. The backend assembles an agronomist workflow around Gemini function calling and Open-Meteo risk data. Several screen and route implementations were not excerpted; those branches reflect README capabilities and the source index, with edges limited to documented or indexed relationships.
Main entry points: router.py FastAPI routes · agronomist_service.py Advice orchestration · gemini_service.py Gemini tool loop · index.tsx Home dashboard
Components 28
Mobile app
- Farm screens
frontend/app/(tabs)/my-farm.tsx - Activity entry
frontend/app/activity/new.tsx - Chat screen
frontend/app/chat/index.tsx - Home dashboard
frontend/app/(tabs)/index.tsx - Location selection
frontend/src/hooks/useResolvedLocation.tsx - Authentication
frontend/src/hooks/useAuth.tsx - Backend API client
frontend/src/api/client.ts - Location geocoding
frontend/src/api/geocoding.ts - Weather display
frontend/src/hooks/useWeather.ts
Farm data
- Farm data hooks
frontend/src/hooks/useFarm.tsx - Supabase data access
frontend/src/api/supabase/farms.ts - Supabase
- Profile and alerts
frontend/src/hooks/useAlerts.ts - Chat history
frontend/src/api/supabase/chat.ts
Agronomy backend
- FastAPI routes
backend/app/api/router.py - Chat endpoint
backend/app/api/routes/chat.py - Advice orchestration
backend/app/services/agronomist_service.py - Gemini tool loop
backend/app/services/gemini_service.py - Tool executor
backend/app/services/tool_executor.py - Gemini client
backend/app/clients/gemini.py - Agronomist prompt
backend/app/prompts/agronomist.py - Health endpoint
backend/app/api/routes/health.py
Weather services
- Weather endpoint
backend/app/api/routes/weather.py - Weather risk service
backend/app/services/weather_service.py - Weather tool
backend/app/tools/weather.py - Open-Meteo client
backend/app/clients/openmeteo.py - Open-Meteo
Other components
- Farmer
Connections 31
- Farmer → Farm screens: manages farm
README.md - Farmer → Activity entry: records activity
README.md - Farmer → Chat screen: asks advice
README.md - Farmer → Home dashboard: views dashboard
frontend/app/(tabs)/index.tsx - Farm screens → Farm data hooks: uses farm data
- Activity entry → Supabase data access: writes activities
frontend/app/activity/new.tsx - Farm data hooks → Supabase data access: loads farms
frontend/src/hooks/useFarm.tsx - Authentication → Supabase: authenticates
frontend/src/hooks/useAuth.tsx - Supabase data access → Supabase: reads and writes
frontend/src/api/supabase/farms.ts - Profile and alerts → Supabase: loads alerts
frontend/src/hooks/useAlerts.ts - Chat history → Supabase: stores conversations
README.md - Home dashboard → Weather display: shows forecast
frontend/app/(tabs)/index.tsx - Home dashboard → Location selection: resolves location
frontend/app/(tabs)/index.tsx - Location selection → Location geocoding: searches places
frontend/src/hooks/useResolvedLocation.tsx - Chat screen → Backend API client: sends chat request
frontend/app/chat/index.tsx - Backend API client → FastAPI routes: calls backend
frontend/src/api/client.ts - FastAPI routes → Chat endpoint: routes requests
backend/app/api/router.py - FastAPI routes → Weather endpoint: routes requests
backend/app/api/router.py - FastAPI routes → Health endpoint: routes requests
backend/app/api/router.py - Chat endpoint → Advice orchestration: requests advice
- Advice orchestration → Gemini tool loop: generates reply
backend/app/services/agronomist_service.py - Advice orchestration → Tool executor: registers weather tool
backend/app/services/agronomist_service.py - Advice orchestration → Weather tool: builds tool spec
backend/app/services/agronomist_service.py - Gemini tool loop → Tool executor: dispatches calls
backend/app/services/gemini_service.py - Gemini tool loop → Gemini client: generates content
backend/app/services/gemini_service.py - Gemini tool loop → Agronomist prompt: uses system prompt
backend/app/main.py - Weather tool → Weather risk service: gets forecast
backend/app/services/agronomist_service.py - Weather endpoint → Weather risk service: serves forecasts
- Weather risk service → Open-Meteo client: geocodes and forecasts
backend/app/services/weather_service.py - Open-Meteo client → Open-Meteo: requests weather data
- Weather display → Backend API client: requests forecast