openai-reassembler 0.2.0

Reassemble OpenAI-compatible SSE streaming responses into non-streaming format
Documentation
{
  "chunks": [
    {
      "choices": [
        {
          "delta": {
            "content": "",
            "role": "assistant"
          },
          "finish_reason": null,
          "index": 0,
          "logprobs": null
        }
      ],
      "created": 1773337060,
      "id": "chatcmpl-903e12a17450a0cc",
      "model": "Qwen/Qwen2-0.5B-Instruct",
      "object": "chat.completion.chunk",
      "prompt_token_ids": null
    },
    {
      "choices": [
        {
          "delta": {
            "content": "O"
          },
          "finish_reason": null,
          "index": 0,
          "logprobs": null,
          "token_ids": null
        }
      ],
      "created": 1773337060,
      "id": "chatcmpl-903e12a17450a0cc",
      "model": "Qwen/Qwen2-0.5B-Instruct",
      "object": "chat.completion.chunk"
    },
    {
      "choices": [
        {
          "delta": {
            "content": "ceans"
          },
          "finish_reason": null,
          "index": 0,
          "logprobs": null,
          "token_ids": null
        }
      ],
      "created": 1773337060,
      "id": "chatcmpl-903e12a17450a0cc",
      "model": "Qwen/Qwen2-0.5B-Instruct",
      "object": "chat.completion.chunk"
    },
    {
      "choices": [
        {
          "delta": {
            "content": " vast"
          },
          "finish_reason": null,
          "index": 0,
          "logprobs": null,
          "token_ids": null
        }
      ],
      "created": 1773337060,
      "id": "chatcmpl-903e12a17450a0cc",
      "model": "Qwen/Qwen2-0.5B-Instruct",
      "object": "chat.completion.chunk"
    },
    {
      "choices": [
        {
          "delta": {
            "content": " and"
          },
          "finish_reason": null,
          "index": 0,
          "logprobs": null,
          "token_ids": null
        }
      ],
      "created": 1773337060,
      "id": "chatcmpl-903e12a17450a0cc",
      "model": "Qwen/Qwen2-0.5B-Instruct",
      "object": "chat.completion.chunk"
    },
    {
      "choices": [
        {
          "delta": {
            "content": " deep"
          },
          "finish_reason": null,
          "index": 0,
          "logprobs": null,
          "token_ids": null
        }
      ],
      "created": 1773337060,
      "id": "chatcmpl-903e12a17450a0cc",
      "model": "Qwen/Qwen2-0.5B-Instruct",
      "object": "chat.completion.chunk"
    },
    {
      "choices": [
        {
          "delta": {
            "content": ",\n"
          },
          "finish_reason": null,
          "index": 0,
          "logprobs": null,
          "token_ids": null
        }
      ],
      "created": 1773337060,
      "id": "chatcmpl-903e12a17450a0cc",
      "model": "Qwen/Qwen2-0.5B-Instruct",
      "object": "chat.completion.chunk"
    },
    {
      "choices": [
        {
          "delta": {
            "content": "Sil"
          },
          "finish_reason": null,
          "index": 0,
          "logprobs": null,
          "token_ids": null
        }
      ],
      "created": 1773337060,
      "id": "chatcmpl-903e12a17450a0cc",
      "model": "Qwen/Qwen2-0.5B-Instruct",
      "object": "chat.completion.chunk"
    },
    {
      "choices": [
        {
          "delta": {
            "content": "ent"
          },
          "finish_reason": null,
          "index": 0,
          "logprobs": null,
          "token_ids": null
        }
      ],
      "created": 1773337060,
      "id": "chatcmpl-903e12a17450a0cc",
      "model": "Qwen/Qwen2-0.5B-Instruct",
      "object": "chat.completion.chunk"
    },
    {
      "choices": [
        {
          "delta": {
            "content": " waves"
          },
          "finish_reason": null,
          "index": 0,
          "logprobs": null,
          "token_ids": null
        }
      ],
      "created": 1773337060,
      "id": "chatcmpl-903e12a17450a0cc",
      "model": "Qwen/Qwen2-0.5B-Instruct",
      "object": "chat.completion.chunk"
    },
    {
      "choices": [
        {
          "delta": {
            "content": " crash"
          },
          "finish_reason": null,
          "index": 0,
          "logprobs": null,
          "token_ids": null
        }
      ],
      "created": 1773337060,
      "id": "chatcmpl-903e12a17450a0cc",
      "model": "Qwen/Qwen2-0.5B-Instruct",
      "object": "chat.completion.chunk"
    },
    {
      "choices": [
        {
          "delta": {
            "content": " against"
          },
          "finish_reason": null,
          "index": 0,
          "logprobs": null,
          "token_ids": null
        }
      ],
      "created": 1773337060,
      "id": "chatcmpl-903e12a17450a0cc",
      "model": "Qwen/Qwen2-0.5B-Instruct",
      "object": "chat.completion.chunk"
    },
    {
      "choices": [
        {
          "delta": {
            "content": " shore"
          },
          "finish_reason": null,
          "index": 0,
          "logprobs": null,
          "token_ids": null
        }
      ],
      "created": 1773337060,
      "id": "chatcmpl-903e12a17450a0cc",
      "model": "Qwen/Qwen2-0.5B-Instruct",
      "object": "chat.completion.chunk"
    },
    {
      "choices": [
        {
          "delta": {
            "content": ",\n"
          },
          "finish_reason": null,
          "index": 0,
          "logprobs": null,
          "token_ids": null
        }
      ],
      "created": 1773337060,
      "id": "chatcmpl-903e12a17450a0cc",
      "model": "Qwen/Qwen2-0.5B-Instruct",
      "object": "chat.completion.chunk"
    },
    {
      "choices": [
        {
          "delta": {
            "content": "Peace"
          },
          "finish_reason": null,
          "index": 0,
          "logprobs": null,
          "token_ids": null
        }
      ],
      "created": 1773337060,
      "id": "chatcmpl-903e12a17450a0cc",
      "model": "Qwen/Qwen2-0.5B-Instruct",
      "object": "chat.completion.chunk"
    },
    {
      "choices": [
        {
          "delta": {
            "content": "ful"
          },
          "finish_reason": null,
          "index": 0,
          "logprobs": null,
          "token_ids": null
        }
      ],
      "created": 1773337060,
      "id": "chatcmpl-903e12a17450a0cc",
      "model": "Qwen/Qwen2-0.5B-Instruct",
      "object": "chat.completion.chunk"
    },
    {
      "choices": [
        {
          "delta": {
            "content": " sea"
          },
          "finish_reason": null,
          "index": 0,
          "logprobs": null,
          "token_ids": null
        }
      ],
      "created": 1773337060,
      "id": "chatcmpl-903e12a17450a0cc",
      "model": "Qwen/Qwen2-0.5B-Instruct",
      "object": "chat.completion.chunk"
    },
    {
      "choices": [
        {
          "delta": {
            "content": "."
          },
          "finish_reason": null,
          "index": 0,
          "logprobs": null,
          "token_ids": null
        }
      ],
      "created": 1773337060,
      "id": "chatcmpl-903e12a17450a0cc",
      "model": "Qwen/Qwen2-0.5B-Instruct",
      "object": "chat.completion.chunk"
    },
    {
      "choices": [
        {
          "delta": {
            "content": ""
          },
          "finish_reason": "stop",
          "index": 0,
          "logprobs": null,
          "stop_reason": null,
          "token_ids": null
        }
      ],
      "created": 1773337060,
      "id": "chatcmpl-903e12a17450a0cc",
      "model": "Qwen/Qwen2-0.5B-Instruct",
      "object": "chat.completion.chunk"
    },
    {
      "choices": [],
      "created": 1773337060,
      "id": "chatcmpl-903e12a17450a0cc",
      "model": "Qwen/Qwen2-0.5B-Instruct",
      "object": "chat.completion.chunk",
      "usage": {
        "completion_tokens": 18,
        "prompt_tokens": 37,
        "total_tokens": 55
      }
    },
    "[DONE]"
  ],
  "expected": {
    "choices": [
      {
        "finish_reason": "stop",
        "index": 0,
        "logprobs": null,
        "message": {
          "annotations": null,
          "audio": null,
          "content": "Oceans vast and deep,\nSilent waves crash against shore,\nPeaceful sea.",
          "function_call": null,
          "reasoning": null,
          "refusal": null,
          "role": "assistant",
          "tool_calls": []
        },
        "stop_reason": null,
        "token_ids": null
      }
    ],
    "created": 1773337058,
    "id": "chatcmpl-91839202b88d896c",
    "kv_transfer_params": null,
    "model": "Qwen/Qwen2-0.5B-Instruct",
    "object": "chat.completion",
    "prompt_logprobs": null,
    "prompt_token_ids": null,
    "service_tier": null,
    "system_fingerprint": null,
    "usage": {
      "completion_tokens": 18,
      "prompt_tokens": 37,
      "prompt_tokens_details": null,
      "total_tokens": 55
    }
  }
}