Collection of separated parameters.

interface ISeparated<Model extends ILlmSchema.Model> {
    human: null | ModelParameters[Model];
    llm: ModelParameters[Model];
    validate?: (args: unknown) => IValidation<unknown>;
}

Type Parameters

  • Model extends ILlmSchema.Model

Properties

Properties

human: null | ModelParameters[Model]

Parameters that would be composed by the human.

llm: ModelParameters[Model]

Parameters that would be composed by the LLM.

Even though no property exists in the LLM side, the llm property would have at least empty object type.

validate?: (args: unknown) => IValidation<unknown>

Validate function of the separated arguments.

If LLM part of separated parameters has some properties, this validate function will be filled for the llm type validation.

You know what? LLM (Large Language Model) like OpenAI takes a lot of mistakes when composing arguments in function calling. Even though number like simple type is defined in the parameters schema, LLM often fills it just by a string typed value.

In that case, you have to give a validation feedback to the LLM by using this validate function. The validate function will return detailed information about every type errors about the arguments.

And in my experience, OpenAI's gpt-4o-mini model tends to construct an invalid function calling arguments at the first trial about 50% of the time. However, if correct it through this validate function, the success rate soars to 99% at the second trial, and I've never failed at the third trial.

Type declaration

    • (args: unknown): IValidation<unknown>
    • Parameters

      • args: unknown

        Arguments to validate

      Returns IValidation<unknown>

      Validate result