Closed liuhuapiaoyuan closed 5 months ago
@liuhuapiaoyuan can you provide an example of a provider that does not support the object
field?
For example, like Zhipu
, there is no "object" field in its stream chunk. I believe this is an unnecessary validation field.
data: {"id":"8313807536837492492","created":1706092316,"model":"glm-4","choices":[{"index":0,"delta":{"role":"assistant","content":"土"}}]}
data: {"id":"8313807536837492492","created":1706092316,"model":"glm-4","choices":[{"index":0,"delta":{"role":"assistant","content":"星"}}]}
....
data: {"id":"8313807536837492492","created":1706092316,"model":"glm-4","choices":[{"index":0,"delta":{"role":"assistant","content":","}}]}
data: {"id":"8313807536837492492","created":1706092316,"model":"glm-4","choices":[{"index":0,"delta":{"role":"assistant","content":"主要由"}}]}
data: {"id":"8313807536837492492","created":1706092316,"model":"glm-4","choices":[{"index":0,"finish_reason":"length","delta":{"role":"assistant","content":""}}],"usage":{"prompt_tokens":60,"completion_tokens":100,"total_tokens":160}}
data: [DONE]
Feature Description
const openaiChatChunkSchema = z.object({ object: z.enum([ 'chat.completion.chunk', 'chat.completion', support for OpenAI-compatible providers such as Perplexity ]),
Because some third-party LLM are not fully standardized when they are compatible with OpenAI's interface, such as missing object, I hope this field can be selected
Use Case
No response
Additional context
No response