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

💄 style: add function call support for Stepfun #4101

Merged
merged 3 commits into from
Sep 24, 2024

Conversation

hezhijie0327
Copy link
Contributor

@hezhijie0327 hezhijie0327 commented Sep 23, 2024

💻 变更类型 | Change Type

  • ✨ feat
  • 🐛 fix
  • ♻️ refactor
  • 💄 style
  • 👷 build
  • ⚡️ perf
  • 📝 docs
  • 🔨 chore

🔀 变更说明 | Description of Change

  1. Stepfun 流式输出时会在发送 tools_call 时生成三段空 content 作为执行工具调用前的特征,引起 UI 界面显示为空,暂时在使用工具调用时屏蔽 Stream

https://platform.stepfun.com/docs/api-reference/tool-call
https://platform.stepfun.com/docs/guide/tool_call

📝 补充信息 | Additional Information

Before
image
After
image

其他模型调用
image
image
image
image
image
image
image

data: {"id":"a828956f444cd170aeeb1ab12a4688c9.ed3d0deaecf4bc3f3b39b85b8c09f3eb","object":"chat.completion.chunk","created":0,"model":"step-1-8k","choices":[{"index":0,"delta":{"role":"assistant","content":""}}],"usage":{"prompt_tokens":0,"completion_tokens":0,"total_tokens":0}}

data: {"id":"a828956f444cd170aeeb1ab12a4688c9.ed3d0deaecf4bc3f3b39b85b8c09f3eb","object":"chat.completion.chunk","created":1727104577,"model":"step-1-8k","choices":[{"index":0,"delta":{"role":"","content":""}}],"usage":{"cached_tokens":96,"prompt_tokens":100,"completion_tokens":1,"total_tokens":101}}

data: {"id":"a828956f444cd170aeeb1ab12a4688c9.ed3d0deaecf4bc3f3b39b85b8c09f3eb","object":"chat.completion.chunk","created":1727104577,"model":"step-1-8k","choices":[{"index":0,"delta":{"role":"","content":""}}],"usage":{"cached_tokens":96,"prompt_tokens":100,"completion_tokens":2,"total_tokens":102}}

data: {"id":"a828956f444cd170aeeb1ab12a4688c9.ed3d0deaecf4bc3f3b39b85b8c09f3eb","object":"chat.completion.chunk","created":1727104577,"model":"step-1-8k","choices":[{"index":0,"delta":{"role":"","content":"","tool_calls":[{"id":"call_IzNEtXOXTI6q_BZq98vK6A","type":"function","function":{"name":"","arguments":""}}]}}],"usage":{"cached_tokens":96,"prompt_tokens":100,"completion_tokens":3,"total_tokens":103}}

data: {"id":"a828956f444cd170aeeb1ab12a4688c9.ed3d0deaecf4bc3f3b39b85b8c09f3eb","object":"chat.completion.chunk","created":1727104577,"model":"step-1-8k","choices":[{"index":0,"delta":{"role":"","content":"","tool_calls":[{"id":"","type":"","function":{"name":"","arguments":""}}]}}],"usage":{"cached_tokens":96,"prompt_tokens":100,"completion_tokens":4,"total_tokens":104}}

data: {"id":"a828956f444cd170aeeb1ab12a4688c9.ed3d0deaecf4bc3f3b39b85b8c09f3eb","object":"chat.completion.chunk","created":1727104577,"model":"step-1-8k","choices":[{"index":0,"delta":{"role":"","content":"","tool_calls":[{"id":"","type":"","function":{"name":"","arguments":""}}]}}],"usage":{"cached_tokens":96,"prompt_tokens":100,"completion_tokens":5,"total_tokens":105}}

data: {"id":"a828956f444cd170aeeb1ab12a4688c9.ed3d0deaecf4bc3f3b39b85b8c09f3eb","object":"chat.completion.chunk","created":1727104577,"model":"step-1-8k","choices":[{"index":0,"delta":{"role":"","content":"","tool_calls":[{"id":"","type":"","function":{"name":"","arguments":""}}]}}],"usage":{"cached_tokens":96,"prompt_tokens":100,"completion_tokens":6,"total_tokens":106}}

data: {"id":"a828956f444cd170aeeb1ab12a4688c9.ed3d0deaecf4bc3f3b39b85b8c09f3eb","object":"chat.completion.chunk","created":1727104577,"model":"step-1-8k","choices":[{"index":0,"delta":{"role":"","content":"","tool_calls":[{"id":"","type":"","function":{"name":"","arguments":""}}]}}],"usage":{"cached_tokens":96,"prompt_tokens":100,"completion_tokens":7,"total_tokens":107}}

