2 min read
I recently had the opportunity to explore the capabilities of OpenAI, and was blown away by what I could achieve with it. There is a realy great starter app in the openai cookbook, file q & a. So I decided to start there and use that as a base for a project.
As a fan of stoicism and the Book of Meditations, I thought it would be a cool idea to see if I could create a chatbot that interacted with the writings of Marcus Aurelius, one of the most influential philosophers of the ancient world.
When a user inputs a question, the system creates an embedding for the question and performs a similarity search to find the file chunks that are most closely related to the question. The system then makes an API call to the completions endpoint, using the question and the most relevant file chunks as the prompt. The generative model then generates an answer to the question, using information found in the file chunks.
Tweaking the prompt to make it more personal and engaging was a fun challenge, and I'm sure there's still room for improvement. But with ChatGPT's natural language capabilities and the wealth of knowledge contained in Marcus Aurelius' writings, "Ask Marcus" is a powerful tool for anyone interested in stoic philosophy.
DALL·E 2 Marcus
To give the site some more character I also used DALL·E 2 to generate a sketch of Marcus Aurelius. The power of this technology is quite mindblowing...
This was a fun little side project that allowed me to play around with the OpenAI API. We've got a ton of exciting real life projects at work underway and I hope to share more about that soon.
Check out the source code on github