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: better handle OpenAI-Compatible streaming responses #1184

Merged
merged 1 commit into from
Feb 18, 2025

Conversation

wwsheng009
Copy link
Contributor

when the model response the function call and the content at same time, the function call will be missed.

2025-02-18T02:23:11.485Z [DEBUG] aichat::client::openai: stream-data: {"choices":[{"delta":{"content":"\n首先根据模型规则创建手机模型的JSON内容,然后调用 `fs_write` 函数将其保存。","role":"assistant","tool_calls":[{"function":{"arguments":"{\"contents\": \"{}\", \"path\": \"phone_model.json\"}","name":"fs_write"},"id":"call_y9r1is88k1ra6hfsjgy9szzt","index":0,"type":"function"}]},"finish_reason":"tool_calls","index":0}],"created":1739845391,"id":"021739845380522b669f33a9e610f838ec02b2a8d7741049b2fff","model":"doubao-pro-32k-241215","object":"chat.completion.chunk","usage":null}

@sigoden sigoden changed the title refactor(client): support the function call response fix: better handle OpenAI-Compatible streaming responses Feb 18, 2025
@sigoden sigoden merged commit 8bd7db9 into sigoden:main Feb 18, 2025
3 checks passed
@sigoden
Copy link
Owner

sigoden commented Feb 18, 2025

Great work, thanks!

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.

2 participants