Discovering Wolfram Food through AI

Isabel Skidmore from WolframAlpha walks through a food database of nearly 500,000 items with data on over 150 nutrients each. She shows how ChatGPT and Wolfram's own chat notebooks can query this data to generate nutrition reports, pie charts, and recipe graphs on the fly.
Questions this video answers
Close to 500,000 individual food data points.
Information about over 150 nutrients.
Chapters
Hi, my name is Isabel Skidmore. I'm the lead food developer at WolframAlpha. And today I'll be walking you through some of the new capabilities that we have for working with food data and wolfram food through AI and LLMs. So just to give a quick background on how food data works in the Wolfram language, we have over close to 500,000 food individual food data points in our database, and we hold information about over 150 nutrients for those foods. Here's just a quick little example of four of those nutrients and kind of like the way that you would access these using entity value. Another thing that is really interesting about the way that food works in Wolfram language is our data structure and kind of like our categorization of foods that allows us to represent foods at different levels of specificity. Like I showed in the previous slide, we have almost 500,000 individual food data points. And these can be organized in number of ways and tagged with a number of different attributes that we represent that helps us to give summer, like summarize data for a more abstract type of food and give sort of like an average of every single type of that food that we have in our database. So here I'm just showing a little bit of how that works. So we have this red, red delicious raw apple with skin on. And in this table here we're showing sort of like what are the attributes that are associated with this food here? You know, food type is apple peeling type is unpeeled, preparation is unprepared, and the variety is red and red delicious. So this is a pretty simple food. I think it can get pretty complex and it can also stay pretty simple in terms of how many attributes we can attach to a food. But what it allows us to do is to represent sort of like a more abstract version of a food. So like, you know, all red delicious apples have some average nutritional value and we can represent that in Wolfram language without limiting it to a specific instance of this food. So the way that we do that is through a food entity type called, which we call an implicit food entity. And often this will be what comes up when you use like natural language parsing to, to access an entity. So here I've just typed in refried beans and it gave me this implicit food entity. And I'm sorry, it's a little bit small, but here it says that the food type is bean, there are no added foods, and the preparation is refried. So this is an abstract kind of food, represents all of our single data points in our database that match sort of like these criteria. And you can actually get nutritional information for this type of food as well. So if, you know, if we were to wrap this in entity value and ask for relative total calories content. Like this, it'll give us sort of like an average value for all of the foods that live inside of this, this implicit entity. And then I also like to show this graph too, because it kind of gives an idea of the complexity of this ontology and the way that we represent data about these foods. So this, like yellow or orange central area sort of like represents all of those different attributes and all those different food energy types. And then we have, you know, special ones that are kind of like peripheral, kind of like nutrients and those type of entities. And then the basic data types, you know, like numbers, qualitative data, that kind of thing. And then this also lives inside of the Wolfram language, which is obviously connected to, you know, our unit and physical quant quantity type entity framework, and then all the other entity types like species and, you know, plant. And I think we even connect it to Pokemon data, since there are some Pokemon that are based off of foods. So. So I think that's super interesting and it becomes a very powerful and very thorough categorization of, you know, the concept of foods. And so moving on now to a little bit of the new stuff with LLMs and AI. So, so this, we released a plugin for ChatGPT that allows you to access Wolfram data either through WolframAlpha or Wolfram language. And here's just a quick example of how that can work with food. So if you go into ChatGPT and you have access and you enable the plugin, whatever question you ask, it'll try to answer that with accurate data from the Wolfram language. So here it's just doing sort of Wolfram language calls to get the information that we asked for, the protein, fat and carbs, and then it creates a pie chart of that, also using Wolfram language. So you can sort of bypass, you know, learning how to create the graphics that is required to, to make this, this type of graph. Because, you know, Chat GPT knows how to do that, and it can show you also the Wolfram language code that it used to do that if you drop down one of these boxes, which I think is super useful. So it kind of limits the amount of work that you have to do up front to actually get something nice like this, which I think is really great. Here's another cool example from ChatGPT where we're kind of like using both the information that ChatGPT has access to as well as the Wolfram language data. So here we ask what are the five basic tastes? And it's telling us a little bit of information about all of them. So we have sweet, salty, sour, bitter and umami. And then here we've asked it to pick a food in each of those categories and then give us a little bit of nutritional information about each of those. And so it's able to do that using Wolfram Language and get data that, you know, can be relied upon because it's from our database. So here it picked one, a different food for each of these and gave us a little bit of information which I think is super cool. Okay, so another really cool way to access, you know, chat bot type functionality using Wolfram Mathematica products is these chat notebooks that we just put out, which I think are a really, really useful way to get access to a lot of different types of prompts and Personas and, and playing a little bit with, you know, both evaluating code in a notebook and using the chat Personas to sort of like help either write that code or, you know, provide data to, to work with or, you know, suggest things from scratch. So here I've given it, this is, we're using the chat or the Code Assistant Persona, which is one of the sort of main ones in our chat notebooks that will help you write code. So I've given it quite the specific instructions just to sort of show off the fact that, you know, you can tell it something quite specific and it'll, it'll follow those instructions which allows you to do, you know, more complex things that maybe Code Assistant wouldn't be able to do on its own. So here I'm telling it, you know, use this function and here's how to use it. This is a Wolfram resource function that we put out called Nutrition Report, which you can see a little bit of how it works where you just put in like a list of ingredients and it'll give you a report on sort of like all the different, all the different nutrients that you asked for or sort of like the default ones that we have in there too. And so we told it how to use it and then we told it, you know, here's what we want you to calculate the nutrition for and then it gives us this nice code that will generate the nutrition report, like I was saying, and you don't have to rewrite all of this code. It'll just put the ingredients that you asked for. Inside of the resource function. And then when you hover over this, it'll give you a little, like, red, like, play button thing, which you can click, and it will put the code into the notebook, into the cell following, and evaluate it for you. So this is the result of that evaluation, and this is just sort of like what nutrition report was built to do. So I think that's pretty cool. And, you know, very, very adaptable and very, very customizable as to what you want to get it to do for you. And then, you know, like I said, you can. You can move forward with the data that you've gotten from various sources, either from, you know, ChatGPT's various sources or GPT's various sources, or, you know, the data that you were able to obtain through the Wolfram language code that either you wrote or the chat or the code assistant wrote. And here we've told it to take the data that it found and create sort of like a cool interactive pie chart for us. And I think this is super useful, too, because it kind of explains a little bit of what the code is actually doing, which I think is super helpful for learning Wolfram language code and just sort of like seeing what types of ways there are to solve whatever problem or whatever task that you're trying to accomplish. So, like I said, this is that little red play button that. That will drop down, and then when you click that, it'll just put that code into the next cell, which I have here. And when you evaluate it, it creates. Creates this nice little interactive pie chart just like we asked for, which I think is pretty cool. And it shows sort of like you can take these chat notebooks and go from, you know, the very start of whatever idea that you have, all the way to this, like, really nice sort of, like, final product, too, which I think is really great. Another cool example that I have using chat notebooks with multiple different Personas is this. This example where I asked it for. I asked Recipe Bot, which is a specific Persona which will suggest a recipe for you based on any type of criteria. So I asked it to give me a Tex Mex meal for two, and it came up with this chicken fajita recipe. And then, you know, I don't want to just let that recipe sit because, you know, we're in Wolfram language, and we want to make sure we can compute everything and make cool visualizations for it and sort of enhance our understanding. So I asked it to write some Wolfram language code to do that for me. So in my idea, I was thinking, you know, what if we could create a graph that would give us the instructions for this recipe in sort of a visual way, rather than having to read through all this text. So that's what I asked it to do. And it wrote me this giant chunk of Wolfram language code, which is super nice. And then I caused. I clicked that little red button to make it come into the next cell. And then when I evaluate it, it creates this really nice sort of node graph that can show us a little bit of a visual representation of this recipe. So the original ingredients are up at the top, and then how they come together in different steps is shown here, too. So I think this is a really cool example of, you know, how we can enhance our understanding of different data sets and get, you know, ChatGPT and the capabilities of LLM, so to create those for us without necessarily having to have a lot of background knowledge in Wolfram language. And then obviously, you can sort of learn a little bit what's happening here just by looking at the code that it wrote and you can figure out what directed edges are and stuff like that. So I think this is super cool, and I think that the possibilities of working with LLMs for, you know, doing cool stuff with food are, you know, endless. So. So, yeah, that. That pretty much sums it up. I really appreciate everyone for listening and I'm really excited to see what kind of new stuff people come up with. I always love seeing community posts and different sort of, like, ideas that I never would have thought of for what to build with our Wolfram food data. So thanks so much.
More from Guy

Cheryl Strauss Einhorn | The Human Edge: Smarter Decisions in the Age of AI | Talks at Google

Rachel Glennerster | Innovation and the Center for Global Development | Talks at Google

Rebecca Winthrop | Rethinking the Purpose of Education in the Age of AI | Talks at Google

Dr. Robert Wachter | A Giant Leap: How AI Is Transforming Healthcare... | Talks at Google






