Inspiration
I was inspired by the late 90's toy, Tomagotchi. It was a virtual pet that you had to take care of. I wanted to have something that was fun to see over time, rather than in the moment.
What it does
The app allows you have a virtual plant that you care for. As you water it and give it sunlight it will thrive. Fail to give it proper care and your plant will begin wither away.
How I built it
The frontend is a simple SPA app in React. I used the Amplify libraries for authentication (backed by Cognito).
The backend is several different Lambda functions.
- An express server. This function handles all the requests from the frontend. It sits behind an API Gateway that has Cognito authorization. I chose a single function because it simplifies the DevEx and also can reduce cold starts.
- A DynamoDB stream handler. This function will send the user a notification if their plant's health is starting to fail. The stream handler receives the old and new version of the plant, allowing the code to compare the two to determine the action to take.
- A scheduled Step Function scans the list of plants and calls a Lambda function for each plant. This function looks at the amount of watering and sunlight the plant has received and updates the plant's health. It uses Bedrock to rate the relative health (-10 through 10) and gives a description of the plants health.
Challenges I ran into
I tried to use an LLM to update the plant's appearance as its health changed. This proved to be exceptionally challenging and ultimately failed. It was difficult to get the LLM to make the plant look like it was the same plant while just updating the health of the plant. I attempted various models and prompts but was unable to find anything that worked well enough to use.
I also ran into some real challenges getting any of the LLMs to build a state maching using JSONata. I was eventually able to get close enough to allow me to manually finish it, but I could have started from scratch and gotten there a lot sooner.
Accomplishments that I'm proud of
I was able to get the LLM to give me health updates after some effort. It still can struggle with number ranges at times, but removing the need for the LLM to figure out some of the data really helped.
What I learned
LLMs are great until they aren't. I suppose this isn't really new learnings as much as reinforcement. This applies both to using them in the process of coding as well as using them in your code. Effective prompts help a lot, and the more valuable context you can provide the better, but at some level there are limits to what you can expect.
What's next for Plantagotchi
Ideally I'd be able to allow users to specify the plant and have the LLM create it, including providing the care information. In order for that to really work I'll have to figure out how to get the image to update the health of the plant without changing everything.
Built With
- amazon-dynamodb
- amazon-ses
- cdk
- node.js
- step-functions
- typescript
Log in or sign up for Devpost to join the conversation.