Skip to main content

Class: AiAgentReference

Hierarchy

Methods

ask

ask(prompt, options?): Promise<string>

Sends a prompt to the current profile and returns the response as a Promise of string.

Parameters

NameTypeDescription
promptstringThe prompt.
options?Omit<AiChatbotChatOptions, "smoothTyping">The chat options.

Returns

Promise<string>


askWithVoiceResponse

askWithVoiceResponse(prompt, options?): Promise<AskWithVoiceResponse>

Parameters

NameType
promptstring
options?Omit<AiChatbotChatOptions, "smoothTyping">

Returns

Promise<AskWithVoiceResponse>


chat

chat(prompt, options?): Observable<string>

Sends a prompt to the current profile.

Parameters

NameTypeDescription
promptstringThe prompt.
options?AiChatbotChatOptionsThe 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?): AiAgentContextReference

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

NameTypeDescription
id?stringThe 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

AiAgentContextReference

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

NameTypeDescription
dataProfileDataAn object containing options for creating the profile.

Returns

Promise<void>

A promise that resolves when the profile is successfully created.


instruction

instruction(id?): AiAgentInstructionReference

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

NameTypeDescription
id?stringThe 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

AiAgentInstructionReference

The instruction reference.


search(options): Promise<AiSearchResponse>

Parameters

NameType
optionsAiSearchOptions

Returns

Promise<AiSearchResponse>


transcribeAndAsk

transcribeAndAsk(fileToTranscribe, options?): Promise<AiTranscribeAndAskResponse>

Parameters

NameType
fileToTranscribeFile
options?AskOptionsWithoutVoice

Returns

Promise<AiTranscribeAndAskResponse>


transcribeAndAskWithVoiceResponse

transcribeAndAskWithVoiceResponse(fileToTranscribe, options?): Promise<TranscribeAndAskWithVoiceResponse>

Parameters

NameType
fileToTranscribeFile
options?Omit<AiChatbotChatOptions, "smoothTyping">

Returns

Promise<TranscribeAndAskWithVoiceResponse>


transcribeAndChat

transcribeAndChat(fileToTranscribe, options?): Promise<TranscribeAndChatResponse>

Parameters

NameType
fileToTranscribeFile
options?AiChatbotChatOptions

Returns

Promise<TranscribeAndChatResponse>


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

NameTypeDescription
dataPartial<ProfileData>An object containing options for updating the profile.

Returns

Promise<void>

A promise that resolves when the profile is successfully updated.