gpt4 book ai didi

openai-api - OpenAI GPT-3 API : How to extend length of the TL;DR output?

转载 作者:行者123 更新时间:2023-12-02 05:46:06 28 4
gpt4 key购买 nike

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

最佳答案

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

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

  • 选项 1:用 3 句话写 TL;DR(7 个标记)
  • 选项 2:TL;DR 3 句子(5 个标记)
  • 选项 3:用 3 句话写摘要(5 个标记)
  • 选项 4:总结 3 个句子(3 个标记)

注意:我使用了 Tokenizer来计算 token 的数量。

以上所有都将返回一个 3 句摘要。

选择选项 4

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

还有什么?如果您编写 TL;DR,您将燃烧 3 个代币,这与您编写 Summary 3 sentences相同。换句话说,它的成本是一样的,但是如果你写 Summary 3 sentences,你会得到一个 3-sentence summary。

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

一个例子

我们以官方OpenAI website为例.

提示:

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

完成:

Neutron stars are the smallest and densest stellar objects, with aradius of about 10 kilometres and a mass of 1.4 solar masses. They areformed from the supernova explosion of a massive star, which had atotal mass between 10-25 solar masses, combined with gravitationalcollapse to compress the core beyond white dwarf density. As such,neutron stars represent the collapsed cores of massive supergiantstars.

关于openai-api - OpenAI GPT-3 API : How to extend length of the TL;DR output?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/73629287/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com