HerokuJulián DuqueTutorial
Working with ChatGPT Functions on Heroku
Summary
Menu Maker is a Node.js web application that turns user-supplied ingredients into a dish name, fine-dining description, ingredient list, and recipe. Its React front end communicates with an Express back end, which adds prompt instructions and sends the request to OpenAI’s Chat Completions API. The application uses ChatGPT’s function calling feature to define an updateDish function with structured JSON fields for the title, description, ingredients, and recipe, so parsed arguments can update React state directly. The GitHub-hosted Node.js monorepo is deployed to Heroku, where an OPENAI_API_KEY config var authenticates requests, an optional CHATGPT_MODEL selects the model, and Heroku runs yarn build and yarn start.
Context
The project is motivated by developers building applications on top of OpenAI’s APIs and by the need for a quick, secure, and simple hosting path on Heroku.
Approach / What changed
The application combines a React front end with an Express API server, uses ChatGPT function calling to request structured dish data, parses the returned arguments, and deploys the GitHub-hosted monorepo to Heroku with configuration variables for authentication and model selection.
Takeaways
ChatGPT function calling provides a formatted response that code can feed into a custom function; it does not invoke the function itself.
The updateDish schema requires title, description, ingredients, and recipe fields, with ingredients represented as objects containing an ingredient name and amount.
Heroku deployment uses OPENAI_API_KEY as a config var, optionally reads CHATGPT_MODEL, and runs yarn build followed by yarn start; dynos can be scaled to zero when unused.
Source and freshness
- Source
- heroku.com
- Published
- Added to Yomu
Summaries are generated from the original by a language model. Check the original before relying on it.
Keep reading
Related reading
The Good Stuff
Paid picks we use ourselves. Links carry a referral code — a subscription through one earns us a commission at no extra cost to you.
The best engineering reads, once a week
One useful email. Unsubscribe anytime.