Skip to main content

Class: AiAgentClient

Methods

agent

agent(id): AiAgentReference

Retrieves a reference to an agent with the specified ID. The returned agent reference can be used to create and update the agent, add instructions and context, and initiate chats.

Parameters

NameTypeDescription
idstringThe ID of the agent.

Returns

AiAgentReference

A reference to the agent.


ask

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

Sends a prompt to the specified agent id and returns the response as a Promise of string.

Parameters

NameTypeDescription
agentIdstringThe agent id.
promptstringThe prompt.
options?AskOptionsWithoutVoiceThe options to send to the chat model.

Returns

Promise<string>

A promise that resolves when the chat is complete. The resolved value is the entire response.


askInternal

askInternal<T>(agentId, prompt, isVoiceResponse, options?): Promise<T>

Type parameters

Name
T

Parameters

NameType
agentIdstring
promptstring | File
isVoiceResponseboolean
options?Omit<AiAgentChatOptions, "smoothTyping">

Returns

Promise<T>


askWithVoiceResponse

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

Parameters

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

Returns

Promise<AskWithVoiceResponse>


chat

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

Sends a prompt to the specified agent id.

Parameters

NameTypeDescription
agentIdstringThe agent id.
promptstringThe prompt.
options?ChatOptionsWithoutVoiceThe options to send to the chat model.

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.


observeStatusUpdates

observeStatusUpdates(agentId, options?): Observable<AiStatusMessage>

Parameters

NameType
agentIdstring
options?AiObserveStatusOptions

Returns

Observable<AiStatusMessage>


search(agentId, options): Promise<AiSearchResponse>

Parameters

NameType
agentIdstring
optionsAiSearchOptions

Returns

Promise<AiSearchResponse>


transcribeAndAsk

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

Parameters

NameType
agentIdstring
fileToTranscribeFile
options?AskOptionsWithoutVoice

Returns

Promise<AiTranscribeAndAskResponse>


transcribeAndAskWithVoiceResponse

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

Parameters

NameType
agentIdstring
fileToTranscribeFile
options?Omit<AiAgentChatOptions, "smoothTyping">

Returns

Promise<TranscribeAndAskWithVoiceResponse>


transcribeAndChat

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

Parameters

NameType
agentIdstring
fileToTranscribeFile
options?ChatOptionsWithoutVoice

Returns

Promise<TranscribeAndChatResponse>