Skip to content

Add reasoning_content to ChatCompletions #415

Open
@xsoutline

Description

@xsoutline

delta = chunk.choices[0].delta
# Handle text
if delta.content:

在以上代码的位置需要添加处理reasoning_content的流式响应信息事件,或者添加能够添加自定义事件处理程序
示例:

                delta = chunk.choices[0].delta

                # 尝试获取 reasoning_content(模型思考部分),防止属性不存在使用 getattr
                reasoning = getattr(delta, "reasoning_content", None)
                if reasoning:
                    print(reasoning, end='', flush=True)

                # Handle text
                if delta.content:

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions