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

Fix chat completion create response #372

Open
wants to merge 8 commits into
base: dev
Choose a base branch
from

Conversation

lanvada
Copy link

@lanvada lanvada commented Sep 5, 2023

  1. Change the Usage to a nullable type.
  2. When stream is true, the Delta field in the last object is {}.
{
    "id": "chatcmpl-7vKPd1Z1lthmAqos39G2iWlAtkcKb",
    "object": "chat.completion.chunk",
    "created": 1693897517,
    "model": "gpt-4-0613",
    "choices": [
        {
            "index": 0,
            "delta": {},
            "finish_reason": "stop"
        }
    ]
}
  1. Except for the first object, the Roles in other Message objects are empty.
{
    "id": "chatcmpl-7vKPd1Z1lthmAqos39G2iWlAtkcKb",
    "object": "chat.completion.chunk",
    "created": 1693897517,
    "model": "gpt-4-0613",
    "choices": [
        {
            "index": 0,
            "delta": {
                "content": "The"
            },
            "finish_reason": null
        }
    ]
}
  1. I saw that you judged whether the Choice is null when processing the result, I think it can be consistent and change the Choice field to be nullable.
  2. Except for the last object, the FinishReason in ChatChoiceRespons is null, so change the FinishReason field in ChatChoiceResponse to be nullable

@kayhantolga kayhantolga added this to the 7.2.1 milestone Sep 25, 2023
@kayhantolga kayhantolga modified the milestones: 7.3.0, 7.4.0 Oct 17, 2023
@kayhantolga kayhantolga removed this from the 8.4.2 milestone Oct 10, 2024
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.

3 participants