Overview 概述

The OpenAI API can be applied to virtually any task that involves understanding or generating natural language, code, or images. We offer a spectrum of models with different levels of power suitable for different tasks, as well as the ability to fine-tune your own custom models. These models can be used for everything from content generation to semantic search and classification.

OpenAI API 可以应用于理解或者生成自然语言,代码或者图像。我们可以提供适用于不同能力级别的任务的模型,也可以调优你自己的模型。这些模型可以用于任何语义搜索分类的内容生成。

OpenAI has trained cutting-edge language models that are very good at understanding and generating text. Our API provides access to these models and can be used to solve virtually any task that involves processing language.

OpenAI 有一个训练过的擅长理解和生成文字的cutting-edge语言模型。我们的API 就是提供给你使用这些模型完成任何有关语言处理任务的入口。


Introduction 核心概念简介

The completions endpoint is the core of our API and provides a simple interface that’s extremely flexible and powerful. You input some text as a prompt, and the API will return a text completion that attempts to match whatever instructions or context you gave it.

Completions (语义完整的回答)是我们API的核心,提供了简单但是非常灵活并且强大的接口。你可以输入一个段文字作文 prompt (提示性质的问题),API会返回匹配你任何提示或内容的回答 Completions。

Prompt Write a tagline for an ice cream shop.

Prompt 给我的冰激凌店写句广告语

Completion We serve up smiles with every scoop!

Completion 每一勺都都有一个微笑

You can think of this as a very advanced autocomplete — the model processes your text prompt and tries to predict what’s most likely to come next.

你可以把这看成一个高级自动生成的模型,它可以处理你的提问然后预测下面最可能发生的事情。


Start with an instruction 从一个提示开始

Imagine you want to create a pet name generator. Coming up with names from scratch is hard!

现在你准备创建一个宠物名字生成器。凭空想象可是很难的哦。

First, you’ll need a prompt that makes it clear what you want. Let’s start with an instruction.

首先,你需要一个提示来表达你想要的。

Suggest one name for a horse.

帮我给马起个名字吧

Not bad! Now, try making your instruction more specific.

不赖!现在,试着让你的提示更具体一些。

Suggest one name for a black horse.

帮我给一匹黑马起个名字吧

As you can see, adding a simple adjective to our prompt changes the resulting completion. Designing your prompt is essentially how you “program” the model.

有时一个简单的形容词就能改变结果。所以设计好你的提问词,是运用模型的关键。


Add some examples 加一些例子

Crafting good instructions is important for getting good results, but sometimes they aren’t enough. Let’s try making your instruction even more complex.

给出好的提示对得到好的结果非常重要,但是有时还不足够。下面我们试着让你的提示更复杂一些。

Suggest three names for a horse that is a superhero.

帮我给一匹超人一样的马取三个名字吧。

This completion isn't quite what we want. These names are pretty generic, and it seems like the model didn't pick up on the horse part of our instruction. Let’s see if we can get it to come up with some more relevant suggestions.

回答也许不是你想要的,给出的名字也许太普通了,模型好像没有提取出你问题中马的部分。那我们来试一试加一些相关的提示吧。

In many cases, it’s helpful to both show and tell the model what you want. Adding examples to your prompt can help communicate patterns or nuances. Try submitting this prompt which includes a couple examples.

很多情况下,它对于展示和告诉模型你想要的都很重要。给一些例子可以帮助交流更规范和细致。下面是一个示例:

Suggest three names for an animal that is a superhero.

帮我给一匹超人一样的马取三个名字

Animal: Cat

动物:猫

Names: Captain Sharpclaw, Agent Fluffball, The Incredible Feline

名字:尖爪船长,毛球特工,大牛猫

Animal: Dog

动物:狗

Names: Ruff the Protector, Wonder Canine, Sir Barks-a-Lot

名字:进击保卫者,神奇狗狗,狂叫先生

Animal: Horse

动物:马

Names:

名字

Nice! Adding examples of the output we’d expect for a given input helped the model provide the types of names we were looking for.

很好!这些例子可以帮助模型给出真正你想要的回答。

Adjust your settings 调整你的设置

Prompt design isn’t the only tool you have at your disposal. You can also control completions by adjusting your settings. One of the most important settings is called temperature.

提问设计不是你唯一的手段。你还可以通过你的设置调整你的回答。一个最重要的设置就是 temperature 温度。

You may have noticed that if you submitted the same prompt multiple times in the examples above, the model would always return identical or very similar completions. This is because your temperature was set to 0.

你也许会注意到,你使用上面相同的提示词很多次,总是得到一样或者近似的答案。这是因为你的temperature设置的是0.

Try re-submitting the same prompt a few times with temperature set to 1.

你可以把temperature 设置成1,再试几次。

See what happened? When temperature is above 0, submitting the same prompt results in different completions each time.

会发生什么呢?温度设置为大于0后,同样的提问每次都会得到不同的回答。

Remember that the model predicts which text is most likely to follow the text preceding it. Temperature is a value between 0 and 1 that essentially lets you control how confident the model should be when making these predictions. Lowering temperature means it will take fewer risks, and completions will be more accurate and deterministic. Increasing temperature will result in more diverse completions.

记住,模型会根据之前的文字预测之后的文体。温度是一个0-1的值,让你可以控制模型预测的可信度。温度越低,意味着风险越低,回答越准确和有确定性。增大温度会得到多样化的回答。

For your pet name generator, you probably want to be able to generate a lot of name ideas. A moderate temperature of 0.6 should work well.

对于这个宠物起名器而言,我们想要有更多的名字,所以温度设为0.6会更好。

Openai API 文档- Key Concepts 核心概念相关推荐

  1. Flink系列文档-(YY08)-Flink核心概念

    1 核心概念 1.1 基础概念 用户通过算子api所开发的代码,会被flink任务提交客户端解析成jobGraph 然后,jobGraph提交到集群JobManager,转化成ExecutionGra ...

  2. 达内java api文档,达内JAVA核心API(下)

    中按照该编码将字节数据转换为字符并读取.需要使用字节输入流作为参数构造InputStreamReader对象. 6.下列代码中,能实现按行读取文件的数据的流是:(). A.InputStreamRea ...

  3. 修改 Joomla! 1.5 的 HTML 输出而不动核心文件 (附api文档)

    现在到了 Joomla! 1.5 平台,前面这个方法不灵了.不过,Joomla! 开发团队早就给出了更好的方案,总结起来就是3个字母:MVC. MVC in php Programming MVC 等 ...

  4. Java基础:01Java语言概述(常见的DOS命令,Java语言的特点、核心机制、环境搭建,HelloWorld,注释,Java API 文档)

    Java基础:01Java语言概述 一.常见的DOS命令 二.Java语言的特点 面向对象性 健壮性 跨平台型 三.Java两种核心机制 1. Java虚拟机 2. 垃圾回收 四.Java语言的环境搭 ...

  5. 项目1:基于Java API文档制作的搜索引擎

    目录 一.搜索引擎相关概念 1.1 认识搜索引擎 1.2 搜索引擎的本质 1.3 搜索的思路 1.3.1  暴力搜索 1.3.2  倒排索引 1.4 项目目标 二.实现思路和前期准备 2.1 项目模块 ...

  6. (转载)中文Appium API 文档

    该文档是Testerhome官方翻译的源地址:https://github.com/appium/appium/tree/master/docs/cn官方网站上的:http://appium.io/s ...

  7. 中文 Appium API 文档

    该文档是Testerhome官方翻译的 源地址:https://github.com/appium/appium/tree/master/docs/cn 官方网站上的:http://appium.io ...

  8. 使用Swagger2Markup实现API文档的静态部署(二):Markdown和Confluence

    在上一篇<使用Swagger2Markup实现API文档的静态部署(一):AsciiDoc>中,我们介绍了如何使用 Swagger2Markup将Swagger文档转换成AsciiDoc, ...

  9. Spring Boot 集成 Swagger 生成 RESTful API 文档

    原文链接: Spring Boot 集成 Swagger 生成 RESTful API 文档 简介 Swagger 官网是这么描述它的:The Best APIs are Built with Swa ...

最新文章

  1. 使用VS Code开发调试.NET Core 2.0
  2. POJ - 3415 Common Substrings(后缀数组+单调栈)
  3. Linux中samba的权限详解,活用三种权限 理解Samba的权限控制
  4. 两种计算器小程序对比
  5. 第8章 随风飘动的粒子 (《Python趣味创意编程》教学视频)
  6. 【软件测试】负载测试与压力测试的区别
  7. linux 内存性能评估,内存性能评估工具vmstat/free/smem使用与解读
  8. Java—读取多层嵌套Json文件的内容并根据索引返回JsonObject
  9. php emoji base64,PHP处理字符中的emoji表情
  10. Element 表单校验方法简单抽离
  11. 使用GDAL/GEOS求面特征的并集
  12. 炒币机器人:币圈炒币是怎么亏钱的
  13. 数学建模之灰色关联分析
  14. python成绩统计_Python编程语言:程序代码统计成绩
  15. 2020.9.28--PS--色阶、色阶上色、曲线
  16. 象形文字--中文自然语言理解的突破
  17. 交换机 POE 学习
  18. 【VTM10.0】xPredIntraAng函数解析
  19. 98%的人都不会使用这6种地图可视化方法,学会直接涨薪5K
  20. 【小安翻唱】感冒版 心音---Xenos

热门文章

  1. [转帖] 搞笑段子 生活需要娱乐.
  2. python二元函数图像在线绘制_Python实现的拟合二元一次函数功能示例【基于scipy模块】...
  3. java entryset循环_Java之Map遍历方式性能分析:ketSet 与 entrySet
  4. java 迭代器 entryset_Java使用entrySet方法获取Map集合中的元素
  5. 【原创】Erdas9.2安装常见问题汇总
  6. linux系统u盘自动升级,Archlinux 的U盘自动装载(二)升级到 udisks2
  7. 我让盛大云主机玩个半死
  8. MediaPlayer 同步加载字幕 与 手动解析字幕
  9. Android 添加重启菜单,修改关机菜单加入重启、重启至Recovery和重启至Bootloader
  10. 最全的—— ES6有哪些新特性?