Prompt-Engineering-Guide/guides/prompts-chatgpt.md

13 KiB
Raw Permalink Blame History

ChatGPT Prompt Engineering

In this section, we cover the latest prompt engineering techniques for ChatGPT, including tips, applications, limitations, papers, and additional reading materials.

Note that this section is under heavy development.

Topics: - ChatGPT Introduction - Reviewing The Conversation Task - Conversations with ChatGPT - Python Notebooks

Reviewing The Conversation Task

In one of the previous guides, we covered a bit about conversation capabilities and role prompting. We covered how to instruct the LLM to have a conversation in a specific style, with a specific intent, behavior, and identity.

Lets review our previous basic example where we created a conversational system thats able to generate more technical and scientific responses to questions.

Prompt:

The following is a conversation with an AI research assistant. The assistant tone is technical and scientific.

Human: Hello, who are you?
AI: Greeting! I am an AI research assistant. How can I help you today?
Human: Can you tell me about the creation of black holes?
AI:

From the example above, you can see two important components: - the intent or explanation of what the chatbot is - the identity which instructs the style or tone the chatbot will use to respond

The simple example above works well with the text completion APIs that use text-davinci-003. More recently, OpenAI announced the ChatGPT APIs, which is a more powerful and cheaper model called gpt-3.5-turbo was specifically built for this type of functionality (chat completions). OpenAI recommends this as their best model even for non-chat use cases. Other benefits of using the ChatGPT APIs are significant cost reduction (90%) and efficiency.

Big companies like Snap Inc. and Instacart are already integrating conversational features powered by ChatGPT on their products that range from personalized recommendations to open-ended shopping goals.

Python Notebooks

Description Notebook
Learn more about how to make calls to the ChatGPT APIs using the openai library. ChatGPT API Intro
Learn how to use ChatGPT features using the LangChain library. ChatGPT API with LangChain

Previous Section (Applications)

Next Section (Adversarial Prompting)