data: {"id":"a828956f444cd170aeeb1ab12a4688c9.ed3d0deaecf4bc3f3b39b85b8c09f3eb","object":"chat.completion.chunk","created":1727104577,"model":"step-1-8k","choices":[{"index":0,"delta":{"role":"","content":"","tool_calls":[{"id":"","type":"","function":{"name":"","arguments":""}}]}}],"usage":{"cached_tokens":96,"prompt_tokens":100,"completion_tokens":8,"total_tokens":108}}

data: {"id":"a828956f444cd170aeeb1ab12a4688c9.ed3d0deaecf4bc3f3b39b85b8c09f3eb","object":"chat.completion.chunk","created":1727104577,"model":"step-1-8k","choices":[{"index":0,"delta":{"role":"","content":"","tool_calls":[{"id":"","type":"","function":{"name":"","arguments":""}}]}}],"usage":{"cached_tokens":96,"prompt_tokens":100,"completion_tokens":9,"total_tokens":109}}

data: {"id":"a828956f444cd170aeeb1ab12a4688c9.ed3d0deaecf4bc3f3b39b85b8c09f3eb","object":"chat.completion.chunk","created":1727104577,"model":"step-1-8k","choices":[{"index":0,"delta":{"role":"","content":"","tool_calls":[{"id":"","type":"","function":{"name":"","arguments":""}}]}}],"usage":{"cached_tokens":96,"prompt_tokens":100,"completion_tokens":10,"total_tokens":110}}

data: {"id":"a828956f444cd170aeeb1ab12a4688c9.ed3d0deaecf4bc3f3b39b85b8c09f3eb","object":"chat.completion.chunk","created":1727104577,"model":"step-1-8k","choices":[{"index":0,"delta":{"role":"","content":"","tool_calls":[{"id":"","type":"","function":{"name":"","arguments":""}}]}}],"usage":{"cached_tokens":96,"prompt_tokens":100,"completion_tokens":11,"total_tokens":111}}

data: {"id":"a828956f444cd170aeeb1ab12a4688c9.ed3d0deaecf4bc3f3b39b85b8c09f3eb","object":"chat.completion.chunk","created":1727104577,"model":"step-1-8k","choices":[{"index":0,"delta":{"role":"","content":"","tool_calls":[{"id":"","type":"","function":{"name":"","arguments":""}}]}}],"usage":{"cached_tokens":96,"prompt_tokens":100,"completion_tokens":12,"total_tokens":112}}

data: {"id":"a828956f444cd170aeeb1ab12a4688c9.ed3d0deaecf4bc3f3b39b85b8c09f3eb","object":"chat.completion.chunk","created":1727104577,"model":"step-1-8k","choices":[{"index":0,"delta":{"role":"","content":"","tool_calls":[{"id":"","type":"","function":{"name":"realtime-weather____fetchCurrentWeather","arguments":""}}]}}],"usage":{"cached_tokens":96,"prompt_tokens":100,"completion_tokens":13,"total_tokens":113}}

data: {"id":"a828956f444cd170aeeb1ab12a4688c9.ed3d0deaecf4bc3f3b39b85b8c09f3eb","object":"chat.completion.chunk","created":1727104577,"model":"step-1-8k","choices":[{"index":0,"delta":{"role":"","content":"","tool_calls":[{"id":"","type":"","function":{"name":"","arguments":"{\""}}]}}],"usage":{"cached_tokens":96,"prompt_tokens":100,"completion_tokens":14,"total_tokens":114}}

data: {"id":"a828956f444cd170aeeb1ab12a4688c9.ed3d0deaecf4bc3f3b39b85b8c09f3eb","object":"chat.completion.chunk","created":1727104577,"model":"step-1-8k","choices":[{"index":0,"delta":{"role":"","content":"","tool_calls":[{"id":"","type":"","function":{"name":"","arguments":"city"}}]}}],"usage":{"cached_tokens":96,"prompt_tokens":100,"completion_tokens":15,"total_tokens":115}}

data: {"id":"a828956f444cd170aeeb1ab12a4688c9.ed3d0deaecf4bc3f3b39b85b8c09f3eb","object":"chat.completion.chunk","created":1727104577,"model":"step-1-8k","choices":[{"index":0,"delta":{"role":"","content":"","tool_calls":[{"id":"","type":"","function":{"name":"","arguments":"\":"}}]}}],"usage":{"cached_tokens":96,"prompt_tokens":100,"completion_tokens":16,"total_tokens":116}}

data: {"id":"a828956f444cd170aeeb1ab12a4688c9.ed3d0deaecf4bc3f3b39b85b8c09f3eb","object":"chat.completion.chunk","created":1727104577,"model":"step-1-8k","choices":[{"index":0,"delta":{"role":"","content":"","tool_calls":[{"id":"","type":"","function":{"name":"","arguments":" \""}}]}}],"usage":{"cached_tokens":96,"prompt_tokens":100,"completion_tokens":17,"total_tokens":117}}

data: {"id":"a828956f444cd170aeeb1ab12a4688c9.ed3d0deaecf4bc3f3b39b85b8c09f3eb","object":"chat.completion.chunk","created":1727104577,"model":"step-1-8k","choices":[{"index":0,"delta":{"role":"","content":"","tool_calls":[{"id":"","type":"","function":{"name":"","arguments":"S"}}]}}],"usage":{"cached_tokens":96,"prompt_tokens":100,"completion_tokens":18,"total_tokens":118}}

data: {"id":"a828956f444cd170aeeb1ab12a4688c9.ed3d0deaecf4bc3f3b39b85b8c09f3eb","object":"chat.completion.chunk","created":1727104577,"model":"step-1-8k","choices":[{"index":0,"delta":{"role":"","content":"","tool_calls":[{"id":"","type":"","function":{"name":"","arguments":"hang"}}]}}],"usage":{"cached_tokens":96,"prompt_tokens":100,"completion_tokens":19,"total_tokens":119}}

data: {"id":"a828956f444cd170aeeb1ab12a4688c9.ed3d0deaecf4bc3f3b39b85b8c09f3eb","object":"chat.completion.chunk","created":1727104577,"model":"step-1-8k","choices":[{"index":0,"delta":{"role":"","content":"","tool_calls":[{"id":"","type":"","function":{"name":"","arguments":"hai"}}]}}],"usage":{"cached_tokens":96,"prompt_tokens":100,"completion_tokens":20,"total_tokens":120}}

data: {"id":"a828956f444cd170aeeb1ab12a4688c9.ed3d0deaecf4bc3f3b39b85b8c09f3eb","object":"chat.completion.chunk","created":1727104577,"model":"step-1-8k","choices":[{"index":0,"delta":{"role":"","content":"","tool_calls":[{"id":"","type":"","function":{"name":"","arguments":"\""}}]}}],"usage":{"cached_tokens":96,"prompt_tokens":100,"completion_tokens":21,"total_tokens":121}}

data: {"id":"a828956f444cd170aeeb1ab12a4688c9.ed3d0deaecf4bc3f3b39b85b8c09f3eb","object":"chat.completion.chunk","created":1727104577,"model":"step-1-8k","choices":[{"index":0,"delta":{"role":"","content":"","tool_calls":[{"id":"","type":"","function":{"name":"","arguments":"}"}}]}}],"usage":{"cached_tokens":96,"prompt_tokens":100,"completion_tokens":22,"total_tokens":122}}

data: {"id":"a828956f444cd170aeeb1ab12a4688c9.ed3d0deaecf4bc3f3b39b85b8c09f3eb","object":"chat.completion.chunk","created":1727104577,"model":"step-1-8k","choices":[{"index":0,"delta":{"role":"","content":""}}],"usage":{"cached_tokens":96,"prompt_tokens":100,"completion_tokens":23,"total_tokens":123}}

data: {"id":"a828956f444cd170aeeb1ab12a4688c9.ed3d0deaecf4bc3f3b39b85b8c09f3eb","object":"chat.completion.chunk","created":1727104577,"model":"step-1-8k","choices":[{"index":0,"delta":{"role":"","content":""}}],"usage":{"cached_tokens":96,"prompt_tokens":100,"completion_tokens":24,"total_tokens":124}}

data: {"id":"a828956f444cd170aeeb1ab12a4688c9.ed3d0deaecf4bc3f3b39b85b8c09f3eb","object":"chat.completion.chunk","created":1727104577,"model":"step-1-8k","choices":[{"index":0,"delta":{"role":"","content":""},"finish_reason":"stop"}],"usage":{"cached_tokens":96,"prompt_tokens":100,"completion_tokens":24,"total_tokens":124}}

data: [DONE]

Copy link

vercel bot commented Sep 23, 2024

@hezhijie0327 is attempting to deploy a commit to the LobeHub Pro Team on Vercel.

A member of the Team first needs to authorize it.

@dosubot dosubot bot added the size:S This PR changes 10-29 lines, ignoring generated files. label Sep 23, 2024
@lobehubbot
Copy link
Member

👍 @hezhijie0327

