AIChat
Defined in: js-api/src/ai.ts:73
A conversation with one engine. Implementations provide respond; stream and prompt add the shared grok.ai.on* turn events.
Constructors
Constructor
new AIChat():
AIChat
Returns
AIChat
Methods
close()
close():
void
Defined in: js-api/src/ai.ts:121
Releases the conversation; the default does nothing.
Returns
void
prompt()
prompt(
prompt,options?):Promise<AIResult>
Defined in: js-api/src/ai.ts:112
Sends [prompt] and awaits the full result.
Parameters
| Parameter | Type |
|---|---|
prompt | string |
options? | AIRunOptions |
Returns
Promise<AIResult>
respond()
abstractprotectedrespond(prompt,options?):AIStream
Defined in: js-api/src/ai.ts:75
Produces the reply to [prompt] as a stream of text chunks that ends with the AIResult.
Parameters
| Parameter | Type |
|---|---|
prompt | string |
options? | AIRunOptions |
Returns
stream()
stream(
prompt,options?):AIStream
Defined in: js-api/src/ai.ts:78
Sends [prompt]; yields text chunks and returns the final result. Emits the grok.ai.on* events.
Parameters
| Parameter | Type |
|---|---|
prompt | string |
options? | AIRunOptions |