Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add logprobs and top_logprobs to chat request model and logprobs to chat response choice model #210

Closed
HillPhelmuth opened this issue Dec 27, 2023 · 0 comments · Fixed by #211 or RageAgainstThePixel/com.openai.unity#160
Assignees
Labels
enhancement New feature or request

Comments

@HillPhelmuth
Copy link

HillPhelmuth commented Dec 27, 2023

Feature Request

Add support for logprobs in chat request/response

OpenAI api has added support for logprobs to their Chat endpoint

Describe the solution you'd like

The Chat version of logprobs is a little different than the old Completions implementation, but it should be relatively straightforward to implement. In the request just adding the two additional properties to the model and corresponding optional parameters in the constructor would suffice.

The response would require an additional property in the Choice model with new models for logprobs and its member content array.
Here's an example of the logprobs part of the response for reference:

"logprobs": {
        "content": [
          {
            "token": "Hello",
            "logprob": -0.31725305,
            "bytes": [72, 101, 108, 108, 111],
            "top_logprobs": [
              {
                "token": "Hello",
                "logprob": -0.31725305,
                "bytes": [72, 101, 108, 108, 111]
              },
              {
                "token": "Hi",
                "logprob": -1.3190403,
                "bytes": [72, 105]
              }
            ]
          },
          {
            "token": "!",
            "logprob": -0.02380986,
            "bytes": [
              33
            ],
            "top_logprobs": [
              {
                "token": "!",
                "logprob": -0.02380986,
                "bytes": [33]
              },
              {
                "token": " there",
                "logprob": -3.787621,
                "bytes": [32, 116, 104, 101, 114, 101]
              }
            ]
          }
        ]
      }
@HillPhelmuth HillPhelmuth added the enhancement New feature or request label Dec 27, 2023
@StephenHodgson StephenHodgson self-assigned this Dec 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
2 participants