Back to Browse

Make a CLI tool with Node and OpenAI to boost your productivity

637 views
Feb 18, 2023
1:11:28

Learn how to build a CLI (Command Line Interface) app that lets you ask questions and generate files from text prompts, powered by the same OpenAI technology that drives Chat-GPT3 and DALL-E. Say goodbye to Google and StackOverflow and boost your productivity. This is a great first project to learn how to make CLI apps in NodeJS, and to learn how to consume APIs (Application Programming Interfaces) with code. Share in the comments or tag Claire Froelich on Twitter (@clairefroe) sharing what you make! Project code: github.com/clairefro/aimlazy-demo This project was inspired by Shell GPT from TheR1D. Check it out: github.com/TheR1D/shell_gpt -- CONTENTS -- 00:00 - Demo 02:09 - Introducing OpenAI 03:36 - Start your Node project 07:14 - Add your first command 17:34 - Try OpenAI API with Postman 29:07 - Call OpenAI API with code 43:26 - Handle errors 46:05 - Hide your secrets in .env file 51:30 - Add option to write response to a file 01:01:17 - Make your app global with npm link 01:07:02 - Further exploration -- LINKS -- OpenAI API docs platform.openai.com/docs/introduction Postman (API Platform) postman.com Postman API Fundamentals Student Expert Certification (hands-on, free!) bit.ly/pm-se-clairefro-openai-cli -- TAKE IT FURTHER -- Level up your skills by adding your own features! Here are some ideas: - add a command for summarizing the contents of files, using readFileSync() - add a command for updating the API KEY settings (securely!) - add options for adjusting the parameters of the OpenAI API call (ex: set the max token count) - add a command for generating image files from text - add a prompt that asks if the user wants to execute the command returned from OpenAI (y/n) #openai #chatgpt #api #ai #postman #nodejs

Download

0 formats

No download links available.

Make a CLI tool with Node and OpenAI to boost your productivity | NatokHD