Page 4: Exploring Open AI API documentation

Oat Wongsajjathiti
3 min readMar 19, 2023

--

On page 3, we validated that ChatGPT can do what we needed for our application. As a reminder, these functionalities are:

  • Generate a high-performing resume draft based on a role and general information about the user’s experience/skills
  • Rewrite a resume based on a job description
  • Rewrite a resume based on other resumes
  • Highlight strengths and weaknesses of a resume against that job description, with prompts to improve
  • Translate resumes in different languages
  • Share insight around critical keywords/outlines that high-performing resumes use for a certain role

The next natural step is to confirm we can do these in the publically available OpenAI API.

There are five things to consider when getting started:

  1. Guides can be a good starting point to outline the range of capabilities available via the API.

2. Chat vs. Instruct: “Chat” models (GPTx) have capabilities similar to ChatGPT. You can feed it a dialogue, and ask it to continue that conversation. “Instruct” models (Ada, Babbage, Curie, Davinci) follow single-turn instructions. TLDR: they take a command and return a response. We will most likely use a combination of both types in our application.

3. Model — GPT 4, 3.5, 3, Dall-E, Whisper .etc. We will be using GPT 3.5 as we care about natural language processing for our application. We can upgrade to GPT-4 when it comes out of limited beta (or if we face limitations of 3.5). Alternatively, we can use GPT-3 if we want to fine-tune our model (aka feeding additional context/information added to the base knowledge). This may be useful for us to train the model about hiring tips and advanced industry knowledge.

4. Model version — We will be using the latest gpt-3.5-turbo which is the most capable and happens to be the most cost-effective too.text-davinci-003 is also equally capable of taking one-off instruction.

5. Tokens — Think of this as the currency for using OpenAI’s capabilities. Tokens are chunks of a word that is fed into the API. The cost of GPT-3.5 and Davinci is the same at $0.002 / 1,000 tokens.

1 token is approximately 4 characters or 0.75 words for English text. One limitation to keep in mind is that your text prompt and generated completion combined must be no more than the model’s maximum context length (for most models this is 2048 tokens or about 1500 words).

OpenAI provides a basic Next.js example project that we can clone and test the API.

git clone https://github.com/openai/openai-quickstart-node.git
cd openai-quickstart-node
npm install
npm run dev

And open localhost:3000 . I typed elephant and saw some results. It works!

On the next page, we will dig deeper into the API documentation to map out which ones are of interest to our use cases. See you there!

--

--

Oat Wongsajjathiti
Oat Wongsajjathiti

Written by Oat Wongsajjathiti

Chemical engineer turned self-taught developer. Artist, dancer and aspiring creator.

No responses yet