Setup - Streaming

Last modified:

When using SleekAI, it is important to understand how the plugin handles API requests: streaming or non-streaming. These approaches affect how data is exchanged between SleekAI and the API server, influencing both the performance and user experience.

Streaming

Streaming requests facilitate a continuous flow of data similar to ChatGPT:

  • Continuous Data Flow: This method allows data to be transmitted back to SleekAI as soon as the API begins processing the request. SleekAI handles the stream management automatically, presenting data to users as it becomes available.
  • Limitations: Although SleekAI simplifies the complexities of streaming, the implementer of the plugin may need to ensure their hosting environment supports persistent connections to fully utilize this feature.

Non-Streaming

Non-streaming requests are processed in a straightforward, single-exchange fashion:

  • Request and Response Cycle: SleekAI sends a complete request and waits for a full response from the API.
  • Limitations: For large datasets or scenarios that require immediate updates, non-streaming may introduce delays, as the response only begins after the entire request has been processed. This could be a concern for requests that involve extensive processing time.

Hosts

Hosts need to support Server-Sent Events (SSE) to enable streaming requests. Below is a list of popular hosting platforms and their support for SSE.

Kinsta

Supported

Fully supports Server-Sent Events (SSE), no additional configuration required.

Local (WPEngine)

Manual

Supports Server-Sent Events (SSE) but requires manual configuration. See this post in the LocalWP forums for more information.