Thank you for raising your pull request and contributing to our Community
Please make sure you have followed our contributing guidelines. We will review it as soon as possible.
If you encounter any problems, please feel free to connect with us.
非常感谢您提出拉取请求并为我们的社区做出贡献,请确保您已经遵循了我们的贡献指南,我们会尽快审查它。
如果您遇到任何问题,请随时与我们联系。

@dosubot dosubot bot added the 💄 Design Design an style | 样式问题 label Sep 23, 2024
Copy link

codecov bot commented Sep 23, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 92.46%. Comparing base (c11b57b) to head (b1880b6).
Report is 20 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff            @@
##             main    #4101     +/-   ##
=========================================
  Coverage   92.45%   92.46%             
=========================================
  Files         482      482             
  Lines       34357    34379     +22     
  Branches     2277     3368   +1091     
=========================================
+ Hits        31766    31788     +22     
  Misses       2591     2591             
Flag Coverage Δ
app 92.46% <100.00%> (+<0.01%) ⬆️
server 97.36% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@LovelyGuYiMeng
Copy link
Contributor

step 2呢,试过嘛?

@lobehubbot
Copy link
Member

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


What about step 2, have you tried it?

@hezhijie0327
Copy link
Contributor Author

@LovelyGuYiMeng 好吧 又是一个官网文档两边不一致的问题,看了下 Stream 依旧是同样特征,过会儿本地 Build 后看看...

https://platform.stepfun.com/docs/llm/modeloverview
image

https://platform.stepfun.com/docs/api-reference/tool-call
image

@arvinxx arvinxx merged commit 8d7d96e into lobehub:main Sep 24, 2024
5 of 7 checks passed
@lobehubbot
Copy link
Member

❤️ Great PR @hezhijie0327 ❤️

The growth of project is inseparable from user feedback and contribution, thanks for your contribution! If you are interesting with the lobehub developer community, please join our discord and then dm @arvinxx or @canisminor1990. They will invite you to our private developer channel. We are talking about the lobe-chat development or sharing ai newsletter around the world.
项目的成长离不开用户反馈和贡献,感谢您的贡献! 如果您对 LobeHub 开发者社区感兴趣,请加入我们的 discord,然后私信 @arvinxx@canisminor1990。他们会邀请您加入我们的私密开发者频道。我们将会讨论关于 Lobe Chat 的开发,分享和讨论全球范围内的 AI 消息。

github-actions bot pushed a commit that referenced this pull request Sep 24, 2024
### [Version&nbsp;1.19.28](v1.19.27...v1.19.28)
<sup>Released on **2024-09-24**</sup>

#### 💄 Styles

- **misc**: Add function call support for Stepfun.

<br/>

<details>
<summary><kbd>Improvements and Fixes</kbd></summary>

#### Styles

* **misc**: Add function call support for Stepfun, closes [#4101](#4101) ([8d7d96e](8d7d96e))

</details>

<div align="right">

[![](https://img.shields.io/badge/-BACK_TO_TOP-151515?style=flat-square)](#readme-top)

</div>
@lobehubbot
Copy link
Member

🎉 This PR is included in version 1.19.28 🎉

The release is available on:

Your semantic-release bot 📦🚀

@hezhijie0327 hezhijie0327 deleted the stepfun branch September 24, 2024 21:40
github-actions bot pushed a commit to bentwnghk/lobe-chat that referenced this pull request Sep 24, 2024
### [Version&nbsp;1.62.13](v1.62.12...v1.62.13)
<sup>Released on **2024-09-24**</sup>

#### 💄 Styles

- **misc**: Add function call support for Stepfun, add google gemini 1.5 002 series, disable taichu2.0 functioncall & default disable taichu2.0v model, update taichu provider info & add taichu vision model.

<br/>

<details>
<summary><kbd>Improvements and Fixes</kbd></summary>

#### Styles

* **misc**: Add function call support for Stepfun, closes [lobehub#4101](https://github.com/bentwnghk/lobe-chat/issues/4101) ([8d7d96e](8d7d96e))
* **misc**: Add google gemini 1.5 002 series, closes [lobehub#4118](https://github.com/bentwnghk/lobe-chat/issues/4118) ([10145fa](10145fa))
* **misc**: Disable taichu2.0 functioncall & default disable taichu2.0v model, closes [lobehub#4117](https://github.com/bentwnghk/lobe-chat/issues/4117) ([00da53b](00da53b))
* **misc**: Update taichu provider info & add taichu vision model, closes [lobehub#4114](https://github.com/bentwnghk/lobe-chat/issues/4114) ([e5331db](e5331db))

</details>

<div align="right">

[![](https://img.shields.io/badge/-BACK_TO_TOP-151515?style=flat-square)](#readme-top)

</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
💄 Design Design an style | 样式问题 released size:S This PR changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants