OpenAI GPT-3 API:如何扩展 TL;DR 输出的长度?

pso*_*one 6 openai-api gpt-3

我想使用 OpenAI 的 TLDR 从 2-3 页的文章中生成 3-6 句话的摘要。我已经粘贴了文章文本,但输出似乎只停留在 1 到 2 句话之间。

Rok*_*nko 1

用于获取给定提示的 3 句话摘要的选项

您可以通过多种方式告诉 OpenAI API 您想要 3 句话摘要:

  • 选项 1:Write TL;DR in 3 sentences(7 个代币)
  • 选项 2:TL;DR 3 sentences(5 个代币)
  • 选项 3:Write summary in 3 sentences(5 个代币)
  • 选项 4:Summary 3 sentences(3 个代币)

注意:我使用Tokenizer来计算令牌的数量。

以上所有内容都将返回 3 句话摘要。

选择选项 4

为什么?因为您需要为您使用的每个代币付费。因此,选项 4 的成本最低。

更重要的是?如果你写,TL;DR你会烧掉 3 个代币,这和你写一样Summary 3 sentences。换句话说,它的成本是一样的,但是如果你写的话,你会得到一个 3 句话的摘要Summary 3 sentences

另外,不要忘记将max_tokens参数设置得足够高,以便 OpenAI API 可以返回 3 个句子。

一个例子

我们以OpenAI官方网站为例。

迅速的:

A neutron star is the collapsed core of a massive supergiant star, which 
had a total mass of between 10 and 25 solar masses, possibly more if the 
star was especially metal-rich.[1] Neutron stars are the smallest and 
densest stellar objects, excluding black holes and hypothetical white 
holes, quark stars, and strange stars.[2] Neutron stars have a radius on 
the order of 10 kilometres (6.2 mi) and a mass of about 1.4 solar masses. 
[3] They result from the supernova explosion of a massive star, combined 
with gravitational collapse, that compresses the core past white dwarf star 
density to that of atomic nuclei.
    
Summary 3 sentences
Run Code Online (Sandbox Code Playgroud)

完成:

中子星是最小、密度最大的星体,半径约为10公里,质量为1.4个太阳质量。它们是由一颗大质量恒星的超新星爆炸形成的,该恒星的总质量在 10-25 个太阳质量之间,再加上引力塌缩将核心压缩到超出白矮星密度。因此,中子星代表了大质量超巨星的塌缩核心。