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

开放平台的文档有些内容不正确(也可能是旧了),另外我写了一款支持MoonshotAI的neovim插件 #41

Open
Kurama622 opened this issue Sep 22, 2024 · 0 comments

Comments

@Kurama622
Copy link

Kurama622 commented Sep 22, 2024

希望更新一下官网文档

api返回内容的格式描述似乎有误:

官方文档的描述是

data: {"id":"cmpl-1305b94c570f447fbde3180560736287","object":"chat.completion.chunk","created":1698999575,"model":"moonshot-v1-8k","choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null}]}
 
data: {"id":"cmpl-1305b94c570f447fbde3180560736287","object":"chat.completion.chunk","created":1698999575,"model":"moonshot-v1-8k","choices":[{"index":0,"delta":{"content":"你好"},"finish_reason":null}]}
 
...
 
data: {"id":"cmpl-1305b94c570f447fbde3180560736287","object":"chat.completion.chunk","created":1698999575,"model":"moonshot-v1-8k","choices":[{"index":0,"delta":{"content":"。"},"finish_reason":null}]}
 
data: {"id":"cmpl-1305b94c570f447fbde3180560736287","object":"chat.completion.chunk","created":1698999575,"model":"moonshot-v1-8k","choices":[{"index":0,"delta":{},"finish_reason":"stop","usage":{"prompt_tokens":19,"completion_tokens":13,"total_tokens":32}}]}
 
data: [DONE]

实际输出的格式:

data: {"id":"chatcmpl-66efb6f2f4dc0b0e6ec210b3","object":"chat.completion.chunk","created":1726985970,"model":"moonshot-v1-8k","choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null}],"system_fingerprint":"fpv0_293876d1"}
data: {"id":"chatcmpl-66efb6f2f4dc0b0e6ec210b3","object":"chat.completion.chunk","created":1726985970,"model":"moonshot-v1-8k","choices":[{"index":0,"delta":{"content":"Hello"},"finish_reason":null}],"system_fingerprint":"fpv0_293876d1"}
data: {"id":"chatcmpl-66efb6f2f4dc0b0e6ec210b3","object":"chat.completion.chunk","created":1726985970,"model":"moonshot-v1-8k","choices":[{"index":0,"delta":{"content":"!"},"finish_reason":null}],"system_fingerprint":"fpv0_293876d1"}
...
data: {"id":"chatcmpl-66efb6f2f4dc0b0e6ec210b3","object":"chat.completion.chunk","created":1726985970,"model":"moonshot-v1-8k","choices":[{"index":0,"delta":{"content":"?"},"finish_reason":null}],"system_fingerprint":"fpv0_293876d1"}
data: {"id":"chatcmpl-66efb6f2f4dc0b0e6ec210b3","object":"chat.completion.chunk","created":1726985970,"model":"moonshot-v1-8k","choices":[{"index":0,"delta":{},"finish_reason":"stop","usage":{"prompt_tokens":156,"completion_tokens":30,"total_tokens":186}}],"system_fingerprint":"fpv0_293876d1"}
data: [DONE]

多了一个system_fingerprint字段,在解析输出的时候会有影响

支持MoonshotAI的neovim插件

插件地址:https://github.com/Kurama622/llm.nvim
文档说明:https://github.com/Kurama622/llm.nvim/wiki/Modify-LLM#example
image

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

No branches or pull requests

1 participant