Class: AiAgentReference
Methods
ask
▸ ask(prompt
, options?
): Promise
<string
>
Sends a prompt to the current agent and returns the response.
Parameters
Name | Type | Description |
---|---|---|
prompt | string | The prompt. |
options? | Omit <AiAgentChatOptions , "smoothTyping" > | The chat options. |
Returns
Promise
<string
>
askWithVoiceResponse
▸ askWithVoiceResponse(prompt
, options?
): Promise
<AskWithVoiceResponse
>
Parameters
Name | Type |
---|---|
prompt | string |
options? | Omit <AiAgentChatOptions , "smoothTyping" > |
Returns
Promise
<AskWithVoiceResponse
>
chat
▸ chat(prompt
, options?
): Observable
<string
>
Sends a prompt to the current agent.
Parameters
Name | Type | Description |
---|---|---|
prompt | string | The prompt. |
options? | AiAgentChatOptions | 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?
): 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
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.
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
Name | Type | Description |
---|---|---|
data | AiAgentData | An 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
Name | Type |
---|---|
feedback | string |
Returns
Promise
<void
>
insertContexts
▸ insertContexts(contexts
, files?
): Promise
<void
>
Parameters
Name | Type |
---|---|
contexts | AiChatBotContextDataWithId [] |
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
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.
observeStatusUpdates
▸ observeStatusUpdates(options?
): Observable
<AiStatusMessage
>
Parameters
Name | Type |
---|---|
options? | AiObserveStatusOptions |
Returns
Observable
<AiStatusMessage
>
resetFeedback
▸ resetFeedback(): Promise
<void
>
Returns
Promise
<void
>
search
▸ search(options
): Promise
<AiSearchResponse
>
Parameters
Name | Type |
---|---|
options | AiSearchOptions |
Returns
Promise
<AiSearchResponse
>
transcribeAndAsk
▸ transcribeAndAsk(fileToTranscribe
, options?
): Promise
<AiTranscribeAndAskResponse
>
Parameters
Name | Type |
---|---|
fileToTranscribe | File |
options? | AskOptionsWithoutVoice |
Returns
Promise
<AiTranscribeAndAskResponse
>
transcribeAndAskWithVoiceResponse
▸ transcribeAndAskWithVoiceResponse(fileToTranscribe
, options?
): Promise
<TranscribeAndAskWithVoiceResponse
>
Parameters
Name | Type |
---|---|
fileToTranscribe | File |
options? | Omit <AiAgentChatOptions , "smoothTyping" > |
Returns
Promise
<TranscribeAndAskWithVoiceResponse
>
transcribeAndChat
▸ transcribeAndChat(fileToTranscribe
, options?
): Promise
<TranscribeAndChatResponse
>
Parameters
Name | Type |
---|---|
fileToTranscribe | File |
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
Name | Type | Description |
---|---|---|
data | Partial <AiAgentData > | An object containing options for updating the agent. |
file? | BlobAndFilename | File | The file to upload (optional). |
Returns
Promise
<void
>
A promise that resolves when the agent is successfully updated.