From 105e52f6eb50e0fa70c3b2a256800b173634ee59 Mon Sep 17 00:00:00 2001 From: anovazzi1 Date: Thu, 21 Nov 2024 11:04:45 -0300 Subject: [PATCH] docs: update Message object in guides-data-message.md (#4727) * refactor: Improve structure and attributes of Message object in guides-data-message.md Co-authored-by: Mendon Kissling <59585235+mendonk@users.noreply.github.com> --- docs/docs/Guides/guides-data-message.md | 34 ++++++++++++++++--------- 1 file changed, 22 insertions(+), 12 deletions(-) diff --git a/docs/docs/Guides/guides-data-message.md b/docs/docs/Guides/guides-data-message.md index e65fcbe1f..a8e48ec11 100644 --- a/docs/docs/Guides/guides-data-message.md +++ b/docs/docs/Guides/guides-data-message.md @@ -60,10 +60,10 @@ print(data.title) # Outputs: "Hello, World!" because "title" key is in the data The `Data` object is also convenient for visualization of outputs, since the output preview has visual elements to inspect data as a table and its cells as pop ups for basic types. The idea is to create a unified way to work and visualize complex information in Langflow. -To receive `Data` objects in a component input, you can use the `DataInput` input type. +To receive `Data` objects in a component input, you can use the `DataInput` input type. -## The Message Object {#f4f17cad02a545068f407d515cbc2902} +## Message object attributes {#f4f17cad02a545068f407d515cbc2902} --- @@ -71,17 +71,27 @@ To receive `Data` objects in a component input, you can use the `DataInput` inpu The `Message` object extends the functionality of `Data` and includes additional attributes and methods for chat interactions. -- **Main Attributes:** - - `text_key`: Key to retrieve the primary text data. - - `text`: The main text content of the message. - - `sender`: Identifier for the sender (e.g., "User" or "AI"). - - `sender_name`: Name of the sender. - - `files`: List of files associated with the message. - - `session_id`: Identifier for the chat session. - - `timestamp`: Timestamp when the message was created. - - `flow_id`: Identifier for the flow. -The `Message` object can be used to send, store and manipulate chat messages within Langflow. You can create a `Message` object by directly assigning key-value pairs to it. For example: +- **Core message data:** + - `text`: The main text content of the message + - `sender`: Identifier for the sender (e.g., "User" or "AI") + - `sender_name`: Name of the sender + - `session_id`: Identifier for the chat session + - `timestamp`: Timestamp when the message was created (UTC) + - `flow_id`: Identifier for the flow + - `id`: Unique identifier for the message + +- **Content and files:** + - `files`: List of files or images associated with the message + - `content_blocks`: List of structured content blocks + - `properties`: Additional properties including visual styling and source information + +- **Message state:** + - `error`: Boolean indicating if there was an error + - `edit`: Boolean indicating if the message was edited + - `category`: Message category ("message", "error", "warning", "info") + +The `Message` object can be used to send, store, and manipulate chat messages within Langflow. You can create a `Message` object by directly assigning key-value pairs to it. For example: ```python