No valid stream events were sent. Make sure the events are using {text: string} or {html: string} format. You can also augment them using the responseInterceptor property: https://deepchat.dev/docs/interceptors#responseInterceptor

Created on 4 March 2025, 2 months ago

Problem/Motivation

When using the LMStudio Provider in Drupal AI Suite, I get this error during streaming responses:

No valid stream events were sent.
Make sure the events are using {text: string} or {html: string} format.
You can also augment them using the responseInterceptor property: https://deepchat.dev/docs/interceptors#responseInterceptor

The response does appear after refreshing the page, but the error itself appears whenever a live stream is attempted.

Steps to reproduce

  1. Install and enable the LMStudio Provider module.
  2. Enable and configure Drupal AI Suite to use LMStudio as the chat provider.
  3. Initiate a chat through Drupal AI Suite with streaming enabled.
  4. Observe the logs or the chat output for the error: "No valid stream events were sent."
  5. Refresh the page and notice the final (non-streamed) message is displayed successfully.

Proposed resolution

  • LMStudio’s streaming output needs to be transformed to the {text: string} or {html: string} format that Deep Chat/Drupal AI Suite expects.
  • Implement a responseInterceptor to reshape LMStudio’s streamed chunks, for example:
    responseInterceptor: (originalResponse) => {
      // Adjust the below line based on LMStudio response structure
      return [{ text: originalResponse.choices[0].message.content }];
    }
    
  • This ensures each chunk in the stream is wrapped in a JSON object with a text property, eliminating the "No valid stream events were sent" error.

Remaining tasks

  • Update documentation or provide an example config/snippet for users integrating LMStudio with Drupal AI Suite.
  • Determine if LMStudio supports partial chunked responses or if additional handling is required for partial streaming.

User interface changes

No direct UI changes.

API changes

No direct API changes; just a format adjustment to streaming output.

Data model changes

None.

💬 Support request
Status

Needs review

Version

1.0

Component

Code

Created by

🇺🇸United States sushichris

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024