Collection of separated parameters.

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

Type Parameters

Properties

Properties

human: null | ModelParameters[Model]

Parameters that would be composed by the human.

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 for separated arguments.

If the LLM part of separated parameters has properties, this validate function validates the llm type.

You know what? LLMs (Large Language Models) like OpenAI frequently make mistakes when composing arguments for function calling. Even with simple types like number defined in the parameters schema, LLMs often provide a string typed value instead.

In such cases, you should provide validation feedback to the LLM using this validate function. The validate function returns detailed information about type errors in the arguments.

Based on my experience, OpenAI's gpt-4o-mini model tends to construct invalid function calling arguments about 50% of the time on the first attempt. However, when corrected through this validate function, the success rate jumps to 99% on the second attempt, and I've never seen a failure on the third attempt.

Type declaration

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

      • args: unknown

        Arguments to validate

      Returns IValidation<unknown>

      Validation result