aisms : ai for dumbphones
AISMS is an AI-powered SMS system that brings llms to dumbphones.
For a few months in 2024, I switched to using a dumbphone to escape doomscrolling and to generally unplug. However, I missed quick access to info and also the phone I was using didn’t have navigation capabilities.
AISMS is a simple python application that uses a twilio phone number to receive SMS messages and uses openai + google maps api to generate responses to make dumbphone life a bit easier.
Technical Implementation
-
FastAPI and Uvicorn: The core of the application is built on FastAPI, a modern, fast web framework for building APIs with Python. Uvicorn serves as the ASGI server, providing high-performance handling of requests.
-
Twilio: This library is used to interface with the Twilio API, enabling the sending and receiving of SMS messages programmatically.
-
LangChain: LangChain is employed for natural language processing tasks, likely used in conjunction with OpenAI’s language models (via
langchain-openai
) to generate contextually relevant responses to incoming messages. -
SQLModel and Tortoise ORM: These libraries are used for database operations, with SQLModel providing a SQL database interface and Tortoise ORM handling asynchronous ORM (Object-Relational Mapping) operations. This allows for efficient storage and retrieval of message data and user information.
-
Google Maps: The inclusion of the
googlemaps
library suggests that the system may incorporate location-based services or geocoding capabilities in its responses.
The project structure follows best practices for Python development:
- It uses Poetry for dependency management and packaging.
- Ruff and MyPy are employed for linting and type checking, ensuring code quality and consistency.
- The application is configured to run asynchronously, as evidenced by the use of FastAPI, Uvicorn, and asynchronous database drivers.
The system works in five steps:
- Twilio webhook receives SMS messages through FastAPI
- LangChain and OpenAI process the message content
- Tortoise ORM handles database operations
- Google Maps API provides location data when needed
- Response is sent back via Twilio SMS