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

I hope that when verifying the schema of the chunk, the object field allows for undefined #1488

Closed
liuhuapiaoyuan opened this issue May 3, 2024 · 4 comments
Assignees
Labels

Comments

@liuhuapiaoyuan
Copy link

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

@lgrammel
Copy link
Collaborator

lgrammel commented May 6, 2024

@liuhuapiaoyuan can you provide an example of a provider that does not support the object field?

@liuhuapiaoyuan
Copy link
Author

For example, like Zhipu, there is no "object" field in its stream chunk. I believe this is an unnecessary validation field.

@liuhuapiaoyuan
Copy link
Author

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]

@lgrammel lgrammel self-assigned this May 15, 2024
@lgrammel
Copy link
Collaborator

#1702

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants