Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Streaming Messages #27

Open
tracyboehrer opened this issue Dec 19, 2024 · 0 comments
Open

Streaming Messages #27

tracyboehrer opened this issue Dec 19, 2024 · 0 comments
Labels

Comments

@tracyboehrer
Copy link
Member

tracyboehrer commented Dec 19, 2024

Spec update, to include description of streaming messages, for example OpenAI streamed responses, to a channel. This is already implemented in Copilot Studio and Teams.

Streaming Text Messages

  • Typing Activity is used to send an aggregate text value of a larger chunked message.
    • "Delta" type streaming is not supported in the inital version, but could be added later if required.
  • Stream information will be included in an Entity in the Activity
    • Type: "streaminfo"
    • Properties
      • streamId: Required unique ID
      • streamSequence: Required incrementing integer for each Typing Activity sent, and final Message
      • streamType: Optional, default is "streaming"
        • "informative"
        • "streaming"
        • "final"
          • Only on final "message" Activity
      • streamResult: Optional, default "success", only appropriate on final message.
        • "success"
        • "timeout"
        • "error"
  • Informative messages
    • Can be sent in any order
    • Text is in Activity.Text
    • TextFormat can be supplied
    • Increments the streamSequence
  • Throttling
    • Outgoing Typing Activities should be throttled to a configurable interval
  • Streaming should terminate via a configurable timeout
    • A final 'message' type Activity should be sent.
  • Only Activity.Text is streamed.
    • Configurable Activity.TextFormat
  • The final complete message is sent via a normal 'message' type Activity
    • This should be the complete buffered text.
    • Should contain streamInfo Entity with "streamType" equal to "final", and the "streamResult"
    • Can contain any other valid Activity content.
  • Unsupported channels
    • Should buffer until the stream message is complete, and sent as a 'message" Activity
    • WebChat and Teams are the only supported channels currently.

Example:

// Sending the informative message
{
  "type": "typing",
  "text": "Getting the answer...",
  "textFormat": "markdown",
  "entities": [
      {
        "type": "streaminfo",
        "streamId": "a-00001",
        "streamType": "informative",
        "streamSequence": 1,
      }
  ]
}

// Sending the first chunk
{
  "type": "typing",
  "text": "A quick brown",
  "entities": [
      {
        "type": "streaminfo",
        "streamId": "a-00001",
        "streamType": "streaming",
        "streamSequence": 2,
      }
  ]
}

// Sending the second chunk
{
  "type": "typing",
  "text": "A quick brown fox jumped over the",
  "entities": [
      {
        "type": "streaminfo",
        "streamId": "a-00001",
        "streamType": "streaming",
        "streamSequence": 3,
      }
  ]
}

// Sending the last chunk
{
  "type": "typing",
  "text": "A quick brown fox jumped over the lazy dog.",
  "entities": [
      {
        "type": "streaminfo",
        "streamId": "a-00001",
        "streamType": "streaming",
        "streamSequence": 4,
      }
  ]
}

// Final message
{
  "type": "message",
  "text": "A quick brown fox jumped over the lazy dog.",
  "entities": [
      {
        "type": "streaminfo",
        "streamId": "a-00001",
        "streamType": "final",
        "streamSequence": 5,
      }
  ]
}

Other

  • Bot Framework/MCS SDK
    • New StreamInfo Entity
    • Transcription
      • May want to optionally allow transcription of Typing Activities containing the "streaminfo" Entity
  • This should probably be a proactive operation due to the indeterminate length of the streamed responses.
    • Mindful in handling Azure scale-down during a long operation.
    • Less of an immediate issue for MCS SDK since AsyncCloudAdapter is being used.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant