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>
This commit is contained in:
anovazzi1 2024-11-21 11:04:45 -03:00 committed by GitHub
commit 105e52f6eb
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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