Skip to content

DeepSeek streaming: HTTP client buffers full response body (missing stream option on Guzzle/Laravel HTTP) #990

@Jeo-Meek

Description

@Jeo-Meek
  1. Phenomenon: When using DeepSeek::stream() / streaming chat/completions, the response body is buffered in its entirety on the PHP side, and while (! $response->getBody()->eof()) waits for the upstream to complete before continuing to read data; SSE cannot truly process data edge-to-edge.

  2. Reason (brief description): Although 'stream' => true is present in the request JSON, Laravel HTTP / Guzzle does not have withOptions(['stream' => true]) set, resulting in non-streaming reading of the body.

  3. Comparison: Providers such as OpenAI, Groq, Mistral, and Anthropic within the same warehouse have already written withOptions(['stream' => true]) before post, whereas DeepSeek (and optionally Perplexity HandlesHttpRequests) is inconsistent.

  4. Suggested modification: In the sendRequest() method of src/Providers/DeepSeek/Handlers/Stream.php, add ->withOptions(['stream' => true]) to $this->client in a chained manner (consistent with Groq/Mistral, etc.).

  5. Environment: prism-php/prism version number (e.g. v0.99.22), PHP version, Laravel version (optional).

  6. Reproduction: The minimal reproduction can be described as "issuing a stream request with 'stream: true' to DeepSeek, and observing in the server logs or breakpoints whether 'read()' returns successively during the connection's lifetime" — or explaining that "in the Network, the upstream is chunked, but the PHP side fetches the complete body at once".

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions