Skip to content

StreamModel: lite_llm.py generate_content_async missing llm content #1368

Closed

Description

@growmuye

When encountering the following response, the text will be lost in stream mode.

version:1.3.0

Stream original data:
resp_demo.txt

The following JSON is the content after merging the datas, for the sake of being more direct.

{
    "id": "31f7a4e4-0669-4f6c-adb1-305fc26c9e59",
    "object": "chat.completion",
    "created": 1749787787,
    "model": "deepseek-chat",
    "choices": [
        {
            "index": 0,
            "message": {
                "role": "assistant",
                "content": "/*PLANNING*/\n1. **提取搜索条件**:根据职.......",
                "tool_calls": [
                    {
                        "index": 0,
                        "id": "call_0_5a848c28-29bd-4fb3-8ec9-6864e5efcf77",
                        "type": "function",
                        "function": {
                            "name": "online_search_res_v3",
                            "arguments": "{\"job_id\":\"ed8bb1906592d2582e04ac5bc6141a07\"}"
                        }
                    }
                ]
            },
            "logprobs": null,
            "finish_reason": "tool_calls"
        }
    ],
    "usage": {
        "prompt_tokens": 4470,
        "completion_tokens": 346,
        "total_tokens": 4816,
        "prompt_tokens_details": {
            "cached_tokens": 4416
        },
        "prompt_cache_hit_tokens": 4416,
        "prompt_cache_miss_tokens": 54
    },
    "system_fingerprint": "fp_8802369eaa_prod0425fp8"
}

problem code↓↓↓↓

Image

fix code↓↓↓↓

Image

Metadata

Metadata

Assignees

Labels

live

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions