Skip to content

Latest commit

 

History

9 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Pare

An LLM assistant reachable over plain SMS, built for areas of the Philippines with slow, intermittent, or no internet access. Text a question, get an answer back as a text — no app, no data connection required.

How it works

A text arrives through Semaphore (a Philippine SMS gateway) and hits a webhook Lambda on AWS. The Lambda embeds the question, scores it against a DynamoDB table of embedded content (weather, PAGASA cyclone advisories, news, and a curated document corpus), and passes the best-matching chunks to Amazon Nova Lite via Bedrock's converse API. For general questions outside that corpus, the model answers from its own knowledge; for time-sensitive topics (news, prices, weather, schedules, current officials, sports), it's restricted to what retrieval actually found, so a stale answer never gets presented as current. The reply is trimmed to fit a single SMS segment and sent back through Semaphore.

A second, scheduled Lambda keeps the time-sensitive content fresh by re-fetching weather, PAGASA advisories, and news feeds on an hourly cadence and re-embedding them into the same table.

Pare architecture diagram

Full architecture, request flow, and design rationale: docs/system-design.md. Product goals, constraints, and cost tradeoffs: docs/context.md.

Stack

  • Python, deployed as two AWS Lambda functions with zero third-party dependencies (everything AWS goes through boto3)
  • Amazon Bedrock: Nova Lite for generation, Cohere Embed Multilingual for embeddings
  • DynamoDB for the vector store (brute-force cosine similarity, no ANN index — the corpus is a few hundred chunks) and for per-number rate limiting
  • Semaphore for inbound/outbound SMS

Every component is pay-per-request; there's no always-on infrastructure. See Cost posture in docs/context.md for why that mattered enough to shape the architecture.

Repository layout

  • src/handler.py — the webhook Lambda: parses the inbound SMS, rate-limits the sender, retrieves and generates an answer, sends the reply.
  • src/ingest.py — the scheduled Lambda that keeps weather, PAGASA, and news content current in the vector store.
  • scripts/ingest_corpus.py — local-only tool for embedding a curated document corpus; not deployed.
  • template.yaml — AWS SAM template describing the architecture. Reference only; the actual deployment is done by hand in the AWS Console (see docs/deployment.md).
  • tests/ — pytest suite; Bedrock and DynamoDB are faked, no AWS access needed to run it.
  • docs/ — product context, system design, and the deployment runbook.

Development

Requires a Python virtual environment at .venv.

.venv\Scripts\python -m pip install -r requirements-dev.txt
.venv\Scripts\python -m pytest tests

Deployment is manual, console-only — no CLI or CloudFormation apply. Steps are in docs/deployment.md.

About

LLM assistant accessible over SMS for low-connectivity areas. Text a question, get an answer back, no app or internet required.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages