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

Update logprobs handling #12

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Update logprobs handling #12

wants to merge 1 commit into from

Conversation

oesni
Copy link

@oesni oesni commented Aug 9, 2024

Fix issues on logprobs request.

stream response is like

{
    "id": "f9873c36-67c2-445e-92a6-6646a0b31304",
    "object": "chat.completion.chunk",
    "created": 1723180270,
    "model": "model-name",
    "choices": [
        {
            "index": 0,
            "delta": {
                "content": "Hello!"
            },
            "finish_reason": null,
            "logprobs": {
                "content": [
                    {
                        "token": "Hello",
                        "logprob": -0.10208277,
                        "bytes": [
                            72,
                            101,
                            108,
                            108,
                            111
                        ],
                        "top_logprobs": [],
                        "token_id": 16230,
                        "text_offset": 0
                    },
                    {
                        "token": "!",
                        "logprob": -0.02145231,
                        "bytes": [
                            33
                        ],
                        "top_logprobs": [],
                        "token_id": 28808,
                        "text_offset": 5
                    }
                ]
            }
        }
    ],
    "usage": null
}

So need to count logrpobs.content

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant