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 moonshot usage compatible problem #1568

Merged
merged 1 commit into from
Dec 5, 2024

Conversation

rinfx
Copy link
Collaborator

@rinfx rinfx commented Dec 4, 2024

moonshot在返回最后一个chunk的时候,usage部分与openai不一致:

moonshot示例:

{
    "id": "chatcmpl-67500eb0c51af667d5968f74",
    "object": "chat.completion.chunk",
    "created": 1733299889,
    "model": "moonshot-v1-8k",
    "choices": [
        {
            "index": 0,
            "delta": {},
            "finish_reason": "stop",
            "usage": {
                "prompt_tokens": 10,
                "completion_tokens": 79,
                "total_tokens": 89
            }
        }
    ],
    "system_fingerprint": "fpv0_c26222aa"
}

openai示例:

{
    "id": "chatcmpl-675047e668e5d6e235622193",
    "object": "chat.completion.chunk",
    "created": 1733314534,
    "model": "moonshot-v1-8k",
    "choices": [
        {
            "index": 0,
            "delta": {},
            "finish_reason": "stop"
        }
    ],
    "system_fingerprint": "fpv0_80e0c0a3",
    "usage": {
        "prompt_tokens": 10,
        "completion_tokens": 27,
        "total_tokens": 37
    }
}

@rinfx rinfx force-pushed the fix-moonshot-compatible branch from 3587019 to 3c6f377 Compare December 4, 2024 12:23
@codecov-commenter
Copy link

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 43.50%. Comparing base (ef31e09) to head (3c6f377).
Report is 216 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #1568      +/-   ##
==========================================
+ Coverage   35.91%   43.50%   +7.59%     
==========================================
  Files          69       76       +7     
  Lines       11576    12325     +749     
==========================================
+ Hits         4157     5362    +1205     
+ Misses       7104     6627     -477     
- Partials      315      336      +21     

see 69 files with indirect coverage changes

Copy link
Collaborator

@johnlanni johnlanni left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@johnlanni johnlanni merged commit 22790aa into alibaba:main Dec 5, 2024
13 checks passed
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