def block_response_to_streaming_chunk()

in aidial_adapter_openai/utils/streaming.py [0:0]


def block_response_to_streaming_chunk(response: dict) -> dict:
    response["object"] = "chat.completion.chunk"
    for choice in response.get("choices") or []:
        if message := choice.get("message"):
            choice["delta"] = message
            del choice["message"]
    return response