This page demonstrates how to create a new message within a conversation for your AI Assistant app. Creating messages enables you to programmatically interact with your AI Assistant, send user inputs, and receive responses.
#Create Message via API
Note that the NAMESPACE_ID
, APP_ID
, and CONVERSATION_ID
path parameters
must be replaced with the app owner's ID, the app ID, and the conversation ID
respectively.
#Body Parameters
content
(string, required): The text content of the message.role
(string, required): The role of the message sender. Use"user"
for user messages and"assistant"
for AI Assistant responses.type
(string, required): The type of the message. Currently, only"MESSAGE_TYPE_TEXT"
is supported.
Note: The role
field distinguishes between user messages and assistant
responses. This is important for maintaining the context and flow of the
conversation.
#Example Response
A successful response will return a JSON object containing the details of the newly created message.
{ "message": { "uid": "generated-message-uid", "appUid": "your-app-uid", "conversationUid": "your-conversation-uid", "content": "Hello, how can I improve my code?", "role": "user", "type": "MESSAGE_TYPE_TEXT", "createTime": "2024-10-09T12:34:56Z", "updateTime": "2024-10-09T12:34:56Z", "msgSenderUid": "your-user-uid" }}
#Output Description
message
: An object containing the details of the created message.uid
(string): The unique identifier of the message generated by the system.appUid
(string): The UID of the app the message belongs to.conversationUid
(string): The UID of the conversation.content
(string): The content of the message.role
(string): The role of the message sender.type
(string): The type of the message.createTime
(string): The timestamp when the message was created.updateTime
(string): The timestamp when the message was last updated.msgSenderUid
(string): The UID of the message sender.
#Create Message via Console
To create a new message within a conversation using the Instill Console, follow these steps:
- Launch Instill Console on Instill Cloud.
- Navigate to the Applications page using the navigation bar.
- Click on the AI Assistant card you wish to interact with.
- In the playground, select the existing Catalog you want to converse with.
- Type your message into the input field at the bottom of the chat interface.
- Press the
Send
button (represented by an arrow icon) to send your message. - The console will automatically store your message and the AI Assistant's response within the conversation.
Note: The Instill Console simplifies the process by handling message creation and storage automatically when you interact with your AI Assistant.