Interface ILlmFunctionOfValidate<Model>

LLM function metadata with validator.

ILlmFunctionOfValidate is an interface representing a function metadata, which has been used for the LLM (Language Large Model) function calling. Also, it's a function structure containing the function name, parameters and return type.

If you provide this ILlmFunctionOfValidate data to the LLM provider like "OpenAI", the "OpenAI" will compose a function arguments by analyzing conversations with the user. With the LLM composed arguments, you can execute the function and get the result.

If the LLM function calling take s a mistake that composing wrong typed parameters, you can correct the parameters by delivering the return value of the validate function. The validate function is a validator function reporting the detailed information about the wrong typed parameters.

By the way, do not ensure that LLM will always provide the correct arguments. The LLM of present age is not perfect, and sometimes takes a mistake that composing wrong typed parameters. In that case, you can correc the parameters by delivering the return value of the validate function. The validate function reports the detailed information about the wrong typed parameters,

interface ILlmFunctionOfValidate<Model extends ILlmSchema.Model> {
    deprecated?: boolean;
    description?: string;
    name: string;
    output?: ModelSchema[Model];
    parameters: ModelParameters[Model];
    separated?: ISeparated<Model>;
    tags?: string[];
    validate(props: object): IValidation<unknown>;
}

Type Parameters

  • Model extends ILlmSchema.Model

Hierarchy

  • ILlmFunction<Model>
    • ILlmFunctionOfValidate

Properties

deprecated?: boolean

Whether the function is deprecated or not.

If the deprecated is true, the function is not recommended to use.

LLM (Large Language Model) may not use the deprecated function.

description?: string

Description of the function.

For reference, the description is very important property to teach the purpose of the function to the LLM (Language Large Model), and LLM actually determines which function to call by the description.

Also, when the LLM conversates with the user, the description is used to explain the function to the user. Therefore, the description property has the highest priroity, and you have to consider it.

name: string

Representative name of the function.

output?: ModelSchema[Model]

Expected return type.

If the function returns nothing (void), the output value would be undefined.

parameters: ModelParameters[Model]

List of parameter types.

separated?: ISeparated<Model>

Collection of separated parameters.

tags?: string[]

Category tags for the function.

You can fill this property by the @tag ${name} comment tag.

Methods