AnyLumino
API referenceastryxchat

Chat

Render a chat thread and composer from a Python-owned message list.

Notes

Assigning messages replaces the list; mutating it in place does not sync. To stream a reply, replace the last message with its longer content::

chat.messages = [*chat.messages[:-1], {"role": "assistant", "content": text}]

Submitting does not append the user message. Submit callbacks decide what the thread shows.

See Astryx component docs: https://astryx.atmeta.com/components/ChatLayout.

Attributes

attributemessages
= t.List(t.Dict(), default_value=[]).tag(sync=True)
attributeis_streaming
= t.Bool(False).tag(sync=True)
attributeplaceholder
= t.Unicode('').tag(sync=True)

Functions

constructor__init__(messages=(), *, is_streaming=False, placeholder='', disabled=False, width=None, height=480, **props) -> None
parammessagesIterable[Mapping[str, Any]]
= ()

Messages in display order. Each message has a role of "user", "assistant", or "system", Markdown content, an optional status of "sending", "sent", "error", or "stopped", and optional tool_calls. Each tool call has a name, an optional target, and a status of "pending", "running", "complete", or "error".

paramis_streamingbool
= False

Whether an assistant turn is in progress. While it is, the composer shows a stop control instead of the send button, and the last assistant message renders in streaming mode.

paramplaceholderstr
= ''

Composer placeholder. Empty uses the Astryx default.

paramdisabledbool
= False

Whether the composer is disabled. A disabled chat ignores submits.

paramwidthint | float | str | None
= None

CSS width. Numbers are normalized by anylumino where supported.

paramheightint | float | str | None
= 480

CSS height. The thread scrolls inside this height, so it needs a definite value. Numbers are normalized by anylumino where supported.

parampropsAny
= {}

Returns

None
funcon_submit(callback, remove=False) -> None

Register or unregister a callback receiving the chat and the submitted text.

paramcallbackCallable[[Chat, str], None]
paramremovebool
= False

Returns

None
funcon_stop(callback, remove=False) -> None

Register or unregister a callback for the composer stop control.

paramcallbackCallable[[Chat], None]
paramremovebool
= False

Returns

None

On this page