ai-utils.js
Version:
Build AI applications, chatbots, and agents with JavaScript and TypeScript.
24 lines (23 loc) • 777 B
TypeScript
import { ModelInformation } from "./ModelInformation.js";
import { ModelCallObserver } from "./ModelCallObserver.js";
export interface ModelSettings {
observers?: Array<ModelCallObserver>;
}
export interface Model<SETTINGS> {
modelInformation: ModelInformation;
readonly settings: SETTINGS;
/**
* The `withSettings` method creates a new model with the same configuration as the original model, but with the specified settings changed.
*
* @example
* const model = new OpenAITextGenerationModel({
* model: "text-davinci-003",
* maxTokens: 500,
* });
*
* const modelWithMoreTokens = model.withSettings({
* maxTokens: 1000,
* });
*/
withSettings(additionalSettings: Partial<SETTINGS>): this;
}