Skip to main content

ai

const ai: object = AI

Defined in: js-api/grok.ts:33

AI API

Type Declaration

NameTypeDescriptionDefined in
configobjectConfiguration sub-namespace for AI provider settings.js-api/src/ai.ts:226
get config.configuredbooleanWhether an AI provider is configured.js-api/src/ai.ts:233
get config.currentAIConfigProvider settings as configured on the server.js-api/src/ai.ts:228
get config.indexEntitiesbooleanWhether entity indexing for searchEntities is on.js-api/src/ai.ts:238
get config.proxyTokenstringBearer token for the proxy.js-api/src/ai.ts:249
get config.proxyUrlstringURL of the server-side proxy to the AI provider.js-api/src/ai.ts:244
get onCancelObservable<AITurnEvent>Fires when a turn is aborted or abandoned.js-api/src/ai.ts:219
get onChunkObservable<AITurnEvent & object>Fires for every streamed chunk of any chat.js-api/src/ai.ts:215
get onErrorObservable<AITurnEvent & object>Fires when a turn fails.js-api/src/ai.ts:221
get onPromptObservable<AITurnEvent>Fires when a prompt is sent on any chat.js-api/src/ai.ts:213
get onResultObservable<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) => voidRegisters 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?) => AIStreamStreaming variant of prompt: yields text chunks and returns the final AIResult.js-api/src/ai.ts:208