Explain Your Inbox Drafter

Your drafter passes every step of the exercise against the stand-in model, and the project lesson ended with a run on Leaf & Kettle Tea’s real inbox. The tests showed what your code does with scripted responses. They can’t show whether you can explain why it works or whether you could change it when the shop asks for something new.

In this review, you’ll talk through your drafter with the mentor, look at the raw response your own model/ module gets back from your provider, and make a change to the script based on a request you haven’t seen yet. Start by getting your project ready so the session doesn’t stop while you look for a file.

Get Your Project Ready

The mentor will ask you to paste code and terminal output, so have these open before you start:

  • Your project folder in a terminal, with draft-inbox.js holding the draftInbox() you wrote in the exercise and model/ with both provider files.
  • Your .env, with MODEL_PROVIDER and your provider’s key, as the project lesson set them up.
  • The output of your real run of the whole inbox with node --env-file=.env draft-inbox.js and the drafts.json it saved. If you haven’t run it yet, then do that first. It makes twelve calls and costs about a cent.
  • check-batch.js, the failure check from the project lesson. It forwards only two requests and stops the batch on purpose, so it doesn’t replace the real run.
  • draft-reply.js, the script that drafts Hannah’s reply with one call to ask().

Locked learning resources

Join us and get access to thousands of tutorials and a community of expert JavaScript developers.

Unlock This Lesson

Already a member? Sign-In

Locked learning resources

The full lesson is for members only. Join us and get access to thousands of tutorials and a community of expert JavaScript developers.

Unlock This Lesson

Already a member? Sign-In

Become a Member to join the conversation.