import { CallableFunctionModel } from "../schemas/callableFunction.schema.js"; import { CallableFunctionObject } from "./CallableFunctionParameters/CallableFunctionObject.js"; import { CallableFunctionParameter } from "./CallableFunctionParameters/CallableFunctionParameter.js"; import { JsonSchema, JsonSchemaObject } from "../schemas/jsonSchema.schema.js"; import { CreateChatCompletionFunction } from "../utils/types/index.js"; export declare class CallableFunction { /** * The name of the callable function. This name will be used by the AI assistant. */ name: string; /** * A description of the callable function. While optional, it is strongly recommended to provide a description. */ description?: string | undefined; /** * A UUID generated for this function by the library. */ id: string; private _parameters; constructor( /** * The name of the callable function. This name will be used by the AI assistant. */ name: string, /** * A description of the callable function. While optional, it is strongly recommended to provide a description. */ description?: string | undefined, /** * The initial parameters of the callable function. */ parameters?: CallableFunctionObject | JsonSchemaObject); /** * Creates a new `CallableFunction` instance from a serialized callable function. * * @param json The JSON object of the CallableFunction instance. * @returns A new `CallableFunction` instance */ static fromJSON(json: CallableFunctionModel): CallableFunction; /** * Serializes the callable function to JSON. * * @returns The `CallableFunction` as a JSON object. */ toJSON(): CallableFunctionModel; /** * Adds a parameter to the object. * * @param parameterOrSchema The parameter to add or the JsonSchema of the parameter and its name to add. * @param required Whether the parameter is required. * @returns this */ addParameter(parameterOrSchema: CallableFunctionParameter | (JsonSchema & { name: string; }), required?: boolean): this; /** * Gets a parameter by name. * * @param name The name of the parameter to get. * @returns The parameter with the given name, or undefined if it does not exist. */ getParameter(name: string): CallableFunctionParameter<{ title?: string | undefined; description?: string | undefined; default?: any; examples?: any[] | undefined; readOnly?: boolean | undefined; writeOnly?: boolean | undefined; deprecated?: boolean | undefined; $comment?: string | undefined; }> | undefined; /** * Removes a parameter by name. * * @param name The name of the parameter to remove. * @returns this */ removeParameter(name: string): this; /** * The list of `CallableFunctionParameter` instances. */ get parameters(): CallableFunctionParameter<{ title?: string | undefined; description?: string | undefined; default?: any; examples?: any[] | undefined; readOnly?: boolean | undefined; writeOnly?: boolean | undefined; deprecated?: boolean | undefined; $comment?: string | undefined; }>[]; /** * The list of required `CallableFunctionParameter` instances. */ get requiredParameters(): CallableFunctionParameter<{ title?: string | undefined; description?: string | undefined; default?: any; examples?: any[] | undefined; readOnly?: boolean | undefined; writeOnly?: boolean | undefined; deprecated?: boolean | undefined; $comment?: string | undefined; }>[]; /** * The list of optional `CallableFunctionParameter` instances. */ get optionalParameters(): CallableFunctionParameter<{ title?: string | undefined; description?: string | undefined; default?: any; examples?: any[] | undefined; readOnly?: boolean | undefined; writeOnly?: boolean | undefined; deprecated?: boolean | undefined; $comment?: string | undefined; }>[]; /** * JSON definition of the callable function as consumed by OpenAI's API. */ get chatCompletionFunction(): CreateChatCompletionFunction; }