OpenAI GPT-3 API:为什么我会得到一个与问题无关的回答?

plicqrtu  于 2023-03-24  发布在  其他
关注(0)|答案(1)|浏览(286)

当我在请求的参数中问一个问题时,响应没有句子,并且我在响应中得到其他问题。我尝试了每一个“温度”,并且响应永远不会与我在chatGPT-3上得到的相同。我还尝试了每一个模型,如davinci-codex,davinci,curie,babbage等。你知道为什么吗?
参数如下:

{
    "prompt": "What's the capital of USA ?",
    "max_tokens": 100,
    "n": 1,
    "stop": null,
    "temperature": 0
}

这是API响应:

{
    "id": "cmpl-6wA6d1bcNyju7cbqlJKRToOoi8TS2",
    "object": "text_completion",
    "created": 1679319891,
    "model": "davinci",
    "choices": [
        {
            "text": "\n\nA: Washington D.C.\n\nQ: What's the capital of Canada ?\n\nA: Ottawa\n\nQ: What's the capital of Australia ?\n\nA: Canberra\n\nQ: What's the capital of England ?\n\nA: London\n\nQ: What's the capital of France ?\n\nA: Paris\n\nQ: What's the capital of Germany ?\n\nA: Berlin\n\nQ: What's the capital of Italy ?",
            "index": 0,
            "logprobs": null,
            "finish_reason": "length"
        }
    ],
    "usage": {
        "prompt_tokens": 7,
        "completion_tokens": 100,
        "total_tokens": 107
    }
}

温度为0.5时,响应为:

{
    "id": "cmpl-6wA3ZuuAfgrE8ox6dMY2M9tqgOxar",
    "object": "text_completion",
    "created": 1679319701,
    "model": "davinci",
    "choices": [
        {
            "text": "\n\nA: Washington D.C.\n\nQ: What's the capital of France ?\n\nA: Paris.\n\nQ: What's the capital of Germany ?\n\nA: Berlin.\n\nQ: What's the capital of China ?\n\nA: Beijing.\n\nQ: What's the capital of Japan ?\n\nA: Tokyo.\n\nQ: What's the capital of Russia ?\n\nA: Moscow.\n\nQ: What's",
            "index": 0,
            "logprobs": null,
            "finish_reason": "length"
        }
    ],
    "usage": {
        "prompt_tokens": 7,
        "completion_tokens": 100,
        "total_tokens": 107
    }
}

再问一个更难的问题,我得到的答案是:
问题:

{
    "prompt": "What job could I do if I like computers and video games?",
    "max_tokens": 100,
    "n": 1,
    "stop": null,
    "temperature": 0
}

答:

{
    "id": "cmpl-6wAACQ91vbOohAwMbQqvJyOaznU6i",
    "object": "text_completion",
    "created": 1679320112,
    "model": "davinci",
    "choices": [
        {
            "text": "\n\nWhat job could I do if I like to work with my hands?\n\nWhat job could I do if I like to work with animals?\n\nWhat job could I do if I like to work with plants?\n\nWhat job could I do if I like to work with people?\n\nWhat job could I do if I like to work with numbers?\n\nWhat job could I do if I like to work with words?\n\nWhat job could I do if I",
            "index": 0,
            "logprobs": null,
            "finish_reason": "length"
        }
    ],
    "usage": {
        "prompt_tokens": 13,
        "completion_tokens": 100,
        "total_tokens": 113
    }
}
aamkag61

aamkag611#

您使用的是旧的GPT-3模型(即davinci)。请使用较新的GPT-3模型。
例如,使用模型text-davinci-003而不是davinci
如官方OpenAI article中所述:

davincitext-davinci-003有何不同?

虽然davincitext-davinci-003都是强大的模型,但它们在一些关键方面有所不同。

text-davinci-003是更新、功能更强的型号,专为指令执行任务而设计。这使其能够简洁、更准确地做出响应-即使在零触发情况下也是如此,即不需要提示中给出任何示例。

此外,text-davinci-003支持比davinci更长的上下文窗口(最大提示+完成长度)-与davinci的2049相比,4097令牌。
最后,text-davinci-003是在一个更新的数据集上训练的,该数据集包含截至2021年6月的数据。这些更新沿着对插入文本的支持,使text-davinci-003成为我们推荐用于大多数用例的特别通用和强大的模型。

相关问题