CoolFace
Apppublic

jfrometa88/refugeeconnect-ai-api

sourceHugging Facemitupdated 5mo agoView on Hugging Face
0likes
App README

RefugeeConnect AI β€” Backend API 🧠

The intelligence layer of RefugeeConnect AI β€” a multi-agent system helping migrants and asylum seekers navigate the support system in Spain.

This Space is the AI backend of RefugeeConnect AI. It processes natural language requests in Spanish, English, Arabic, and French, and returns personalized, step-by-step guidance toward the right resources β€” legal aid, healthcare, housing, food, and employment.

The visual interface lives here: jfrometa88/refugeeconnect-ai-dashboard


πŸ€– Agent Architecture

The backend is built with Google's Agent Development Kit (ADK) around a single Orchestrator Agent operating on a 5-state decision tree:

1: Greet & detect language
2: Understand user's legal profile (PadrΓ³n, Tarjeta Roja, etc.)
3: Clarify if the query is incomplete
4: Call the appropriate tool (search_db, legal_rights, geolocate)
5: Respond and stop

Key design decisions:

  • β€”Tools β€” not the model β€” hold all legal information: static, human-verified, zero hallucination risk
  • β€”Explicit stop markers prevent verbosity and loop behavior in smaller models
  • β€”All system logic is written in English; all user-facing content is delivered in the user's detected language

πŸ“‘ Endpoints

EndpointDescription
GET /healthSystem status and model availability
POST /queryMain conversational endpoint β€” accepts user message and session context
GET /logsLast n (default 50) lines of system logs
GET /docsInteractive Swagger documentation

πŸ—οΈ Technology Stack

LayerTechnology
Agent FrameworkGoogle ADK (Agent Development Kit)
Routing & DistancesOSRM (Open Source Routing Machine) via router.project-osrm.org
ModelGemma 4 (31B) via Google AI Studio
API FrameworkFastAPI (async)
DatabaseSQLite β€” initialized from CSV sources at container startup
Dependency Manageruv
ContainerDocker on Python 3.13-slim

βš™οΈ Environment Variables

VariableDescriptionDefault
GOOGLE_API_KEYGoogle AI Studio API keyβ€” (required Secret)
USE_LOCAL_LLMSwitch to local Ollama inferencefalse
GEMMA_MODEL_NAME_cloudCloud model identifiergemma-4-31b-it
OLLAMA_HOSTOllama server URL (local mode only)http://localhost:11434
GEMMA_MODEL_NAME_localLocal model identifier (local mode only)gemma-4
GOOGLE_API_KEY must be set. USE_LOCAL_LLM=true is designed for NGO on-premise deployments via Ollama, not for this hosted Space.

πŸ”’ Privacy Design

For organizations handling sensitive personal data, the full system supports a local-first inference mode using Gemma 4 via Ollama (E2B/E4B models). In that configuration, no user data leaves the organization's own infrastructure.

This hosted Space runs in cloud mode for demonstration purposes. The local mode is documented and functional for on-premise deployment.


πŸ“Œ Current Scope

The database currently covers a representative sample of NGO resources in Valencia, Spain. The architecture scales horizontally β€” expanding to any city requires only populating the database with new records.


πŸ”— Project Links


πŸ‘€ Author

Jorge Israel Frometa Moya β€” Cuban Engineer & Political Asylum Seeker in Spain.

This project was born from personal experience navigating a fragmented support system. Built with limited resources, submitted with the hope it reaches those who can take it further.


Submitted to the Gemma 4 Good Hackathon β€” Impact Track: Digital Equity & Inclusivity Β· Special Track: Ollama