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
Name | Type | Description |
---|---|---|
id | string | The ID of the agent. |
Returns
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
Name | Type | Description |
---|---|---|
agentId | string | The agent id. |
prompt | string | The prompt. |
options? | AskOptionsWithoutVoice | The 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
Name | Type |
---|---|
agentId | string |
prompt | string | File |
isVoiceResponse | boolean |
options? | Omit <AiAgentChatOptions , "smoothTyping" > |
Returns
Promise
<T
>
askWithVoiceResponse
▸ askWithVoiceResponse(agentId
, prompt
, options?
): Promise
<AskWithVoiceResponse
>
Parameters
Name | Type |
---|---|
agentId | string |
prompt | string |
options? | Omit <AiAgentChatOptions , "smoothTyping" > |
Returns
Promise
<AskWithVoiceResponse
>
chat
▸ chat(agentId
, prompt
, options?
): Observable
<string
>
Sends a prompt to the specified agent id.
Parameters
Name | Type | Description |
---|---|---|
agentId | string | The agent id. |
prompt | string | The prompt. |
options? | ChatOptionsWithoutVoice | The 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
Name | Type |
---|---|
agentId | string |
options? | AiObserveStatusOptions |
Returns
Observable
<AiStatusMessage
>
search
▸ search(agentId
, options
): Promise
<AiSearchResponse
>
Parameters
Name | Type |
---|---|
agentId | string |
options | AiSearchOptions |
Returns
Promise
<AiSearchResponse
>
transcribeAndAsk
▸ transcribeAndAsk(agentId
, fileToTranscribe
, options?
): Promise
<AiTranscribeAndAskResponse
>
Parameters
Name | Type |
---|---|
agentId | string |
fileToTranscribe | File |
options? | AskOptionsWithoutVoice |
Returns
Promise
<AiTranscribeAndAskResponse
>
transcribeAndAskWithVoiceResponse
▸ transcribeAndAskWithVoiceResponse(agentId
, fileToTranscribe
, options?
): Promise
<TranscribeAndAskWithVoiceResponse
>
Parameters
Name | Type |
---|---|
agentId | string |
fileToTranscribe | File |
options? | Omit <AiAgentChatOptions , "smoothTyping" > |
Returns
Promise
<TranscribeAndAskWithVoiceResponse
>
transcribeAndChat
▸ transcribeAndChat(agentId
, fileToTranscribe
, options?
): Promise
<TranscribeAndChatResponse
>
Parameters
Name | Type |
---|---|
agentId | string |
fileToTranscribe | File |
options? | ChatOptionsWithoutVoice |
Returns
Promise
<TranscribeAndChatResponse
>