This week, I actually made time to code on a little fun project I had on my mind for some time. Early mornings turned out to be quite productive while being on a family vacation and I had tons of fun putting that together.
What is it?
Goffeine is a simple caffeine-tracking tool that runs in your terminal. It allows you to add your caffeine consumption in natural language. Also, you can prompt your estimated caffeine levels, including the expected breakdown of caffeine in your body. It offers you 3 different commands:
help
will show you all available commands with a little descriptionstatus
shows you your caffeine level right now.add {what you consumed when in simple language}
passes your input to Openai to find a reasonable timestamp and amount of caffeine consumed.
The half-life of caffeine is set to 5 hours and caffeine intake that’s more than 24 hours in the past is ignored. This is set according to this paper I picked it because it’s been the very first result of my minimal effort Google search.
What did I learn?
The goal was to have fun typing an idea out using Go and to learn how to integrate an LLM API. This was a success.
This was the first time I have worked directly with the OpenAI-API. It’s been interesting to see how easy it was to use the project go-openai provided by Alex Baranov. I hope I can make myself to create a pull request to update the library to OpenAI’s latest changes.
Honestly, I ignored the topic from a developer’s perspective at the time. I had yet to learn what the system messages or the temperature were. If it’s the same for you, here we go: A system message is a prompt you add right before any user input to give the LLM a directive on how to behave, express expectations about the response, and provide background information. The temperature sets how creative and random the LLM should behave. Values closer to 0.0 are more focused and deterministic, while values closer to 1.0 are more creative but could also lead to hallucination.
Where do we go from here?
Very likely, this is the end of the project. I picked a scope I was confident I could finish from Monday to Friday without affecting my vacation badly. Let’s see if I have the appetite for more in the future.
- Deploy as a webservice
- Allow deletion of entries
- Introduce versioning
- GUI
- Error handling is in desperate need of improvement