ChatGPT API Transition Guide

How to get started
Written by Joshua J.. Updated over a week ago

Prompts to Messages

To have a more interactive and dynamic conversation with our models, you can use messages in ChatGPT instead of the old prompt-style using with completions.

 

Here's how it works:

  • Instead of sending a single string as your prompt, you send a list of messages as your input.

  • Each message in the list has two properties: role and content.

    • The 'role' can take one of three values: 'system', 'user' or the 'assistant'

    • The 'content' contains the text of the message from the role.

  • The system instruction can give high level instructions for the conversation

  • The messages are processed in the order they appear in the list, and the assistant responds accordingly.

 

Even basic Completions requests can be completed through ChatGPT, as you can see below:

Then

Now

'prompt' : 'tell me a joke'

'messages':

[{'role':'user', 'content':'tell me a joke'}]

Now, it is easier than ever to have back-and-forths with your model by just by extending the list of messages in the conversation.

 
'messages': [{'role':'user', 'content':'tell me a joke'}, 
{'role':'assistant', 'content':'why did the chicken cross the road'},
{'role':'user', 'content':'I don't know, why did the chicken cross the road'}]
 

System Instructions

You can also use a system level instruction to guide your model's behavior throughout the conversation. For example, using a system instruction and a message like this

 
'messages': [{'role':'system', 'content':'You are an assistant that speaks like Shakespeare.'}, 
{'role':'user', 'content':'tell me a joke'},

will result in something like

{...
'message': {'role':'assistant',
'content':'Why did the chicken cross the road? To get to the other side, but verily, the other side was full of peril and danger, so it quickly returned from whence it came, forsooth!'}
...}
 
 

ChatGPT API Transition Guide的更多相关文章

  1. iOS 7 UI 过渡指南 - 支持续 iOS 6(iOS 7 UI Transition Guide - Supporting iOS 6)

    iOS 7 UI Transition Guide Preparing for Transition Before You Start Scoping the Project Supporting i ...

  2. iOS 7 UI 过渡指南 - 開始之前(iOS 7 UI Transition Guide - Before You Start)

    iOS 7 UI Transition Guide Preparing for Transition Before You Start Scoping the Project Supporting i ...

  3. IOS7 UI Transition Guide 状态栏 statusbar

    本文转载至 http://blog.csdn.net/linzhiji/article/details/12233387 Redesign Your App for iOS 7 之 页面布局 iOS7 ...

  4. ChatGPT API使用介绍

    1.概述 随着人工智能技术的不断发展,越来越多的AI产品被应用到各个领域,其中最具代表性的莫过于人工智能语言模型.语言模型是一种可以通过学习大量语言数据来预测文本或语音的技术,其应用范围十分广泛,如智 ...

  5. OpenTranslator:一款基于ChatGPT API的翻译神器

    这是一款使用 ChatGPT API 进行划词翻译和文本润色的浏览器插件.借助了 ChatGPT 强大的翻译能力,它将帮助您更流畅地阅读外语和编辑外语. 它能干啥 一. 可翻译 二. 可润色 三. 可 ...

  6. ChatGPT API接口编程基础与使用技巧

    总结/朱季谦 趁着这周末空闲时间,在研读完OpenAi官网文档的基础上,及时总结了这篇<ChatGPT API接口编程基础与使用技巧>. 本文大部分内容是围绕编程方面,包括ChatGPT模 ...

  7. Ehcache(2.9.x) - API Developer Guide, Key Classes and Methods

    About the Key Classes Ehcache consists of a CacheManager, which manages logical data sets represente ...

  8. Ehcache(2.9.x) - API Developer Guide, Write-Through and Write-Behind Caches

    About Write-Through and Write-Behind Caches Write-through caching is a caching pattern where writes ...

  9. Ehcache(2.9.x) - API Developer Guide, Cache Eviction Algorithms

    About Cache Eviction Algorithms A cache eviction algorithm is a way of deciding which element to evi ...

  10. 两条命令搞定 ChatGPT API 的调用问题

    自2022年11月30日 OpenAI 发布 ChatGPT 以来,虽然时有唱衰的声音出现,但在OpenAI不断推陈出新,陆续发布了OpenAPI.GPT-4.ChatGPT Plugins之后,似乎 ...

随机推荐

  1. 4. JDK相关设置

    恐惧是本能,行动是信仰(在此感谢尚硅谷宋红康老师的教程) 1. 项目的 JDK 设置 File-->Project Structure...-->Platform Settings --& ...

  2. 如何将PCM格式的原始音频采样数据编码为MP3格式或AAC格式的音频文件?

    一.打开和关闭输入文件和输出文件以及判断输入文件是否读取完毕 //io_data.cpp static FILE* input_file= nullptr; static FILE* output_f ...

  3. Task Execution and Scheduling In SpringBoot

    开天辟地 Task Execution and Scheduling In the absence of an Executor bean in the context, Spring Boot au ...

  4. n皇后问题的分析和实现

    N皇后问题的分析和实现 1.实现要求 2.代码实现 1.实现要求 在n*n的方格棋中,放置n个皇后,要求每个皇后不同行,不同列,不同对角线 以行为依据,遍历行,判断行对应的列是否符合要求 判定要求: ...

  5. Android 自定义view中根据状态修改drawable图片

    原文地址:Android 自定义view中根据状态修改drawable图片 - Stars-One的杂货小窝 本文涉及知识点: Android里的selector图片使用 底部导航栏的使用 自定义vi ...

  6. 盘古大模型加持,华为云开天aPaaS加速使能千行百业应用创新

    摘要:开天aPaaS,让优秀快速复制,支撑开发者及伙伴上好云.用好云. 本文分享自华为云社区<盘古大模型加持,华为云开天aPaaS加速使能千行百业应用创新>,作者:开天aPaaS小助手. ...

  7. Map集合_HashMap_TreeMap_等_小记

    Map是一种依照键值对数据存储元素的容器. Map中的元素是两个对象,一个对象作为键,一个对象作为值.一个键(key)和它对应的值构成map集合中的一个元素.Map集合的数据结构只跟键有关,键不可以重 ...

  8. Linux 命令:diff

    用途 示例 备注 查看区别 diff file_1 file_2 不加选项 并排输出 diff file_1 file_2 -y -W 50 类似vimdiff 生成patch diff -ruN f ...

  9. C#/.net/DotNet/Emgu.CV裁剪照片头像

    头像裁剪有利于人脸识别批量照片预处理,安防领域可以快速通过视频定位人脸,进行抓拍,做人脸识别相关功能的可能会应用到人脸裁剪,以下是我在实践中应用的代码,如有需要复制粘贴即可使用. using Emgu ...

  10. 原来TypeScript中的接口和泛型这么好理解

    "接口"和"泛型"是 TypeScript 相比于 JavaScript 新增的内容,都用于定义数据类型 前面两篇文章总结了TypeScript中的 类型注解. ...