AIEngine
Defined in: js-api/src/ai.ts:125
A provider of chats (an LLM backend). A package exposes one through a function with the aiEngine role; AI.registerEngine registers one directly.
Constructors
Constructor
new AIEngine():
AIEngine
Returns
AIEngine
Properties
| Property | Modifier | Type | Description | Defined in |
|---|---|---|---|---|
id | abstract | string | Stable identifier, used as options.engine. | js-api/src/ai.ts:127 |
name | abstract | string | Display name. | js-api/src/ai.ts:129 |
Methods
available()
abstractavailable():Promise<boolean>
Defined in: js-api/src/ai.ts:131
Whether the engine can serve requests now (configured and reachable).
Returns
Promise<boolean>
chat()
abstractchat(options?):Promise<AIChat>
Defined in: js-api/src/ai.ts:135
Opens a conversation.
Parameters
| Parameter | Type |
|---|---|
options? | AIChatOptions |
Returns
Promise<AIChat>
models()?
optionalmodels():Promise<string[]>
Defined in: js-api/src/ai.ts:133
Model names the engine offers, when it can enumerate them.
Returns
Promise<string[]>
prompt()
prompt(
prompt,options?):Promise<AIResult>
Defined in: js-api/src/ai.ts:138
One-shot prompt in a fresh chat that is closed afterwards.
Parameters
| Parameter | Type |
|---|---|
prompt | string |
options? | AIChatOptions & AIRunOptions |
Returns
Promise<AIResult>
stream()
stream(
prompt,options?):AIStream
Defined in: js-api/src/ai.ts:149
Streaming one-shot prompt in a fresh chat that is closed afterwards.
Parameters
| Parameter | Type |
|---|---|
prompt | string |
options? | AIChatOptions & AIRunOptions |