Overview

OpenAI Models

  • Generative Pre-trained Transformers (GPT) — a model that can understand and generate writing and code.
  • DALL-E — a model that can generate and edit images given a text description.
  • Whisper — a model that can convert audio into text.

Resources

ChatGPT

A large language model optimized for conversational interfaces. Enables multi-turn conversations with GPT models. Use cases:

  • A digital assistant (chatbot) to answer questions about a business
  • Extracting key insights and asking questions about a document
  • Summarizing information in a document
  • Debugging code

Prompts and Completions

  • Prompt — the task (“Summarize this for a 5th grader”) and the content (“Jupiter is the fifth planet…”).
  • Completions — the responses generated by a model like GPT. These could be text, code or images.

Task:

Summarize this for a second-grade student:

Content:

Jupiter is the fifth planet from the Sun and the largest in the Solar System. It is a gas giant with a mass one-thousandth that of the Sun, but two-and-a-half times that of all the other planets in the Solar System combined. Jupiter is one of the brightest objects visible to the naked eye in the night sky, and has been known to ancient civilizations since before recorded history. It is named after the Roman god Jupiter.[19] When viewed from Earth, Jupiter can be bright enough for its reflected light to cast visible shadows,[20] and is on average the third-brightest natural object in the night sky after the Moon and Venus.

Completion:

Jupiter is the fifth planet from the Sun and the biggest in our Solar System. It is very bright in the night sky and has been known since ancient times. It is named after the Roman god Jupiter. It is usually the third brightest object in the night sky after the Moon and Venus.

Tokens

The size of prompts is measured in tokens. One token is usually one syllable, except for common multi-syllable words. Each model has a token limit.

More information: https://learn.microsoft.com/en-us/azure/ai-services/openai/concepts/models

ChatGPT Roles

Roles help ChatGPT add additional information in the context of a conversation.

Roles:

  • System — the system message provides the initial context and guidance for the model. It provides instructions on context the model can reference when generating a response, what it should and should not answer, and how to format the responses.
  • Assistant — these are messages containing the completions or responses generated by the model.
  • User — these are messages composed by the user.

An example system message for a hiking assistant:

You are a hiking enthusiast who helps people discover fun hikes in their area. You are upbeat and friendly. You introduce yourself when first saying hello. When helping people out, you always ask them for this information to inform the hiking recommendation you provide:

  1. Where they are located
  2. What hiking intensity they are looking for

You will then provide three suggestions for nearby hikes that vary in length after you get that information. You will also share an interesting fact about the local nature on the hikes when making a recommendation.

Prompt Engineering [ Documentation]

Prompt engineering is the process and techniques for composing prompts to produce output that more closely resembles the desired intent. Generally, the less detail provided, the more assumptions the model needs to make. To compose good prompts:

  • Be specific
  • Provide sample outputs
  • Provide relevant context

For example:

“Classify this post: my cat is adorable.”

…will produce a different completion than…

“Classify the sentiment of this post as positive, neutral, or negative: my cat is adorable.”

Grounding a model

You can ground a ChatGPT model by providing facts and additional relevant information in your prompt to guide the model to answer questions and perform various other tasks.