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. Winform或WebForm使用ReportViewer报表设计,工具栏按钮英文显示的解决办法

    在项目开发中,我们总是会用到rdlc报表设计器,大多数情况下在本地开发环境中工具栏按钮显示的是中文,但是部署到客户环境后发现显示的是英文. 解决这个问题也是走了很多弯路,给大家简单说一下: 1.最初以 ...

  2. Educational Codeforces Round 150 (Rated for Div. 2) A-E

    比赛链接 A 代码 #include <bits/stdc++.h> using namespace std; using ll = long long; bool solve() { i ...

  3. 解读XML - Foreach循环

    <foreach item="item" index="index" collection="supplyIdAry" open=&q ...

  4. async-await Rust: 200 多行代码实现一个极简 runtime

    What I cannot create, I do not understand Rust 中的 runtime 到底是咋回事, 为了彻底搞懂它, 我在尽量不借助第三方 crate 的情况下实现了一 ...

  5. 【ssh】SSH连接远程主机的两种方式

    一.基于用户名与密码连接 指令 ssh username@server_ip 随后要求输入密码 加密流程 1️⃣ 在SSH连接建立过程中,客户端和服务器使用Diffie-Hellman密钥交换协议协商 ...

  6. Android LinearLayout快速设置每个item间隔

    原文地址: Android LinearLayout快速设置每个item间隔 平常使用LinearLayout的时候,有时候会需要对每个item设置间距,但是每个item都加上margin的方法实在有 ...

  7. SpringBoot整合Websocket,实现作为客户端接收消息的同时作为服务端向下游客户发送消息

    SpringBoot整合Websocket 1. SpringBoot作为服务端 作为服务端时,需要先导入websocket的依赖 <dependency> <groupId> ...

  8. struct 结构体分析

    struct分析 1.无成员的空结构体size为 1byte 2.通过/zp可以调整对齐值,默认是8字节 //设编译对齐设定值为Zp //设成员变量的类型为 member type //设成员变量在结 ...

  9. 你真正了解Spring的工作原理吗

     Spring   1.1 什么是Spring IOC 和DI ?   ① 控制反转(IOC):Spring容器使用了工厂模式为我们创建了所需要的对象,我们使用时不需要自己去创建,直接调用Spring ...

  10. Avalonia项目在OpenKylin运行踩坑

    Avalonia项目在OpenKylin运行踩坑 本篇博客记录OpenKylin开源操作系统中运行Avalonia项目遇到的各种问题,会一直更新,最新的内容请点击文末的链接跳转到我的博客原文地址查看. ...