|
|
Line 11: |
Line 11: |
| (like instructions) for the same bot in different scripts. This will lead AI to lose conversation context | | (like instructions) for the same bot in different scripts. This will lead AI to lose conversation context |
| | | |
− | == Commands == | + | == Commands reference == |
| | | |
− | ===Bot.AI.chat(message, senderName[, options])===
| + | {{API_Table_start|Command|Description}} |
− | <onlyinclude>'''Sends a chat message request to bot AI.'''</onlyinclude>
| + | {{API_Group|Configurations}} |
− | <syntaxhighlight lang="javascript">
| + | {{API_Entry|HTTP Bot Command|Bot.AI.chat}} |
− | Bot.AI.chat(message, senderName[, options]) | + | {{API_Entry|HTTP Bot Command|Bot.AI.configure}} |
− | </syntaxhighlight>
| + | {{API_Entry|HTTP Bot Command|Bot.AI.getConversationByName}} |
| + | {{API_Entry|HTTP Bot Command|Bot.AI.forgetConversation}} |
| + | {{API_Entry|HTTP Bot Command|Conversation.chat}} |
| + | {{API_Entry|HTTP Bot Command|Conversation.configure}} |
| | | |
− | {{API Command Table}}
| |
− | {{API Required Vars|Bot.AI.chat}}
| |
− |
| |
− | {{API Variable Group|Input}}
| |
− | {{API Variable|message|yes}} chat message to the bot
| |
− | {{API Variable|residentName|yes}} The name of the resident sending the message
| |
− | {{API Variable|options|optional}} The name of the resident sending the message Format:
| |
− | <pre>
| |
− | {
| |
− | 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;
| |
− | }
| |
− | </pre>
| |
− | {{API Variable Group|Output}}
| |
− | {{API Variable|text|}} The response of the bot
| |
− | {{API Variable|messageId|}} The id of the response message. Can be specified as parentMessageId later
| |
− | {{API Variable|usage|}} The object which contains Token Usage. Format: The object which contains all groups. Format:
| |
− | <pre>
| |
− | {
| |
− | // 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;
| |
− | }
| |
− | </pre>
| |
− | {{API Variables Table End}}
| |
− |
| |
− | * In case of error functions throws an error with a message.
| |
− |
| |
− | ----
| |
− |
| |
− | ===Bot.AI.configure(options)===
| |
− | <onlyinclude>'''Configures AI options to be used in all further communications within the current script.'''</onlyinclude>
| |
− | <syntaxhighlight lang="javascript">
| |
− | Bot.AI.configure(options)
| |
− | </syntaxhighlight>
| |
− |
| |
− | {{API Command Table}}
| |
− | {{API Required Vars|Bot.AI.configure}}
| |
− |
| |
− | {{API Variable Group|Input}}
| |
− | {{API Variable|options|yes}} configuration directives for the AI engine. Format:
| |
− | <pre>
| |
− | {
| |
− | // 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;
| |
− | }
| |
− | </pre>
| |
− | {{API Variable Group|Output}}
| |
− | {{API Return none}}
| |
− | {{API Variables Table End}}
| |
− |
| |
− | ----
| |
− |
| |
− | ===Bot.AI.getConversationByName(residentName)===
| |
− | <onlyinclude>'''Get/create conversation with a specific resident. If conversation doesn't exist yet, creates it.'''</onlyinclude>
| |
− | <syntaxhighlight lang="javascript">
| |
− | Bot.AI.getConversationByName(residentName)
| |
− | </syntaxhighlight>
| |
− |
| |
− | {{API Command Table}}
| |
− | {{API Required Vars|Bot.AI.configure}}
| |
− |
| |
− | {{API Variable Group|Input}}
| |
− | {{API Variable|residentName|yes}} Resident SL name
| |
− |
| |
− | {{API Variable Group|Output}}
| |
− | {{API Variable|result}} A conversation object.
| |
− | {{API Variables Table End}}
| |
− |
| |
− | ----
| |
− |
| |
− | ===Bot.AI.forgetConversation(residentName)===
| |
− | <onlyinclude>'''Forget (cancel) conversation of a bot with a specific resident.'''</onlyinclude>
| |
− | <syntaxhighlight lang="javascript">
| |
− | Bot.AI.forgetConversation(residentName)
| |
− | </syntaxhighlight>
| |
− |
| |
− | {{API Command Table}}
| |
− | {{API Required Vars|Bot.AI.forgetConversation}}
| |
− |
| |
− | {{API Variable Group|Input}}
| |
− | {{API Variable|residentName|yes}} Resident SL name
| |
− |
| |
− | {{API Variable Group|Output}}
| |
− | {{API Variable|none}}
| |
− | {{API Variables Table End}}
| |
− |
| |
− | ----
| |
− |
| |
− | ===Conversation.chat(message[, options])===
| |
− | <onlyinclude>'''Sends a chat message request to bot AI within a conversation with a specific resident.'''</onlyinclude>
| |
− | <syntaxhighlight lang="javascript">
| |
− | Conversation.chat(message[, options])
| |
− | </syntaxhighlight>
| |
− |
| |
− | {{API Command Table}}
| |
− | {{API Required Vars|Conversation.chat}}
| |
− |
| |
− | {{API Variable Group|Input}}
| |
− | {{API Variable|message|yes}} chat message to the bot
| |
− | {{API Variable|options|optional}} configuration directives for the AI engine. Example:
| |
− | <pre>
| |
− | {
| |
− | // Main configuration instructions for the AI: role, behavior, response rules etc.
| |
− | instructions?: string;
| |
− |
| |
− | // Maximum number of tokens to generate in response
| |
− | maxResponseTokens?: number;
| |
− | }
| |
− | </pre>
| |
− |
| |
− | {{API Variable Group|Output}}
| |
− | {{API Variable|same value as Bot.AI.chat(...)}} This command returns the same value as Bot.AI.chat(...)
| |
− | {{API Variables Table End}}
| |
− |
| |
− | ----
| |
− |
| |
− | ===Conversation.configure(options)===
| |
− | <onlyinclude>'''Sets some configuration values for the future usage'''</onlyinclude>
| |
− | <syntaxhighlight lang="javascript">
| |
− | Conversation.configure(options)
| |
− | </syntaxhighlight>
| |
− |
| |
− | {{API Command Table}}
| |
− | {{API Required Vars|Conversation.chat}}
| |
− |
| |
− | {{API Variable Group|Input}}
| |
− | {{API Variable|options|yes}} configuration directives for the AI engine. Example:
| |
− | <pre>
| |
− | {
| |
− | // Main configuration instructions for the AI: role, behavior, response rules etc.
| |
− | instructions?: string;
| |
− |
| |
− | // Maximum number of tokens to generate in response
| |
− | maxResponseTokens?: number;
| |
− | }
| |
− | </pre>
| |
− |
| |
− | {{API Variable Group|Output}}
| |
− | {{API Variable|none}}
| |
− | {{API Variables Table End}}
| |
| | | |
| {{NavMenu}} | | {{NavMenu}} |
| __NOTOC__ | | __NOTOC__ |
Smartbots AI is a conversation based AI which can be used with playground scripts in order to create AI Conversations.
of a context within a conversation.
reused for further communications with AI.
(like instructions) for the same bot in different scripts. This will lead AI to lose conversation context