ai
constai:object=AI
Defined in: js-api/grok.ts:33
AI API
Type Declaration
| Name | Type | Description | Defined in |
|---|---|---|---|
config | object | Configuration sub-namespace for AI provider settings. | js-api/src/ai.ts:226 |
get config.configured | boolean | Whether an AI provider is configured. | js-api/src/ai.ts:233 |
get config.current | AIConfig | Provider settings as configured on the server. | js-api/src/ai.ts:228 |
get config.indexEntities | boolean | Whether entity indexing for searchEntities is on. | js-api/src/ai.ts:238 |
get config.proxyToken | string | Bearer token for the proxy. | js-api/src/ai.ts:249 |
get config.proxyUrl | string | URL of the server-side proxy to the AI provider. | js-api/src/ai.ts:244 |
get onCancel | Observable<AITurnEvent> | Fires when a turn is aborted or abandoned. | js-api/src/ai.ts:219 |
get onChunk | Observable<AITurnEvent & object> | Fires for every streamed chunk of any chat. | js-api/src/ai.ts:215 |
get onError | Observable<AITurnEvent & object> | Fires when a turn fails. | js-api/src/ai.ts:221 |
get onPrompt | Observable<AITurnEvent> | Fires when a prompt is sent on any chat. | js-api/src/ai.ts:213 |
get onResult | Observable<AITurnEvent & object> | Fires when a turn completes. | js-api/src/ai.ts:217 |
chat() | (options?) => Promise<AIChat> | Opens a chat on the engine named in options.engine, or on the first available one. | js-api/src/ai.ts:198 |
engines() | () => Promise<AIEngine[]> | All engines: registered ones first, then those provided by package functions with the aiEngine role. | js-api/src/ai.ts:186 |
getEngine() | (id) => Promise<AIEngine | null> | The engine with [id], or null. | js-api/src/ai.ts:193 |
processPrompt() | (prompt) => Promise<boolean> | Hands [prompt] to the platform AI assistant (the AI panel); true when it was handled. | js-api/src/ai.ts:289 |
prompt() | (prompt, options?) => Promise<AIResult> | One-shot prompt on the engine named in options.engine, or on the first available one. | js-api/src/ai.ts:203 |
registerEngine() | (engine) => void | Registers an engine for this session; it takes precedence over engines discovered from packages. | js-api/src/ai.ts:181 |
searchEntities() | (text, threshold?, limit?, types?) => Promise<Entity[]> | Performs a semantic search over indexed Datagrok entities. The input [text] is converted into a vector embedding using the configured embedding model and compared against stored entity embeddings using vector distance. Results are filtered by the provided similarity [threshold], optionally restricted to specific entity [types], and limited by [limit]. Throws Error if AI indexing is disabled or no AI provider is configured. | js-api/src/ai.ts:276 |
stream() | (prompt, options?) => AIStream | Streaming variant of prompt: yields text chunks and returns the final AIResult. | js-api/src/ai.ts:208 |