Bot Playground/AI
Smartbots AI is a conversation based AI which can be used with playground scripts in order to create AI Conversations.
Contents
Conversations
- Conversations are the convenient way to manage conversations of the bot with different residents. Bot AI keeps track
of a context within a conversation.
- Conversation options can be adjusted separately for each conversation.
- Conversation is being created by calling Bot.AI.getConversationByName(residentName). The resulting object may be
reused for further communications with AI.
- Conversations are system-wide, tied to bot + specific resident. This means that if you should not set different options
(like instructions) for the same bot in different scripts. This will lead AI to lose conversation context
Commands
Bot.AI.chat(message, senderName[, options])
Sends a chat message request to bot AI.
Bot.AI.chat(message, senderName[, options])
Reference
This command accepts the following parameters:
Variable | Required | Description
| ||
---|---|---|---|---|
Input: | ||||
message | yes | chat message to the bot | ||
residentName | yes | The name of the resident sending the message | ||
options | optional | The name of the resident sending the message Format:
{ instructions?: string; // Previous messade id, if responding to a particular previous AI message of the bot parentMessageId?: string; // Maximum number of tokens to generate in response maxResponseTokens?: number; } | ||
Output: | ||||
(to be received in http_response LSL event, see docs for details) | ||||
result | OK - command completed successfully FAIL - command failed | |||
resulttext | Detailed reason for the failure. | |||
custom | The value from input "custom" parameter. See above. | |||
text | The response of the bot | |||
messageId | The id of the response message. Can be specified as parentMessageId later | |||
usage | The object which contains Token Usage. Format: The object which contains all groups. Format:
{ // Number of tokens in a request (message + instructions + history) prompt_tokens: number; // Number of tokens in a response completion_tokens: number; // Total tokens used total_tokens: number; // Tokens left on SmartBots AI balance tokens_left: number; } |
- In case of error functions throws an error with a message.
Bot.AI.configure(options)
Configures AI options to be used in all further communications within the current script.
Bot.AI.configure(options)
Reference
This command accepts the following parameters:
Variable | Required | Description
| |
---|---|---|---|
Input: | |||
options | yes | configuration directives for the AI engine. Format:
{ // Main configuration instructions for the AI: role, behavior, response rules etc. instructions?: string; // If responding to a particular previous AI message of the bot parentMessageId?: string; // Maximum number of tokens to generate in response maxResponseTokens?: number; // The unique conversation id. Usually generated automatically based // on the sender and bot name. conversationId?: string; } | |
Output: | |||
result | This function does not return anything |
Bot.AI.getConversationByName(residentName)
Get/create conversation with a specific resident. If conversation doesn't exist yet, creates it.
Bot.AI.getConversationByName(residentName)
Reference
This command accepts the following parameters:
Variable | Required | Description
| |
---|---|---|---|
Input: | |||
residentName | yes | Resident SL name | |
Output: | |||
result | A conversation object. |
Bot.AI.forgetConversation(residentName)
Forget (cancel) conversation of a bot with a specific resident.
Bot.AI.forgetConversation(residentName)
Reference
This command accepts the following parameters:
Variable | Required | Description
| |
---|---|---|---|
Input: | |||
residentName | yes | Resident SL name | |
Output: | |||
none |
Conversation.chat(message[, options])
Sends a chat message request to bot AI within a conversation with a specific resident.
Conversation.chat(message[, options])
Reference
This command accepts the following parameters:
Variable | Required | Description
| |
---|---|---|---|
Input: | |||
message | yes | chat message to the bot | |
options | optional | configuration directives for the AI engine. Example:
{ // Main configuration instructions for the AI: role, behavior, response rules etc. instructions?: string; // Maximum number of tokens to generate in response maxResponseTokens?: number; } | |
Output: | |||
same value as Bot.AI.chat(...) | This command returns the same value as Bot.AI.chat(...) |
Conversation.configure(options)
Sets some configuration values for the future usage
Conversation.configure(options)
Reference
This command accepts the following parameters:
Variable | Required | Description
| |
---|---|---|---|
Input: | |||
options | yes | configuration directives for the AI engine. Example:
{ // Main configuration instructions for the AI: role, behavior, response rules etc. instructions?: string; // Maximum number of tokens to generate in response maxResponseTokens?: number; } | |
Output: | |||
none |