Skip to content

Can only get a limited number of logprobs from completions? #38

Closed
@yangkevin2

Description

@yangkevin2

Hi,

I am specifying that I want the logprobs of the top 100 tokens but the API seems to give me at most 5:

(Pdb) response = openai.Completion.create(engine='ada', prompt='test', max_tokens=1, logprobs=100)
(Pdb) response
<OpenAIObject text_completion id=cmpl-3qtEQ4P8iNmTHqV8Eh4Wq59vzqnbm at 0x7fcf271ebb30> JSON: {
  "choices": [
    {
      "finish_reason": "length",
      "index": 0,
      "logprobs": {
        "text_offset": [
          4
        ],
        "token_logprobs": [
          -10.029023
        ],
        "tokens": [
          " goal"
        ],
        "top_logprobs": [
          {
            ",": -3.721809,
            "-": -2.6293674,
            ".": -2.6775126,
            "/": -2.527664,
            "_": -2.10408
          }
        ]
      },
      "text": " goal"
    }
  ],
  "created": 1633734378,
  "id": "cmpl-3qtEQ4P8iNmTHqV8Eh4Wq59vzqnbm",
  "model": "ada:2020-05-03",
  "object": "text_completion"
}

Is there any way I can get around this?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions