openai / openai-node

Official JavaScript / TypeScript library for the OpenAI API
https://www.npmjs.com/package/openai
Apache License 2.0
7.98k stars 870 forks source link

system_fingerprint type definition is missing in ChatCompletionChunk #443

Open Code-Hex opened 1 year ago

Code-Hex commented 1 year ago

Confirm this is a Node library issue and not an underlying OpenAI API issue

Describe the bug

This is an example from the api-reference to the streaming response:

{"id":"chatcmpl-123","object":"chat.completion.chunk","created":1694268190,"model":"gpt-3.5-turbo-0613", "system_fingerprint": "fp_44709d6fcb", "choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null}]}

{"id":"chatcmpl-123","object":"chat.completion.chunk","created":1694268190,"model":"gpt-3.5-turbo-0613", "system_fingerprint": "fp_44709d6fcb", "choices":[{"index":0,"delta":{"content":"Hello"},"finish_reason":null}]}

{"id":"chatcmpl-123","object":"chat.completion.chunk","created":1694268190,"model":"gpt-3.5-turbo-0613", "system_fingerprint": "fp_44709d6fcb", "choices":[{"index":0,"delta":{"content":"!"},"finish_reason":null}]}

....

{"id":"chatcmpl-123","object":"chat.completion.chunk","created":1694268190,"model":"gpt-3.5-turbo-0613", "system_fingerprint": "fp_44709d6fcb", "choices":[{"index":0,"delta":{"content":" today"},"finish_reason":null}]}

{"id":"chatcmpl-123","object":"chat.completion.chunk","created":1694268190,"model":"gpt-3.5-turbo-0613", "system_fingerprint": "fp_44709d6fcb", "choices":[{"index":0,"delta":{"content":"?"},"finish_reason":null}]}

{"id":"chatcmpl-123","object":"chat.completion.chunk","created":1694268190,"model":"gpt-3.5-turbo-0613", "system_fingerprint": "fp_44709d6fcb", "choices":[{"index":0,"delta":{},"finish_reason":"stop"}]}

Actually, we can get system_fingerprint field from the response but openai api-reference and type definition are missing this field.

To Reproduce

Writing code to ChatCompletionChunk type

Code snippets

No response

OS

macOS

Node version

v18.18.0

Library version

4.16.1

rattrayalex commented 1 year ago

Thanks! This will be addressed via https://github.com/openai/openai-openapi/pull/109

tonymynd commented 8 months ago

happy day everyone, where can I learn more about this unique identifier for "system_fingerprint" in relation to "seed" with the goal to make an app with deterministic responses based in a customized knowledge base? Thanks.