Ingredient Substitution with OpenAI
I cook a lot, and especially on weekend mornings I’ll make a big breakfast for the family. Oftentimes, I’ll make pancakes. I’m vegan, so the typical pancake recipe that likely includes eggs and milk doesn’t work for me. There are some good vegan recipes out there, but sometimes I just want to cook using the recipe that I found whether it includes vegan ingredients or not.
This seems like a pretty common issue for folks that are gluten-free, keto, kosher, lactose intolerant, etc, and I realized that OpenAI and ChatGPT might be able to help.
It did, and impressively!
All I had to do was supply it a list of ingredients (in a future of this you could probably just paste a link and have the program read the list of ingredients) and ask it to substitute ingredients where needed, and then also give me an explanation for that ingredient.
Not only did this work well — there were some good substitutions, though sometimes it just said to use “vegan egg” or “vegan cheese”, often times it would suggest tofu or seitan for a meat substitution or flax seed for an egg substitution. I also tried it with other dietary restrictions and it did quite well — you can view in the video above.
Maybe most impressive to me was that I also asked it to name the recipe based on the ingredients, and it always knew what the recipe was, even though I hadn’t told it. So it knew that I wanted ingredients for bi bim bap or matzoh ball soup.
There are so many different use cases with this technology, this is one I’d potentially use on a day-to-day basis!
The code for this tool lives here: https://github.com/samedelstein/ingredient_substitute_gpt.