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. 【Oracle】行转列的函数wm_concat,listagg,xmlagg,pivot以及动态行转列

    [Oracle]行转列的几种情况 表的数据如下 朴实无华的函数 1.wm_concat 使用格式: select 分组字段,wm_concat(要转换的列名) from 表名 group by 分组字 ...

  2. 1.1 熟悉x64dbg调试器

    x64dbg 是一款开源.免费.功能强大的动态反汇编调试器,它能够在Windows平台上进行应用程序的反汇编.调试和分析工作.与传统的调试器如Ollydbg相比,x64dbg调试器的出现填补了Olly ...

  3. CF961E Tufurama题解

    我们维护一个存储下标数据的树状数组,先将 \(1\sim n\) 插入树状数组. 用 \(a\) 表示原数组,\(b\) 表示按照 \(a_i\) 排序后的数组. 我们从 \(1\) 开始统计,直到 ...

  4. 我和ChatGPT聊数字人

    ​ 近期,聊天机器人ChatGPT火了,写诗写文写代码,才艺狠狠拉满. 面对如此"会聊"的ChatGPT,很多人好奇相同的问题提问ChatGPT和真人,会有什么样的结果? 于是我们 ...

  5. github上传文件报错failed to push some refs解决

    报错内容,不能推送文件到github上 error: failed to push some refs to github地址 原因是github项目与本地文件夹一些关键文件的确实,比如.git,re ...

  6. ListView选中获取数据并弹出菜单项

    前言 作为一名Android小白,我在编写过程中,使用ListView列表,想要使用他来完成长按弹出菜单选项,并且还要进行事件操作,经过百度编程的经历后,终于成功完成.在此附上这块比较完整的代码,理论 ...

  7. Cilium 系列-2-Cilium 快速安装

    系列文章 Cilium 系列文章 前言 在本章中,我们将直接将 Cilium 安装到 Kubernetes 集群中. 在实验中,我们用到的组件及版本为: Cilium 1.13.4 K3s v1.26 ...

  8. Flutter系列文章-Flutter进阶

    在前两篇文章中,我们已经了解了Flutter的基础知识,包括Flutter的设计理念.框架结构.Widget系统.基础Widgets以及布局.在本文中,我们将进一步探讨Flutter的高级主题,包括处 ...

  9. jQuery入口函数测试

    <script src="js/jquery-1.12.4.js"></script><script> window.onload = func ...

  10. debian11安装mysql5.7

    前言 mysql官网5.7版本的只找到debian10的,没有debian11的,试了下也能用. 系统版本:debian 11 mysql版本:5.7.35 步骤 下载bundle的tar包.官网地址 ...