@ckeditor/ckeditor5-ai
Version:
AI features for CKEditor 5.
85 lines (84 loc) • 3.09 kB
TypeScript
/**
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
*/
/**
* @module ai/aicore/model/aimodels
* @publicApi
*/
import { type Locale } from '@ckeditor/ckeditor5-utils';
import { type AIConnector, type AIModelData } from '../../aicore/aiconnector.js';
/**
* Configuration for AI models.
*/
export interface AIModelsConfig {
/**
* Decides which model is selected by default across all AI features.
*/
defaultModelId?: string;
/**
* Decides which models are visible in model selectors across all AI features.
*/
displayedModels?: string | Array<string>;
/**
* Decides whether the model selector UI is visible across all AI features (Chat and Review Mode).
*
* When `true`:
* * If multiple models are available, the model selector dropdown is shown.
* * If only one model is available, the model name is displayed instead of the selector.
*
* When `false`, the model UI will not be shown no matter how many models are available.
*
* @default true
*/
showModelSelector?: boolean;
}
declare const AIModels_base: {
new (): import("@ckeditor/ckeditor5-utils").Emitter;
prototype: import("@ckeditor/ckeditor5-utils").Emitter;
};
/**
* Stores the list of available AI models acquired from the AI connector.
*/
export declare class AIModels extends /* #__PURE__ */ AIModels_base {
/**
* @inheritDoc
*/
constructor({ connector, config, locale }: {
connector: AIConnector;
config?: AIModelsConfig;
locale: Locale;
});
/**
* Returns a list of available models.
*/
getAll(): Promise<Array<AIModelData>>;
/**
* Returns a list of available models, which corresponds to {@link #getAll all models} narrowed down
* by the `ai.models.displayedModels` configuration.
*
* By default, only models marked with `recommended: true` are returned. However, models explicitly
* configured via `ai.models.displayedModels` are always included, even if not recommended.
*
* **Note:** `displayedModels` may include ids, names, and/or providers.
*/
getAvailableModels(): Promise<Array<AIModelData>>;
/**
* Returns a specific AI model from among {@link #getAll all models} by its id.
*
* **Note:** `'auto'` id always matches the `'agent*'` model.
*/
getModel(modelId?: string): Promise<AIModelData | null>;
/**
* Returns default AI model among the {@link #getAvailableModels available models} accounting for the
* `ai.models.defaultModelId` configuration.
*
* **Note**: If `'auto'` id was specified as `defaultModelId` in the configuration, it will match the `'agent*'` model.
*/
getDefault(): Promise<AIModelData | null>;
/**
* Checks whether the given model is available among the {@link #getAvailableModels available models}.
*/
isAvailable(model: AIModelData): Promise<boolean>;
}
export {};