Exploring o1-preview Use Cases
Rapid Prototyping and Innovation
In September 2024, OpenAI released o1-preview, a powerful LLM that I’ve leveraged extensively since its launch. Here are a few of my favorite o1-preview use cases in its first 7 weeks.
SQL Assistant
Write a SQL query that provides me all of the chargebacks and refunds this past quarter using our online payments system, where `online_payment_id` is not null, and any invoices in the 90 days leading up to each chargeback or refund.
Group by builder, then job site. Sort by invoice amount descending.
Below are the schemas for the tables you'll need to query:
```schemes go here```
Admittedly, other LLM models like GPT-4 and GPT-4o can produce good enough SQL queries. However, in my experience o1-preview performs better. Two minutes of crafting a prompt saves me 20 minutes of coming up with my own bespoke SQL query.
Although a trivial example, here I’m effectively delegating a mundane task to something competent that got it right on the first try. As someone who is constantly context switching I greatly appreciate not needing to context switch one more time into my DBA hat. Rather, I can maintain my train of thought without getting bogged down within the minutiae of crafting a non-trivial query.
Prototype: Exploring Unfamiliar Capabilities
Help me understand whether this use case is an appropriate fit for a MongoDB Aggregation Pipeline. If we decide to pipe these specific events into MongoDB there may be certain events we want to track and group separately after applying sorting and filtering.
Tell me more about MongoDB's aggregation pipeline and ask me clarifying questions to determine if it's the right tool for the job.
Translate the aggregation pipeline you've provided into C#. Extract the lists of filtered events into a constant. Use <specific nuget package>.
One of my responsibilities as an Architect is to understand which tools are best suited for our needs. While I’m familiar with NoSQL data stores like MongoDB, I’m less familiar with its specific aggregation pipeline capability.
o1-preview was effective in understanding a capability that was new to me, throwing together some prototype commands, iterating, refining, and ultimately translating it into something I can hand off to a developer. Again, o1-preview is helping me contribute without context switching into the minutiae.
phenofuse.io: From Idea to Reality in 1 Week
My daughters and I like to play a fun game with DALL-E 3 via ChatGPT. One kid asks it to create a hybrid animal from two other animals and 20 seconds later an image is generated and the other kid attempts to guess the two original animals. A trivial game for sure, but it’s fun and humorous seeing what ChatGPT provides.
This game is small, but also sufficiently complex, and I decided to challenge myself and build a website entirely coded by OpenAI’s o1-preview model from scratch.
- Milestone 1: Obtain an OpenAI API key and do a basic proof of concept. o1-preview provided the python script to invoke the API. Key Learnings: DALL-E 2 is not great at producing hybrid animals. Further, ChatGPT is in fact crafting a detailed prompt behind the scenes that is then sent to DALL-E 3. I need an additional LLM invocation to do the same.
- Milestone 2: Request o1-preview to modify the python script to initially invoke gpt-4o-mini to craft a DALL-E 3 prompt, then generate the image. Key Learnings: Due to o1-preview’s knowledge cutoff it didn’t know about the existence of 4o-mini. Once corrected I was able to iterate on a 4o-mini prompt that produced useful DALL-E 3 prompts.
gpt-4o-mini output:
A hybrid animal that combines the head of a giraffe and the body of an elephant. The creature has a long, slender neck like a giraffe, topped with a large, rounded head. Its face features the giraffe's big, expressive eyes and long eyelashes, but the ears are large and floppy like an elephant's. The skin is mostly gray and rough, resembling an elephant's, but with patches of soft, spotted fur across the neck and upper body, blending the giraffe's light brown and cream colors.
The torso is robust and powerful, shaped like an elephant's, with a broad, barrel-like chest and a strong back. The front legs are thick and sturdy, ending in wide, padded feet like an elephant’s, perfect for support. The hind legs are thinner and more agile, resembling a giraffe's, giving the creature a unique balance. It stands tall, towering over the ground with a height that merges both animals’ features.
Its tail is long and tufted, similar to a giraffe's, but with a tuft of coarse hair, blending into the textured skin of the body. The creature is in mid-stride, running gracefully across a simple, grassy plain. Its neck stretches forward, showcasing the giraffe's elegance, while its massive legs propel it with power. The lighting is soft and natural, highlighting the textures and colors of the animal's skin and fur.
- Milestone 3: Request o1-preview to throw together a quick Elm application with publicly exposed AWS Lambda Functions to generate the prompt and image. Key Learnings: ChatGPT’s image generation latency is a fraction of going straight to DALL-E 3 (upwards of 60 seconds!). I needed a way of working around API Gateway’s 30 second timeout and a way to keep the user engaged while waiting, such as with a rotating carousel of previously generated images.
- Milestone 4: Use o1-preview to assist with setting up SQS, DynamoDB, Route53, CloudFront, ACM, and a couple more Lambda Functions to asynchronously generate a prompt, generate an image, and poll the image status. Additionally, ask o1-preview to create a carousel in Elm from scratch. Key Learnings: This went great! I found that o1-preview typically gets the code right within the first or second try. Although I was less impressed with o1-mini.
- Milestone 5: “Help me understand best practices for securing my website, https://phenofuse.io. Send me cURL commands where I can paste you the resulting output and you determine whether I'm following security best practices or if I’m vulnerable to common attacks. Lastly, given my tech stack provide me detailed instructions on how to plug any security holes.” Key Learnings: This was an incredibly effective way to improve the security of the website.
My experience with building phenofuse.io was a real AHA moment for me. I spent a few hours every night for only 5 nights rapidly going back and forth with o1-preview to take a website from idea to MVP. It was as if I had a Senior Developer, a Cloud Engineer, and an InfoSec Engineer ready to receive delegated tasks at a moments notice.
I’m impressed with o1-preview and I look forward to the upcoming improvements once o1 is released.