@ckeditor/ckeditor5-ai
Version:
AI features for CKEditor 5.
67 lines (66 loc) • 2.77 kB
TypeScript
/**
* @license Copyright (c) 2003-2025, 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 'ckeditor5/src/utils.js';
import { type AIConnector, type AIModelData } from '../../aicore/aiconnector.js';
declare const AIModels_base: {
new (): import("ckeditor5/src/utils.js").Emitter;
prototype: import("ckeditor5/src/utils.js").Emitter;
};
/**
* Stores the list of available AI models acquired from the AI connector.
*/
export declare class AIModels extends /* #__PURE__ */ AIModels_base {
/**
* @inheritDoc
*/
constructor({ connector, availableModels, defaultModelId }: {
connector: AIConnector;
availableModels?: string | Array<string>;
defaultModelId?: string;
});
/**
* 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 `availableModels` passed to the {@link #constructor}.
*
* **Note:** `availableModels` 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
* `defaultModelId` passed to the {@link #constructor}.
*
* **Note**: If `'auto'` id was specified as `defaultModelId` in the {@link #constructor}, 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>;
/**
* Translates an arbitrary list of models using the given {@link module:utils/locale~Locale} instance.
*
* **Note:**
* * Models with `id`s starting with "agent" will be named "Auto" (localized) in the user interface and get a localized description.
* * The rest of models known to the translation service keep their original name but still get a localized description.
* * Models unknown to the translation service keep their original name and description.
*/
static getLocalized(locale: Locale, models: Array<AIModelData>): Array<LocalizedAIModelData>;
}
export type LocalizedAIModelData = AIModelData;
export {};