Inputs
Input and output components define where data enters and exits your flow.
Both Text Input and Chat Input components accept user input and return a Message
object, but they serve different purposes.
The Text Input component accepts a text string input and returns a Message
object containing only the input text. The output does not appear in the Playground.
The Chat Input component accepts multiple input types including text, files, and metadata, and returns a Message
object containing the text along with sender information, session ID, and file attachments.
The Chat Input component provides an interactive chat interface in the Playground.
Chat input
This component collects user input as Text
strings from the chat and wraps it in a Message
object that includes the input text, sender information, session ID, file attachments.
It can optionally store the message in a chat history.
Parameters
Name | Display Name | Info |
---|---|---|
background_color |
Background Color |
The background color of the icon. |
chat_icon |
Icon |
The icon of the message. |
files |
Files |
Files to be sent with the message. |
input_value |
Text |
The message to be passed as input. Accepts text, data objects, messages, and dataframes. |
sender |
Sender Type |
The type of sender. |
sender_name |
Sender Name |
The name of the sender. |
session_id |
Session ID |
The session ID of the chat. If empty, the current session_id parameter is used. |
should_store_message |
Store Messages |
Store the message in the history. |
text_color |
Text Color |
The text color of the name. |
Name | Display Name | Info |
---|---|---|
message |
Message |
The response message. |
Message method
The ChatInput
class provides an asynchronous method to create and store a Message
object based on the input parameters.
The Message
object is created in the message_response
method of the ChatInput
class using the Message.create()
factory method.
The user’s input is stored in the input_value
field of the Message
object.
message = await Message.create(
text=self.input_value,
sender=self.sender,
sender_name=self.sender_name,
session_id=self.session_id,
files=self.files,
properties={
"background_color": background_color,
"text_color": text_color,
"icon": icon,
},
)
Component code
chat.py
404: Not Found
Text Input
The Text Input component accepts a text string input and returns a Message
object containing only the input text.
The output does not appear in the Playground.
Parameters
Name | Display Name | Info |
---|---|---|
input_value |
Text |
The text to be passed as input. |
Name | Display Name | Info |
---|---|---|
text |
Text |
The response message containing the input text. |
Component code
text.py
404: Not Found