Class: AiChatbotProfileReference
Methods
ask
▸ ask(prompt
, options?
): Promise
<string
>
Sends a prompt to the current profile and returns the response as a Promise of string.
Parameters
Name | Type | Description |
---|---|---|
prompt | string | The prompt. |
options? | Omit <AiChatbotChatOptions , "smoothTyping" > | The chat options. |
Returns
Promise
<string
>
chat
▸ chat(prompt
, options?
): Observable
<string
>
Sends a prompt to the current profile.
Parameters
Name | Type | Description |
---|---|---|
prompt | string | The prompt. |
options? | AiChatbotChatOptions | The chat options. |
Returns
Observable
<string
>
An observable that emits when a new response token is received. The emitted value is the entire response that has been received so far.
context
▸ context(id?
): AiChatbotContextReference
Retrieves a context reference for the current profile. A context reference can be used to add a new context entry to the profile, or update/delete an existing entry context.
Parameters
Name | Type | Description |
---|---|---|
id? | string | The id of the context entry. If no id is passed, an id will be generated and the reference will point to a new context entry. |
Returns
The context reference.
delete
▸ delete(): Promise
<void
>
Deletes an existing chatbot profile. This will result in an error if a profile has not yet been created for the current profile id.
Returns
Promise
<void
>
A promise that resolves when the profile is successfully deleted.
insert
▸ insert(data
): Promise
<void
>
Adds a new profile to the chatbot. This will result in an error if a profile already exists with the same id.
Parameters
Name | Type | Description |
---|---|---|
data | ProfileData | An object containing options for creating the profile. |
Returns
Promise
<void
>
A promise that resolves when the profile is successfully created.
instruction
▸ instruction(id?
): AiChatbotInstructionReference
Retrieves an instruction reference for the current profile. An instruction reference can be used to add a new instruction entry to the profile, or update/delete an existing instruction entry.
Parameters
Name | Type | Description |
---|---|---|
id? | string | The id of the instruction entry. If no id is passed, an id will be generated and the reference will point to a new instruction entry. |
Returns
The instruction reference.
update
▸ update(data
): Promise
<void
>
Updates an existing chatbot profile. This will result in an error if a profile has not yet been created for the current profile id.
Parameters
Name | Type | Description |
---|---|---|
data | Partial <ProfileData > | An object containing options for updating the profile. |
Returns
Promise
<void
>
A promise that resolves when the profile is successfully updated.