AI Chef Helper
By Richard Rost
2 years ago
Integrate ChatGPT into MS Access for Recipe Ideas
In this Microsoft Access tutorial, I will show you how to integrate OpenAI (ChatGPT) into your Chef's Kitchen Helper database to generate new recipe ideas based on pantry items directly from Access
Nolan from Evanston, Illinois (a Platinum Member) asks: I've been using your Chef's Kitchen Helper database for over a year now, and it works great. But, I got to thinking that I could use ChatGPT to help me come up with new recipe ideas based on what I have in my pantry. I can copy and paste my list of ingredients into the GPT interface, but is there any way I can just integrate this into my database directly? I know you showed how to do some stuff with GPT before with Access. How would I put these two together?
Prerequisites
Links
Recommended Courses
Up Next
Keywords
TechHelp Access, OpenAI integration, recipe generation, Chef's Kitchen Helper database, pantry items, Access VBA, developer level tutorial, advanced VBA, recordsets in Access, generate dishes, AI-enhanced cooking, Access API integration, automated recipe suggestions, database programming, VBA scripting, OpenAI API key.
Subscribe to AI Chef Helper
Get notifications when this page is updated
Intro In this video, we tackle how to enhance the Chef's Kitchen Helper database by integrating it with ChatGPT from OpenAI. I will show you how to use advanced VBA with record sets to collect your pantry ingredients from Microsoft Access, build a text string, and send it directly to OpenAI to get recipe suggestions. You'll see how to set up your product table, configure API keys, and modify database forms and buttons so you can get meal ideas without leaving Access. This is an advanced-level tutorial for Access developers looking to add AI-powered features to their database applications.Transcript Got a good one for you today, folks. We're going to take the Chef's Kitchen Helper and we're going to AI it. We're going to integrate it with ChatGPT OpenAI, and we're going to use it to say, "Hey, this is the stuff I have in my kitchen pantry. Alright, I got milk, I got marinara sauce, I got pepperoni, I got whatever. Alright, here's my list of ingredients. You tell me what I can make with it," and we'll have ChatGPT do the hard work.
Today's question comes from Nolan in Evanston, Illinois, one of my Platinum members. Nolan says, "I've been using your Chef's Kitchen Helper database for over a year now, and it works great. But, I got to thinking that I could use ChatGPT to help me come up with some new recipe ideas based on what I have in my pantry. I can copy and paste my list of ingredients into the GPT interface, but is there a way I can just integrate this into my database directly? I know you showed us how to do some stuff with GPT before with Access. How would I put these two things together?"
Well, that's a great idea, Nolan. With the Chef's Kitchen Helper that I showed you how to build before, you've got a list of all the products that are in your pantry right now, all the different ingredients. We could literally take that, build a text string out of it, send that text string to OpenAI, and say, with some instructions, "Hey, based on these ingredients, give me three dishes or five dishes or whatever that I can make out of this stuff." And then there you go. And we'll have ChatGPT do all the hard work.
So, what do we need to know? Well, first off, this is going to be a developer-level video, which means we're going to need a decent amount of VBA with this one. This is more of an advanced level VBA video for you. And in fact, we're going to have to use record sets in today's video. Record sets allow us to say, "OK, here are the records in my table. I want to loop through them and read in the data into VB, right, and to create a text string that's got one or more records worth of data in it that I can then take that text string and do stuff with it, like send it to OpenAI." OK, so definitely go watch my record sets video if you haven't worked with record sets before.
This is pretty much the only way that I can think of to do this. And I love record sets. I use them all the time. So definitely a good tool to have in your box. If you haven't watched my Chef’s Kitchen Helper video, this one's about four years old. This was a popular one back in the day. Go watch this. In fact, this one came up even before I had my TechHelp free template. So it's just a couple of tables and some queries. But basically, in this database, I show you how to put in your list of ingredients. You specify the recipes, right, like a pizza requires this much flour, this much marinara sauce, this much pepperoni, this much mozzarella cheese. And then the database will tell you, based on what the required quantities are and what you have on hand, what you can make.
So, go watch this just to get a feel for it if you want to. This is kind of optional because all you need really is a product table. This is definitely the big one though. Definitely go watch the OpenAI video. There's two parts to it. I will teach you how to build a database where you can send information to OpenAI, get a response back, display that in your form. We're going to be working with a copy of this database for today. So if you haven't built this yet, go build it now. Go watch this video and follow along. Build it.
If you're a Gold member, you can download the database off my website. That's one of the benefits of being a member and then, once you've done what you got and then come on back. All right, I'm going to start with grabbing a copy of the Chef's Kitchen Helper database since I'm a Gold member on my own website. I can do that. Here's the download right there. I'm going to click on that. It'll download the file. There it is, right there; let's open her up, and this database is pretty simple. We got a list of products, and this is really all we need for today.
We've got a product ID, which we really don't care about; product name, that's your products; your quantity on hand; and your unit type, ounces, cups, pounds, whatever. That's all we need. The rest of the stuff in this database is if you want to put in your own recipes like cereal, pancakes, chicken parm, and then you specify the ingredients required for each recipe. I cover this in that other video. All we really need for today is this because we're going to make ChatGPT tell us what to do.
Now, you could do this yourself manually using the ChatGPT web interface if you want to. Let me show you an example. Alright, here I am in ChatGPT on the web. You can use GPT-3.5; it works just fine. I've tried it in both of them. GPT-4 is a little more advanced, of course. By the time you're watching this, it could be the year 2030, and we're up to GPT-85. I don't know. But anyways, we're just going to come down here, okay? We're going to type in a basic prompt, like "I'm going to give you the contents of my food pantry. Please suggest three dishes that I can make using these ingredients."
Now, don't hit enter yet. Hit shift enter a couple of times so you're on a blank line. Go up to your product table, select these columns like that, copy it, Ctrl+C, come back over here, and then paste that in. There's your stuff, and yeah, GPT can make sense out of that; then send it. And then right away, there you go. There are three dishes for you: Chicken Parm, Spinach Pasta; yeah, I got that stuff. Chicken breast, flour, eggs, Parmesan cheese, spinach; Pancakes with eggs, I don't know if that sounds kind of okay; Creamy Chicken Alfredo Pasta, sure. Sounds great.
Okay, so what we want to do with today's lesson is to make Access do this. So I can just, from my database, you know, keep your product list up to date, update your pantry, whatever. And then when you're ready for some ideas for dinner, click the button and have it tell you some different ideas.
So now, the next step is to go get my OpenAI database. I believe it's on part two. Yeah. So usually, you'll find links to multiple parts on here. There's part two, and usually, the database is on the last part. This is a two-part series. There's the database right there. I'm going to click on that bad boy, and have that download. Alright, we can open up the OpenAI database.
All right, here we are. Now, this is the members' version of it. So if you're not a member, there have been a few changes to this. Basically, what I did was in the free version, we just had one command, which was "please correct for spelling and grammar." Well, in the extended cut, we made it so you could have different bots. So you could pick, "OK, reply as if you're Jean-Luc Picard." If I say, "please go to the store," and you can say, "please reply as if you're Jean-Luc Picard," it will come back with that answer. And of course, I'm getting an error unauthorized because, and I was going to bring this up, but I jumped the gun. We have to go into the secret key mod, and in here is where you have to put your API key. Remember, if you're going to do this, you need an API key from OpenAI. So, you put that right in here.
I'm going to put mine in now, and you're not going to know what it is because it's mine. And I don't want you running up my bill, but go ahead and put your API key in here now. And now that my API key is in there, it should come back. There we go: "Make it so, Engage! Make your way to the store and proceed with your mission." So, that's what we did in the other one. Or, you could say, "reply as Mr. Spock." Let's see what that comes back with. "Oh, this is indeed fascinating. You're suggesting physical visits to acquire goods." I love it.
Anyways, so that's basically what we added in the extended cut. All right, so next up, let's take the product table from our Chef database and bring that over here. OK, that's all you've got to do. Now, we really don't need this other database anymore. We can close that and get it out of the way. All right, so we got our list of products from our pantry in our AI database. Now, we're going to set up a bot for the instructions for the chef.
So, I'm going to go to the bot table. If you're building this off the free database, you're not going to use a bot. You're just going to replace the instructions, your system message, with this. We'll call this the Chef's Helper. And I'll put that same set of instructions in here that I gave to ChatGPT.
Now what we're essentially going to do is we're going to take this and send it as a system message. And then we're going to send our list of products as the user message. Now, members, note that this is ID 7 for our send to OpenAI function. So instead of using this send to OpenAI, which uses these bots here, what we're going to do is we're going to make another button. In fact, I'm going to get rid of these. We don't need all these buttons. And let's just rename this guy Chef's Helper. In fact, what I'm going to do is, we can keep this stuff around, if you want to keep it around, just kind of bring it over here and make it smaller. Let's send to OpenAI. We'll put our little bot over here. Yeah, we'll just change this to Chef’s Helper, whatever you want to do, make it look pretty. I make it look pretty for the slide. Chef's Helper, whatever. OK, but we want a nice big area over here so we can see what the response is, so we can see all the dishes. OK, we'll do it like that.
OK, now, we're going to use our custom button to send this stuff. All right, we're not going to use these. We'll keep these around in case you want to use them for something else. But this is the button that's going to be sending our stuff to OpenAI and getting the response. Let's rename the button. It's Customer List Button right now. Let's call this the Chef Button. Now we're going to take the code out of the Send to OpenAI button. All right, so go in here, build event. All right, this is the code here for the members. The non-member version, all I did was I took all that code in the button and I just encapsulated it into this function called AskOpenAI. All right, which sends to it the text, which is the user message, and the bot information, which is the instructions. All right, that's all that does; you should be able to figure out how to work with that.
We're going to copy that stuff there, and we're going to drop it in this button here. OK, now our bot combo, we're not going to use the bot combo; we're just going to put in there our ID 7. We're going to use the Chef bot. And the stuff we're going to send to it is not going to be my text. My text is the textbox; we don't want to send that. We want to send our product string. All right, what's the product string? Well, the product string is a string we're going to build up for all of our products. All right, so we're going to Dim that as a string. OK, so we're going to build up a product string, which is a list of all the products out of the ProductT, which we'll use a record set for. OK, and then we're going to send that as the data with the instructions from the bot, bot 7, and that's going to go to OpenAI, and we'll get our reply back.
And we're going to build that product string in tomorrow's class. So, tune in tomorrow, same bat time, same bat channel. Or if you're a member, you can watch it now because I'm going to record it in just a few minutes. And in part two, we will continue on by building our string of products to send to OpenAI and make sure this whole thing works. Alright? So that's going to be your TechHelp video for today. Hope you learned something, live long and prosper, my friends, and I'll see you tomorrow for part two.
TOPICS: AI integration with ChatGPT OpenAI Using ChatGPT for recipe suggestions Chef's Kitchen Helper database usage Accessing ChatGPT with a list of ingredients VBA advanced level tutorial Using record sets in VBA Building a text string for OpenAI interaction Revisiting the Chef's Kitchen Helper video Creating an OpenAI Access database Downloading Access databases for Gold members Integrating product tables from Access databases Access database membership benefits Instruction building for ChatGPT prompts Setting up a bot for recipe instructions Sending system messages to OpenAI Generating product strings from Access tables Capturing OpenAI response in Access Building an Access form for ChatGPT interaction Customizing Access buttons for OpenAI communication Configuring API keys for OpenAI access Continuation in part two of the tutorialQuiz Q1. What integration is the video tutorial mainly focused on? A. Integrating Chef's Kitchen Helper with Microsoft Excel B. Integrating ChatGPT OpenAI with Chef's Kitchen Helper C. Integrating Chef's Kitchen Helper with Google Sheets D. Integrating ChatGPT OpenAI with Photoshop
Q2. According to the video, what will the integration of ChatGPT OpenAI with Chef's Kitchen Helper allow users to do? A. Manage inventory in a warehouse B. Request cooking videos based on ingredients C. Generate new recipe ideas based on pantry items D. Automatically order groceries online
Q3. What programming language is primarily used for the integration discussed in the video? A. JavaScript B. Python C. Visual Basic for Applications (VBA) D. C#
Q4. What is Nolan's contribution to the video tutorial? A. He provided the Chef's Kitchen Helper database B. He suggested the ChatGPT integration idea C. He offered technical support for the integration D. He donated the OpenAI API key for the demonstration
Q5. What is a recordset used for in VBA as explained in the video? A. To generate charts and reports based on the data B. To loop through records in a table and create a text string C. To secure the connection to external databases D. To design user forms and interfaces
Q6. What do viewers need to make the integration work on their own systems? A. A high-speed internet connection B. Access to Chef's Kitchen Helper source code C. An API key from OpenAI D. A premium subscription to the video channel
Q7. The video mentioned an important resource for viewers unfamiliar with recordsets. What is it? A. An online forum for Chef's Kitchen Helper B. The video host's previous recordsets video C. The official VBA documentation D. A book about advanced Access techniques
Q8. Why does the instructor suggest watching the Chef's Kitchen Helper video? A. To learn about Chef's special cooking techniques B. To understand the structure of the product table C. To become familiar with the video host's teaching style D. To find hidden easter eggs within the video
Q9. What is the "system message" in the context of this video? A. An error message that appears when a database is corrupted B. Instructions sent to ChatGPT along with the list of products C. A default message displayed when the OpenAI database is launched D. An operating system update notification
Q10. What does the video promise to cover in the next lesson (part two)? A. How to reduce the costs of using the OpenAI API B. Building the string of products to send to OpenAI C. Advanced techniques for optimizing database queries D. Customization of the user interface for better experience
Answers: 1-B; 2-C; 3-C; 4-B; 5-B; 6-C; 7-B; 8-B; 9-B; 10-B;
DISCLAIMER: Quiz questions are AI generated. If you find any that are wrong, don't make sense, or aren't related to the video topic at hand, then please post a comment and let me know. Thanks.Summary Today's TechHelp tutorial from Access Learning Zone is all about taking the Chef's Kitchen Helper database to the next level by integrating it with ChatGPT from OpenAI. The goal is to allow the database to analyze the contents of your pantry and suggest recipes based on whatever ingredients you currently have available—all with the help of AI.
The inspiration for today's session comes from a question about enhancing the Chef's Kitchen Helper database, which many of you built following my original lessons. Nolan wanted to know if, rather than manually copying ingredient lists into ChatGPT's web interface, there is a way to fully integrate recipe suggestions directly into the Access database. The answer is yes, and today I'll explain how you can bring together your ingredient data and OpenAI's capabilities to make smarter recipe suggestions—right from Access.
Here is how we'll proceed. To accomplish this, we're stepping into some advanced VBA territory. Specifically, we'll be working with record sets. With record sets, you can loop through all your records in a table, fetch all of the current ingredient names, quantities, and units, and assemble those into a single text string. This string of information can then be sent off to OpenAI along with clear instructions, asking for recipe suggestions based on those ingredients. If you're new to record sets in VBA, I have a dedicated video on that subject that I'd recommend watching first.
For context, the Chef's Kitchen Helper database is designed to let you enter all the products in your pantry, manage your recipes, and check which recipes you can make given the quantities you have on hand. The basics of that setup are explained in my earlier videos, so feel free to revisit those if you need a refresher. However, for today's AI integration, all you really need is the product table—a list of what's in your pantry right now.
Now, you could approach this manually. All you have to do is copy your list of pantry items and paste it into the ChatGPT web interface after entering a prompt like, "Suggest three dishes I can make with the following ingredients." Once pasted, GPT will process your list and reply with some recipe ideas. This works well, but our purpose here is to have Microsoft Access do all of this heavy lifting for you without switching applications.
To set this up, start by getting the OpenAI sample database from my tutorial series. In the members' version of this database, you can define multiple bots—each with its own unique prompt instructions. For example, you can ask for recipe suggestions, or even have the bot reply with the flavor of a favorite fictional character. Before you can use the OpenAI API, you'll need to generate an API key at OpenAI's website and enter it into the database. This is an important step—you won't get responses without a valid key.
Once the OpenAI Access database is set up with your API key, the next part is to copy your product table from the Chef's Kitchen Helper database into this database. This table should list each product's name, quantity, and measurement unit. For today's project, that's all the information you'll need.
Next, you'll establish a bot profile that contains clear instructions for the recipe assistant. This essentially acts as the system message you structure for ChatGPT, telling it to suggest recipes based on the list of available ingredients. In technical terms: when you send a message to OpenAI from Access, you include both the system message (the instructions to ChatGPT) and the user message (the text string with your ingredients).
At this stage, you move into customizing the database. You'll create or modify a button in Access that takes care of building the text string from your product records using a record set. The logic is straightforward: gather all products and their details from the product table (looping through each record), structure them as a single contiguous list, and send that assembled string as your user message along with your chef-style instructions to OpenAI.
Depending on whether you're using the member or non-member version of the database, the method for sending the data may differ. In the members' version, the sending mechanism is tied to a bot ID field; in the free version, you might directly use a function like AskOpenAI with your messages. Either way, the goal remains the same: press a button, generate your product string, send your prompt and product list to OpenAI, and receive a list of recipe ideas right back in your Access form.
For today, I've described the overall architecture and setup needed. Building the actual product string and finalizing the integration will be covered in the next part of this project. If you're following along, take some time to ensure your product table is in place, your API key is registered, and your bot instructions are written. In part two, we'll complete the process by assembling the ingredient list and verifying that everything works as expected.
You can find a complete video tutorial with step-by-step instructions on everything discussed here on my website at the link below. Live long and prosper, my friends.Topic List AI integration with ChatGPT OpenAI Using ChatGPT for recipe suggestions Chef's Kitchen Helper database integration Accessing ChatGPT with a list of ingredients Using record sets in VBA Building a text string from Access records Importing the product table into OpenAI database Setting up bot instructions for meal suggestions Modifying Access forms for ChatGPT output Customizing buttons to send product data to OpenAI Inserting and managing the OpenAI API key Sending system and user messages to ChatGPT Displaying recipe results from ChatGPT in Access
|