GitHub

NativeStream

API reference for NativeStream.

A platform's native streaming of one message, used by chat_markdown.stream when present. Adapter-facing, not on Chat.

  • start fails Unsupported when the platform refuses the feature for this thread or recipient; the caller then posts and edits. It sends all of markdown.
  • append is never retried by the adapter. held counts the trailing characters it could not send yet (an unclosed <, a high surrogate); the caller sends them again at the front of the next append. flush holds nothing back. TooLarge means nothing was added and the stream is still open.
  • stop closes the stream; stopped says whether a user had clicked stop. On a closed stream it gives False.
  • continues names the previous part's message, so per-reply state such as a rate limit's backoff carries over a rotation.

Functions

start

start(thread, *, markdown, reply_to=None, recipient=None, continues=None) -> Effect[Posted, ChatError]
ParameterTypeDescription
threadChatThread
markdownstr
reply_toReplyTo | None = None
recipientstr | None = None
continuesstr | None = None

Returns Effect[Posted, ChatError]

def start(
    self,
    thread: ChatThread,
    *,
    markdown: str,
    reply_to: ReplyTo | None = None,
    recipient: str | None = None,
    continues: str | None = None,
) -> Effect[Posted, ChatError]: ...

append

append(thread, message_id, markdown, *, flush=False) -> Effect[AppendResult, ChatError]
ParameterTypeDescription
threadChatThread
message_idstr
markdownstr
flushbool = False

Returns Effect[AppendResult, ChatError]

def append(
    self, thread: ChatThread, message_id: str, markdown: str, *, flush: bool = False
) -> Effect[AppendResult, ChatError]: ...

stop

stop(thread, message_id, *, end) -> Effect[bool, ChatError]
ParameterTypeDescription
threadChatThread
message_idstr
endLiteral['done', 'rotating']

Returns Effect[bool, ChatError]

def stop(
    self, thread: ChatThread, message_id: str, *, end: Literal["done", "rotating"]
) -> Effect[bool, ChatError]: ...