logo
6
6
WeChat Login

ai接口使用流式输出时会出现问题#22

Resolved
created 1 months ago
Edit
response = client.cnb.ai.ai_chat_completions(
        repo=repo,
        body_params=dto.AiChatCompletionsReq(
            model="hunyuan-a13b",
            stream=True,
            messages=[

设置了stream为true,但是接口封装还是使用requests返回json格式,此时会报错

1
added labels
bug
Owner

#24

Owner
Edit history

已经修改,同时增加了三个方法 @itxq(神秘人📶⁶ᴳ)
用最新的 0.8.0 版本

client.cnb.ai.ai_chat_completions_stream                # 流式输出原始字符串
client.cnb.ai.ai_chat_completions_stream_parsed     # 流式输出  json
client.cnb.ai.ai_chat_completions_stream_content    # 流式仅输出 content 

具体的调用方法可参考 https://cnb.cool/cnb/sdk/python-cnb/-/blob/master/examples/ai_chat_demo.py

1
Resolved ISSUE
Assignee
None yet
Label
bug
Priority
None yet
Time period
-
Property
Add custom properties to record and label key information
Participant