How To Use ChatGPT

monitor screen showing chatgpt landing page

This is the second in a series of articles about ChatGPT. In this article we will explain how you can use ChatGPT in your solutions, how much it costs and how to customize ChatGPT for your use cases.

If you haven’t already, you can start with A Simple Explanation Of ChatGPT.

You can read the next articles in this series afterwards:

  1. Role of ChatGPT in Healthcare
  2. Will ChatGPT Replace Doctors?

How does someone use ChatGPT?

woman writing on whiteboard
Photo by ThisIsEngineering on Pexels.com

ChatGPT is currently available as an API (Application Programming Interface) from OpenAI and from Microsoft Azure. This means you can call it from any software you build e.g., in Node.js or Python.

You can test the chat interface by going to ChatGPT website or downloading the new ChatGPT app for iPhone.

For using OpenAI in your code, you can sign up for a free account here: ChatGPT API. This gives you an API key that you can use to access the OpenAI API. The free account has some limitations so you can use the free account while you’re developing but it is not something you would use in a solution with real users.

Microsoft Azure also offers an Azure OpenAI service that runs OpenAI underneath. You can sign up for an account here: https://azure.microsoft.com/en-us/products/cognitive-services/openai-service. The benefit of the Microsoft Azure service is that it appears to be more stable and Microsoft covers it in their BAA (Business Associates Agreement) so this service can be used for healthcare. You should, of course, do a privacy and compliance review before sending any sensitive data to this API.

There are competitors in the works from Google (Bard & PaLM), Facebook (LLaMA) and others but as of now none of them are close to being production ready yet.

How to use the API?

To use the API, you generally follow two steps:

  1. Pass in a block of text you want ChatGPT to analyze.
  2. Pass in a prompt that asks a question (the block of text is passed with the prompt).
    • There are many “cheat sheets” for ChatGPT prompts on the Internet that can show you examples of prompts.

Example

You can pass in a block of text:

Apple and oranges are two types of fruit. Apples are green but oranges are orange. Apples grow in Washington State. Oranges come from Florida.

Then you provide a prompt:

Summarize the text into a single sentence.

How much does it cost to use?

dollar banknote on white table
Photo by Karolina Grabowska on Pexels.com

Current pricing model is by number of prompt and sampled tokens. The content and the prompt you provide is broken down into tokens (you can think of tokens as words although they are closer to lemmas).

Current pricing on OpenAI

The simpler model is priced at $0.03/1k tokens and $0.06/1 tokens.

Pricing on Azure OpenAI is currently the same.

How to make ChatGPT work better?

crop unrecognizable woman training small purebred dog on yoga mat
Photo by Karolina Grabowska on Pexels.com

The base ChatGPT model can create answers from understanding language and the data it has learned from. However for almost any real world use, you want to create an instruction tuned model.

You create an instruction tuned model by passing in a list of examples that tell ChatGPT what is the ideal answer to each prompt. This is used by ChatGPT to create a custom model so next time you ask it questions it is able to provide better answers.

{“prompt”: “<prompt text>”, “completion”: “<ideal generated text>”}

The technical name for this process is Reinforcement Learning with Human Feedback (RLHF) and it results in instruction tuned models that are more accurate for specific use cases.

Continue to Role of ChatGPT in Healthcare.


Popular Blog Posts