Skip to main content

Class: AiAgentReference

Methods

ask

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

Sends a prompt to the current agent and returns the response.

Parameters

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

Returns

Promise<string>


askWithVoiceResponse

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

Parameters

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

Returns

Promise<AskWithVoiceResponse>


chat

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

Sends a prompt to the current agent.

Parameters

NameTypeDescription
promptstringThe prompt.
options?AiAgentChatOptionsThe 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 agent. A context reference can be used to add a new context entry to the agent, 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.


create

create(data): Promise<void>

Creates a new AI Agent. This will result in an error if an agent already exists with the same id.

Parameters

NameTypeDescription
dataAiAgentDataAn object containing options for creating the agent.

Returns

Promise<void>

A promise that resolves when the agent is successfully created.


delete

delete(): Promise<void>

Deletes an existing agent. Throws an error if the agent has not been created for the current agent ID.

Returns

Promise<void>

A promise that resolves when the agent is successfully deleted.


feedback

feedback(feedback): Promise<void>

Parameters

NameType
feedbackstring

Returns

Promise<void>


insertContexts

insertContexts(contexts, files?): Promise<void>

Parameters

NameType
contextsAiChatBotContextDataWithId[]
files?(BlobAndFilename | File)[]

Returns

Promise<void>


instruction

instruction(id?): AiAgentInstructionReference

Retrieves an instruction reference for the current agent. An instruction reference can be used to add a new instruction entry to the agent, 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.


observeStatusUpdates

observeStatusUpdates(options?): Observable<AiStatusMessage>

Parameters

NameType
options?AiObserveStatusOptions

Returns

Observable<AiStatusMessage>


resetFeedback

resetFeedback(): Promise<void>

Returns

Promise<void>


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<AiAgentChatOptions, "smoothTyping">

Returns

Promise<TranscribeAndAskWithVoiceResponse>


transcribeAndChat

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

Parameters

NameType
fileToTranscribeFile
options?AiAgentChatOptions

Returns

Promise<TranscribeAndChatResponse>


update

update(data, file?): Promise<void>

Updates an existing agent. An error will be thrown if the agent has not yet been created for the current agent ID.

Parameters

NameTypeDescription
dataPartial<AiAgentData>An object containing options for updating the agent.
file?BlobAndFilename | FileThe file to upload (optional).

Returns

Promise<void>

A promise that resolves when the agent is successfully updated.